The Sensor library supports the following functions for sensor units that you configure in the sensor configuration file:
To query information from a sensor, call the function that corresponds to the property that you want to query. For example:
... int err; double position[3]; double yaw, pitch, roll; sensor_unit_t unit = SENSOR_UNIT_NONE; sensor_handle_t handle = NULL; ... err = sensor_open(unit, SENSOR_ACCESSMODE_DATA, &handle); ... err = sensor_get_location_property( handle, SENSOR_LOCATION_POSITION_X, &position[0], SENSOR_LOCATION_POSITION_Y, &position[1], SENSOR_LOCATION_POSITION_Z, &position[2], SENSOR_LOCATION_YAW, &yaw, SENSOR_LOCATION_PITCH, &pitch, SENSOR_LOCATION_ROLL, &roll); ... printf("Sensor position: (%2.1f, %2.1f, %2.1f), yaw: %2.1f, pitch %2.1f, roll %2.1f\n", position[0], position[1], position[2], yaw, pitch, roll); ...