ROS Multiple Machines - penn-figueroa-lab/lab_wiki GitHub Wiki

Setup:

  1. Connect the PCs via Ethernet/Switch and set the following IPs Manually on every system with Netmask 255.255.255.0
  • ROS Master 10.42.0.1
  • ROS Client 1 10.42.0.2
  • ROS Client 2 10.42.0.3
  1. To bashrc add: gedit ~/.bashrc
  • ROS Master: export ROS_MASTER_URI=http://10.42.0.1:11311/ export ROS_IP=10.42.0.1 export ROS_HOSTNAME=ros_master
  • ROS Client: export ROS_MASTER_URI=http://10.42.0.1:11311/ export ROS_IP=10.42.0.2 export ROS_HOSTNAME=ros_master Ensure that only the ROS_IP corresponds to the client, also bashrc must be edited for every PC USER.
  1. For all PCs, to /etc/hosts add sudo gedit /etc/hosts: 10.42.0.1 ros_master

Test

  1. On ROS Master PC: ping 10.42.0.2 or other client IP set manually, to check if packets are being received from the client.
  2. On ROS Client PC: ping 10.42.0.1 or other client IP set manually, to check if packets are being received from the master/client.
  3. On ROS Master PC run roscore
  4. On ROS Master PC run rosrun rospy_tutorials talker.py and on ROS Client runrosrun rospy_tutorials listener.py, then switch the commands to check bi-directional communication
  5. To check image or pointcloud transmission, connect camera to either PC then:
  • On Camera PC run roslaunch realsense2_camera rs_camera.launch
  • On network PC run rviz add image or pointcloud topic to visualize or rostopic echo corresponding topic

Debug

If you can ping between the machines but cannot run roslaunch with this setup, trying removing export ROS_HOSTNAME=ros_master