Tips in Setting ROS Networking

chantana chantrapornchai
2 min readAug 19, 2021

I’d like to make a note for setting ROS laptop to communicate with any ROS node master. My case is on Raspberry pi. A good starting tutorial is http://wiki.ros.org/ROS/NetworkSetup. Also, when I setup I found many problems. I googled many places for the solution. It tooks me around 7–8 hrs to finally making this right.

So I write down the summary setup note here before I forget them.

  1. Both must be on the same network SSID. You can ping from laptop to raspi and vice versa.
  2. Ping is not the only requirement. I am not an expert on networking. I learned from many places that ping and ssh is not the same protocol. You can ping between them is a good start.
  3. Install openssh-server on both of them since both communicate using tcp.
  4. set up ROS_MASTER_URI, ROS_IP, ROS_HOSTNAME (not required) for both laptop and raspi. My case I set ROS_MASTER as the ip address of raspi. Eg. for Raspi (as a master), in .bashrc
  
$ export ROS_IP=ip_of_this_machine
$ export ROS_MASTER_URI=http://ip_of_this_machine:11311

For laptop,

$ export ROS_IP=ip_of_this_machine
$ export ROS_MASTER_URI=http://ip_of_master:11311

5. ROS Node uses ports 11311. The port number must be opened (ufw allow 11311) for both laptop and raspi. The master and the laptop communicate using the port.

6. Don’t open the firewall (ufw disable). I first thought that we should open the firewall. Somehow, this causes the laptop cannot see the ROS MASTER data sent through the port. Eg. you get empty message/data when you try to echo topic message from laptop. (https://answers.ros.org/question/255119/ros-running-on-2-machines-one-master-subscriber-not-getting-any-message/)

7. Don’t run ROS core on laptop since you only connect to ROS Master node and get the message data.

8. Install ROS on laptop data and required other tools (eg. desktop version). It is my recommend that you use the same ROS version on both. (This is not sure, since some blog says you can communicate different ROS version. For my case, my rasp is Noetic and first my laptop is melodic. I cannot get it work (may be because the firewall). I then reinstall my laptop with new Ubuntu and Noetic. However, the blog didn’t use the same ROS version as mine.)

9. Don’t forget to do export DISPLAY:= 0.0 on the laptop. Normally you will display graphical interface on laptop from the ROS master. Eg. rqt_view, rviz, rqt_plot, etc. (on laptop, graphical interface like Qt5, xcb, etc. must be installed too.) (https://community.husarion.com/t/ros-tutorial-ros-introduction-starting-camera-node-using-remote-desktop-client/661/8)

10. Optional things are passwordless setup for ssh for both. Set up hostname in /etc/hosts for both machine.

--

--

chantana chantrapornchai

I love many things about computer system such as system setup, big data & cloud tools, deep learning training, programming in many languages.