Loading [MathJax]/extensions/tex2jax.js
  • <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>

  • DriveWorks SDK Reference
    5.10.90 Release
    For Test and Development only

    All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
    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.

    Example

    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, ...);
    dwSensor_start(imuSensor);
    while(loop)
    {
    dwIMUFrame frame;
    dwSensorIMU_readFrame(&frame, 50000, imuSensor);
    ...
    }
    dwSensor_stop(imuSensor);
    dwSAL_releaseSensor(&imuSensor);
    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.
    This structure contains one frame of data from a IMU sensor.
    Definition: IMU.h:292
    const char8_t * parameters
    Array of additional parameters provided to sensor creation.
    Definition: Sensors.h:106
    const char8_t * protocol
    Name of the protocol.
    Definition: Sensors.h:99
    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.
    Definition: Sensors.h:86
    Holds sets of parameters for sensor creation.
    Definition: Sensors.h:95

    For more details see IMU Logger Sample

    人人超碰97caoporen国产