Template for a ROS Subscriber Using rosserial on Arduino

A few weeks ago I started writing a series of tutorials that ease the work of beginners in ROS. The first tutorial was about a template for a publisher node, the second tutorial was about a template for a subscriber node in ROS, the third tutorial was a simple ROS subscriber and publisher in Python, and the fourth template is about a publisher using rosserial.

Today, I continue the series of tutorials with a template for a ROS subscriber using rosserial on the Arduino board. In addition, I’ll write a subscriber node based on the below template.

Below you will find the template for a ROS subscriber using rosserial on the Arduino board. To write your own subscriber using rosserial on Arduino, copy the template into Arduino IDE, delete the information that you don’t need and replace the text in capital letters.

I used the above template to write a ROS node that will subscribe to a node that generates random numbers.

How to run the node
Step 1: Open a new Terminal, type roscore and press the Enter key;
Step 2: Open a new Terminal and run the node to publish the messages;
Step 3: Open another Terminal and start the subscriber node by typing the following command:

 

Share:

Related Posts

Don't Miss Out!

Get the latest news, tutorials, reviews and more direct to your inbox when you subscribe!