build details

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

Time of Flight Distance Sensor Driver

Modified 2020-03-04 by Timothy Scott

The following files are important for the ToF driver:

  • packages/sensor_suite/src/tof_node.py: This is the ROS node.
  • packages/sensor_suite/src/tof_calibration_node.py: This is used for calibration. See Unit E-4 - Calibration - Time-of-Flight Distance Sensors
  • packages/sensor_suite/include/sensor_suite/tof_driver/: Low-level driver Python package
  • packages/sensor_suite/config/tof_node/default.yaml: Default parameters for ROS node

Overview

Modified 2020-03-04 by Timothy Scott

At startup, the ToF node will attempt to communicate with ToF sensors on all 8 ports of the front bumper. If it is unable to communicate with any, it will gracefully shut down.

The ROS node reads from the ToF sensors 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/tof_node/tof_N (one topic for each sensor).

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. The sensors are limited to 10 Hz.
  • m: This is the individual scaling factor applied to each sensor, as per the equation below.
  • b: This is the offset applied to each sensor, as per the equation below.

Calibration

Modified 2020-03-04 by Timothy Scott

The calibration procedure runs as a ROS node. See Unit E-4 - Calibration - Time-of-Flight Distance Sensors 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 place the Duckiebot in front of some object, and to measure the distance to that object. For each sensor, it will do this twice, at two different distances. Then, it will calculate a scale and offset to apply to each sensor, according to the following formula:

reported_value = scale * measured_value + offset

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