build details

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

Line Following Sensor Driver

Modified 2020-03-04 by Timothy Scott

The following files are important for the line follower driver:

  • packages/sensor_suite/src/line_following_node.py: This is the ROS node.
  • packages/sensor_suite/src/line_following_calibration_node.py: This is used for calibration. See Unit E-3 - Calibration - Line Follower Sensors
  • packages/sensor_suite/include/sensor_suite/line_following_sensor/: Low-level driver Python package
  • packages/sensor_suite/config/line_following_node/default.yaml: Default parameters for ROS node

Overview

Modified 2020-03-04 by Timothy Scott

At startup, the line follower node will check the ADC diagnostic register to determine whether the line following sensors are present. If there is any error on the ADC, the node will gracefully shut down.

The ROS node reads from the line following 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/line_following_node/line_follower.

Parameters

Modified 2020-03-04 by Timothy Scott

  • polling_hz: This is the frequency at which to read data from the line following sensors and publish it as a ROS topic. This value has been tested and verified to work up to 100Hz. However, the theoretical upper limit is much higher, but depends upon the data rates of other sensors.
  • *.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. It should not be run at the same time as the driver node. It will ask the user to place the Duckiebot over different colors on a city tile, and take a series of measurements. Then, it calculates a scale and offset to apply to each sensor individually, using the following formula:

reported_value = scale * measured_value + offset

This scale and offset is determined based on an ideal brightness value for the colors in the city:

Ideal measurements for line follower sensors
Yellow 0.2
White 0.6
Black 1.0

The scale and offset values are stored in the file /data/config/calibrations/sensor_suite/line_follower/duckiebot name.yaml. On startup, the line following driver node will check this file for the parameters *.m and *.b (One of each for each of the four sensors).