Rosserial is a protocol used to communicate between two or more ROS nodes through the serial port. Basically, there will be two systems working such as rosserial-server and rosserial-client. The rosserial-server will be on the system running ROS master and the client will be running in a microcontroller (In our case the master node will be running in jetson nano and the client will be running in Arduino UNO). Also, the master node will be publishing the ROS messages and the client (Arduino UNO) is subscribing ROS messages.
ROS serial clients also support some different kinds of microcontrollers too such as STM32, Teensy, OpenCR, and many more...
For installation use the comment below
sudo apt-get install ros-melodic-rosserial
If you are using any other version of ros replace the melodic with the respective version.
Now change the directory into the ros workspace src folder.
cd catkin_ws/src
In the previous document, we created a workspace named catkin_ws so that we could clone the GitHub repo of rosserial into this space.
git clone https://github.com/ros-drivers/rosserial.git
After cloning we need to build the package in that workspace, So we want to go back to the catkin_ws folder.
cd ~/catkin_ws
Then we now we can build the package to create build and devel folders.
catkin_make
ProgrammingNow go to Arduino IDE and search for rosserial in Manage Libraries.
You can search for rosserial in the search box.
After this, you can see a new Library in theExample.
From here go to the HelloWorld code in Rosserial Arduino Library
Now you want to connect your Arduino to your PC, For now, Im using Arduino Nano.
Then Hit upload
"Sometimes you will be facing an error like the below"
You can fix the error by installing the previous version of rosserial.
Now you can successfully compile the code without any error.
Comments
Please log in or sign up to comment.