Skip to main content

Ultrasonic

The Ultrasonic node reads an HC-SR04-style sonar sensor and publishes distance as a standard ROS2 Range message.

Range: ~2 cm to 4 m

Configuration​

ultrasonic:
enabled: true
sensors: ["front"]
front:
ping: 8
echo: 9
frame_id: "front_link"

Parameters​

ParameterDescription
pingDIO channel for the trigger/ping pin (range 0 – 21)
echoDIO channel for the echo pin (range 0 – 21)
frame_idTF frame ID included in the message header

Topics​

Published​

TopicTypeDescriptionRate
/<name>/rangesensor_msgs/RangeDistance in metres. Out-of-range readings published as inf.20 Hz

Service​

Service name: /<name>/ultrasonic_cmd
Type: studica_control/SetData

CommandDescription
get_distanceDistance in millimetres
get_distance_inchesDistance in inches
get_distance_millimetersDistance in millimetres