ROS system is designed mainly for distributive computing. We can write and
run the ROS nodes on multiple machines and communicate each node to a single master. For communicating between two devices using ROS, we should follow
the following rules:
- Only single ROS master should run; we can decide which machine should run the master
- All machines should be configured to use the same master URI through
ROS_MASTER_URI - Bi-directional connectivity should be ensured between all the pairs of machines
- Each machine should have a name that can be identified by the
other machines
In this section, we will see how to run the ROS master in Odroid and stream the camera images to a PC. First, we will look at the setup required for the distributing computing between Odroid and PC.
Connect Odroid to the PC directly using the LAN cable and create a Ethernet hotspot, as we mentioned in the previous chapter. Find the IPs of Odroid and the PC and set the following lines of command in their .bashrc files. We are going to run the Odroid board as the ROS master and the PC as a computing node. Following is a sample configuration of Odroid and PC:
- Configuring Odroid as ROS master:
#Setting MY_IP as Odroid IP export MY_IP=10.42.0.94 #Setting ROS_IP variable as MY_IP export ROS_IP=$MY_IP #Setting ROS_MASTER_URI as Odroid IP export ROS_MASTER_URI="http://10.42.0.94:11311"
- Configuring PC as ROS computing node:
#Setting MY_IP as P.C IP export MY_IP=10.42.0.1 #Setting ROS_IP variable as MY_IP export ROS_IP=$MY_IP #Setting ROS_MASTER_URI as Odroid IP export ROS_MASTER_URI="http://10.42.0.94:11311"
Install a usb_cam ROS package in Odroid, connect a USB web cam to it, and start running usb_cam on it using the following command:
$ roslaunch usb_cam usb_cam-test.launch
In the PC terminal, we can access the camera topics and display the image data in RViz.
Following are the camera topics in the PC that are running on Odroid:
$ rostopic list
We can view the image from the Odroid cam on the PC using RViz or the
image_view tool. Following is an image of Odroid camera stream in RViz: