Tag Archives: sensor_msg

Ultrasonic Sensor HC-SR04 as a ROS Range publisher

I’ve taken a HC-SR04 like shown below and connected it to the CubieTruck as a rosserial publisher.



Instead a of a simple  std_msgs::String str_msg;  I’ve implemented a  sensor_msgs::Range range_msg; which after starting the arduino in ros with rosrun rosserial_python serial_node.py /dev/ttyACM0 shows up in  rostopic echo /ultrasound like this:

So with that, its possible to visualize everything using rqt_plot:


which is pretty nice for my first arduino micro ros project and less than an two hours of work 🙂

For further information see here