build details

Show: section status errors & todos local changes recent changes last change in-page changes feedback controls

Inertial Measurement Unit Driver

Modified 2020-03-04 by Timothy Scott

The following files are important for the IMU driver:

  • packages/sensor_suite/src/imu_node.py: This is the ROS node.
  • packages/sensor_suite/src/imu_calibration_node.py: This is used for calibration. See Unit E-5 - Calibration - Inertial Measurement Unit Calibration
  • packages/sensor_suite/include/sensor_suite/imu_driver/: Low-level driver Python package
  • packages/sensor_suite/config/imu_node/default.yaml: Default parameters for ROS node

Overview

Modified 2020-03-04 by Timothy Scott

At startup, the IMU node will attempt to communicate with the IMU on I2C bus 1. If it is unable to communicate with the IMU, it will gracefully shut down.

The ROS node reads from the IMU sensor at a regular frequency, as set by the parameter polling_hz. It then takes these raw values and adjusts them per the calibration, as described below.

These calibrated values are then published to the ROS topic /duckiebot name/imu_node/imu.

Parameters

Modified 2020-03-04 by Timothy Scott

  • polling_hz: This is the frequency at which to read data from the ToF sensors and publish it as a ROS topic. This is limited to roughly 150Hz, due to the speed of the I2C bus and the speed of the Python code in the driver. However, the default rate is set to 30Hz, to match the frequency of images from the camera and save CPU power.
  • ang_vel_offset: This is the offset applied to the angular velocity during calibration.
  • accel_offset: This is the offset applied to the linear acceleration during calibration.

Calibration

Modified 2020-03-04 by Timothy Scott

The calibration procedure runs as a ROS node. See Unit E-5 - Calibration - Inertial Measurement Unit Calibration for more information on how to launch it.

This node should not be run at the same time as the driver node. It will ask the user to leave the duckiebot perfectly still on a level surface, while it measures the angular velocity and linear acceleration. It will then calculate the offset in each axis from the ideal values (0 on every axis, except for linear acceleration in Z, which should be 1G).

The offset values are stored in the file /data/config/calibrations/sensor_suite/imu/duckiebot name.yaml. On startup, the IMU driver node will check this file for the parameters ang_vel_offset and accel_offset. If the file or these parameters are not found, the node will fall back on the values in default.yaml.