DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

Reading IMU data from sensor

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.


The following code shows the general structure of a program reading data from an IMU sensor.

params.protocol = "imu.uart";
params.parameters = "device=/dev/<serial device>,baud=<baudrate>";
dwSensorHandle_t imuSensor;
dwSAL_createSensor(&imuSensor, params, ...);
dwIMUFrame frame;
dwSensorIMU_readFrame(&frame, 50000, imuSensor);

For more details see IMU Logger Sample