The dwSensorIMU_readFrame()
function reads the next available IMU data frame with a given timeout. The function call is blocking, until an IMU frame is available or the timeout is exceeded. Frames read from the sensor do not have to be returned because the messages are copied.
Depending on the particular IMU sensor capabilities, an IMU frame can be only partially filled with data. The dwIMUFlags
are used to indicate which fields in dwIMUFrame
are valid.
Example
The following code shows the general structure of a program reading data from an IMU sensor.
params.
parameters =
"device=/dev/<serial device>,baud=<baudrate>";
while(loop)
{
...
}
DW_API_PUBLIC dwStatus dwSensorIMU_readFrame(dwIMUFrame *const frame, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
Reads the next IMU frame from the sensor within a given timeout.
An IMU frame containing sensor readings from the IMU sensor.
const char8_t * parameters
Array to additional parameters provided to sensor creation.
const char8_t * protocol
Name of the protocol.
DW_API_PUBLIC dwStatus dwSAL_createSensor(dwSensorHandle_t *const sensor, dwSensorParams const params, dwSALHandle_t const sal)
Creates a new sensor managed by the SAL module with the given parameters.
DW_API_PUBLIC dwStatus dwSensor_start(dwSensorHandle_t const sensor)
Starts the sensor previously successfully created with 'dwSAL_createSensor()'.
DW_API_PUBLIC dwStatus dwSensor_stop(dwSensorHandle_t const sensor)
Stops the sensor.
DW_API_PUBLIC dwStatus dwSAL_releaseSensor(dwSensorHandle_t const sensor)
Releases a sensor managed by the SAL module.
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Holds sets of parameters for sensor creation.
For more details see IMU Logger Sample