Friday, July 27, 2018

Hello World ROS (Robotic Operating System)



Introduction:
Everybody can do programming in ROS, as much as they are interested to explore the importance of this software to simplify application of Robotics. These blog will literally  explain the application of ROS hence if the reader already understand this simple tutorial. I would suggest to take the next steps/ experiments here .

Requirements:
Software: Ubunto 16.04 ,ROS (commands: roscore, rosrun,rostopicdriver: rosserial_arduino)
Hardware: Arduino UNO/Mega 2560, RPi or Laptop/Desktop

Objectives:
To learn the first stage of ROS through learning by doing
To use ROS to communicate an Arduino to PC
To test a simple publishing and displaying of data that uses ROS environment

Methodology:

Simple hardware setup















Install ROS library for Arduino either by:
robook# sudo  apt-get install ros-[PACKAGE-RELEASE-rosserial-arduino
robook# sudo  apt-get install ros-[PACKAGE-RELEASE-rosserial

Or  install if from  the source
Download ros library from its repository in the source folder of catkin workspace directory
robook# cd catkin/src/
robook# gitclone git https://github.com/ros-drivers/rosserial
robook # cd  rosserial/arduino_rosserial/roslib    PATH/Arduino/libraries
Then rename the original "ros_lib" to the ros_lib.bak
robook# mv   rosserial/arduino_rosserial/roslib rosserial/arduino_rosserial/roslib.bak


















Select  ros_lib from rosserial driver
robook# cd rosserial
Copy "ros_lib" in the Arduino library folder
robook#  cp  ros_lib  PATH/arduino/library
















Check  "ros_lib" in  Arduino IDE "Built-in/Examples"





















Cut & paste the code modify it according to your own test and checking


Open the first  terminal  to run ros core environment "roscore"
















Open the second terminal  to run the serial interface betwen ROS system and Arduino link its port
robook# rosrun rosserial_pythoon serial_node.py /dev/ttyACMO















Open the third terminal to display messages in the "chatter" topic
robook#  rostopic echo chatter















Remarks:
Trouble: "Unable to communicate with master with roscore running"
Shooting:  Check the ROS_MASTER_URI    or ROS_HOSTNAME
                  in  /etc/hosts  or in ./bashrc

Trouble: "No rosserial_arduino
Shooting:    Install or check the new files in repostitories or github
sudo apt-get install ros-[package version]-rosserial-arduino
sudo apt-get install ros-[package version]-rosserial
Summary:
We wanted to actualize first a simple program to run ROS environment , install rosserial_arduino  , a publisher for a data message and echoing/displaying ROS topic.

Conclusion:
First stage of learning by doing ROS.