Arduino and Ultrasonic sensor based Obstacle Avoidance robot that transfers distance data as a ROS message using rosserial_python, while dodging obstacles online
Prerequisites:
- ROS
- Ultrasonic Sensor HC-SR04 Arduino library by Erick Simoes
- Arduino IDE
- rosserial library
Setup and Execution:
- Feed the attached Arduino Code to the board
- Ensure that the sensors have been hooked up to the correct pins and there is ample current and voltage supply
- To read data - Run $ roscore
- Run Python rosserial support - $ rosrun rosserial_python serial_node.py /dev/ttyUSB0 (Change USB port accordinly)
- Create a package inside your ROS Workspace and paste the "subscriber.py" file inside.
- Run - $ catkin_make
ALTERNATIVELY
- Run - $ rostopic echo chatter to directly listen to the messages being broadcasted to the topic chatter
Reference Links: