[Solved] Can't View Topics Remotely

We have a ROSbot 2R using the RPi Humble image. When I make an ssh connection to the 2R, I can list and echo topics, list messages, use the joystick and mapping examples, etc., but from a remote Jammy/Humble laptop on the same LAN, I can’t.

We also have an iRobot Create3, and I can remotely see all its published topics, subscribe to them, etc., from the same laptop. In fact, if I power-on both robots and run the teleop_twist_keyboard example in an ssh session on the 2R, both the 2R and the Create3 move.

  • The laptop and 2R are using rmw_fastrtps_cpp
  • The ROS2 daemon is running on the 2R
  • Also tried a vm and an RPi running Humble

How can I configure the 2R so I can communicate without an ssh session like I can with the Create3? I suspect I’m missing something really fundamental, but I have no idea what!

Any help appreciated.

Steve

Make sure you don’t have ROS_DOMAIN_ID or ROS_LOCALHOST_ONLY environment variables set. The micro-ros-agent won’t work with those. If you are running multiple Rosbots or ros2 sessions on the network, use the ufw firewall to separate your instances from each other.

1 Like

@ralphstirling - Thanks for suggestions! So far, no joy.

• Verified both the laptop and 2R have the same domain id.
	○ Used printenv ROS_DOMAIN_ID
	○ 2R returned nothing, which should be the default of 0
	○ Laptop returned 0
	○ Set explicitly to 0 on the 2R, still can't interact remotely
• Verified ROS_LOCALHOST_ONLY env variable was set to 0 on both machines
	○ Neither was set, so both should have been 0. Explicitly set to 0 in current session.
	○ Still no communication
• Checked that multicast was working:
	○ Ran "ros2 multicast send" and "ros2 multicast receive" on both laptop and 2R in both directions, which succeeds.
• Completely disabled the firewall on the 2R
• Had the Create3 powered off for all the tests

I still feel like I’m missing something fundamental. For example, I can run the Husarion mapping demo, which requires the gamepad dongle to be plugged into the laptop. And communicating with the Create3 is seamless.

Also found some posts like this, but no solution that works.

Frustrating!

Steve

The ROS_DOMAIN_ID must be 0 or not exported at all. The micro-ros-agent does not recognize domain id’s, and so your PC won’t be able to subscribe to any topics. I just finished teaching a ten-week robotics course with ROS2 and the Rosbot2’s, and I did not have that truly figured out until about week 8 or 9. An unbelievable number of hours wasted trying to get communication happening, but without cross-talk between different robots and users. Much of the info out on the web and forums by the experts is wrong in regards to this. ROS_DOMAIN_ID works well with ROS2, but not micro-ros. Micro-ros also does not work with cyclonedds, which is touted as an improvement on many sites. The current Husarion CORE2 firmware is based on micro-ros, so you cannot use either domain id or cyclonedds when you are using Rosbots. The only way to prevent cross-talk between separate sessions is to set up the ufw firewall on each PC and each Rosbot. It is possible that husarnet would also solve the problem, but I never got it to work. It is based on ipv6, and I don’t think our networking infrastructure handles ipv6 well. Another thing to consider is that you really want your robot lab walled off from the rest of your network, as your ROS2 sessions will flood your network with multicast messages and make network admins very unhappy. I used a cheap Walmart Linksys wifi router for my lab, put static IP addresses on all the rosbots and PC’s, and set up the ufw firewalls. It limited how far outside the lab the rosbots could roam, but was the only way to have enough control over the network to set everything up. The ufw settings I used are:

sudo ufw reset
sudo ufw default deny
sudo ufw default allow outgoing
sudo ufw allow from ip_address_of_other_end_of_link
sudo ufw allow ssh

That is what finally did the trick for us.

– Ralph

1 Like

@ralphstirling - I really appreciate the insight, and I feel your pain on the ROSbot/ROS2 communication.

I tried the firewall settings, and permutations thereof, with no success. With the rules in place:

  • I could ssh to the 2R and successfully run “docker compose up” in the rosbot-gamepad folder
  • Gamepad control worked as usual with the dongle plugged into the 2R
  • I could not list the topics via ssh or in a terminal on the remote computer. Didn’t expect that.

After disabling the firewall completely on the 2R I could again list topics via ssh but still can’t list remotely or subscribe to a topic.

Also re-verified that…

  • ROS_DOMAIN_ID was not set at all on either the 2R or remote machine
  • ROS_LOCALHOST_ONLY is set to 0 on both
  • Multicast is working in both directions

I’m still bothered that I can run the mapping demo with the gamepad dongle plugged into the laptop. I haven’t tried, for example, ./sync_with_rosbot.sh <ROSbot_ip> from that demo which contains:

sshpass -p “husarion” rsync -vRr ./ husarion@$1:/home/husarion/${PWD##*/}

while inotifywait -r -e modify,create,delete,move ./ ; do
sshpass -p “husarion” rsync -vRr ./ husarion@$1:/home/husarion/${PWD##*/}
done

I don’t have a Linux background, so I have to investigate almost everything. It’s interesting, but it slows the progress.

Steve

I never found the docker approach very satisfactory. It was one more layer of obfuscation for me and my students to deal with, and added huge bloat to the sd cards. I just studied the docker files to see what packages needed to be installed and how to run them. That sync_with_rosbot script is just for copying files back and forth. I just used scp when I needed to do that. I never bothered with their script.

I found it helpful in testing topic broadcasting to just use “ros2 run demo_nodes_cpp talker” rather than the full blown rosbot stuff. If you see the /chatter topic, then you have your communication going.

I would check your environment variables carefully (“env” command) and be sure there aren’t any linguring ROS or RMW variables lurking. I got tripped up more than once by stuff I forgot to remove from my .bashrc file on one or another computer. Also, do you have any fastrtps.xml file? That can have configuration stuff that might mess you up.

In my list of firewall setup instructions, I forgot the last step (was going by memory). The complete list is:

sudo ufw reset
sudo ufw default deny
sudo ufw default allow outgoing
sudo ufw allow from ip_address_of_other_end
sudo ufw allow ssh
sudo ufw enable

You can check status with
sudo ufw status verbose

The same steps need to be done on both
the pc and the rosbot, with appropriate ip addresses.

Fortunately I’ve been using Unix/Linux for about 40 years, but ros2 was still very slow going. I don’t have a rosbot with me at the moment (I’m out of town), so can’t verify anything.

– Ralph

@Steve_Willoughby

Do the same problems occur if you connect between ROSbot and laptop via Ethernet cable?

Best regards
Jan Brzyk

Hi @JanBrzyk,

I tried this:

  • Used an old usb hub I had that has an ethernet network connector built in and connected the 2R to an ethernet port on a wifi router.
  • Connected the Linux laptop to a different ethernet port on the same router
  • Set the laptop’s wired connection’s ip address to 192.168.77.27
  • Used ssh to connect from the laptop to the 2R at 192.168.77.2
  • Ran ros2 topic list over the ssh connection to the 2R and received the full list
  • Ran the same command in a different terminal on the laptop and still only received the two default topics

Does this accomplish what you had in mind?

Thanks,
Steve

Hi,

I meant a direct Ethernet cable connection between the ROSbot and the PC just to be sure. Let me know.

Best regards
Jan Brzyk

I am fighting through this right now.
If I build rosbot from scratch I can see it on other computers, however docker will not let it be seen on other computers.
Unfortunately I am having an IMU error on the build from source… so I can’t get the /cmd_vel to show up.
I would rather use docker if possible.

Also from my understanding of ROS 2 in general, any use of FAST RTPS will disable the normal DDS. This may be why your laptops are not getting the topics. Hypothetically, the robot could be configured to use the fast rtps but that is another thing that can go wrong.

1 Like

To whom it may concern,

I’m having the same issue as Brad. I cannot view the topics of the Rosbot 2R on my docker. I used Wireshark and I see that the communication is happening between my computer and the robot. Like everyone else in this thread, I am also able to run the multicast send and receive from both the Husarion Rosbot (by ssh into it) and my docker. Nonetheless, I’m unable to view the topics.

I tried following all of the steps provided throughout this thread (the firewall steps, the domain and localhost env, etc.), but nothing worked. Everything worked a few days ago and we didn’t change anything so I’m very confused on how to get it up and running again.

I would greatly appreciate a quick response to this.

Best,
Elianne

Hi @Elianne_Sacher and @Brad_Towle, I want to let you know that we have just released a new version of the Husarion OS where the default setup allows the ROS 2 topic discovery over the local network.

Also a dynamic ROS_DOMAIN_ID variable setup works with Micro-ROS based firmware for ROSbot!

To update the OS image for ROSbot, follow these steps:

  1. Download the Husarion OS image for your Husarion robot SBC: Installing Husarion OS | Husarion
  2. Install that image on the robot
  3. During the initial setup run the script:
sudo setup_robot_configuration rosbot_2r # or rosbot_xl
  1. Follow the steps from the Quick Start Guide for ROSbot 2R or ROSbot XL

How does one connect the robot to the PC?
can I connect via usb? This is flashing the entire OS (Ubuntu) right?
I do now know where the micro Sd card is on the robot.

@Brad_Towle

yes it resets the whole system to the factory settings with new operating system.

The microSD slot is on the right side of the ROSbot 2R.

Best regards
Jan Brzyk

@JanBrzyk

It’s still not working and I’ve re-downloaded the new images to a completely new SD card and re-installed everything. What do I do next?

@Brad_Towle were you able to figure it out?

Never mind. It works now with the new images. Thank you!

@Elianne_Sacher

please let @Brad_Towle and other Husarion Community members know what was your issue :smiley:

Best regards
Jan Brzyk

Okay, I found the sd card and flashed it.
Then re-initialized docker.
I can get rosbot and microros to run and see the topics on the remote computer.
However, now RPLidar and Astra will not work.
Also I do not have ros2 introspection on the robot: (Edit: I fixed this by changing the owner of the .ros file to husarion)

husarion@husarion:~$ ros2 topic list
failed to initialize logging: Failed to create log directory: /home/husarion/.ros/log, at ./src/rcl_logging_spdlog.cpp:90
husarion@husarion:~$

When I try to run rplidar container alone I get this:

rplidar | [ERROR] [sllidar_node-1]: process has died [pid 68, exit code 255, cmd ‘/ros2_ws/install/sllidar_ros2/lib/sllidar_ros2/sllidar_node --ros-args -r __node:=sllidar_node --params-file /tmp/launch_params_ij_r1m3k’].
rosbot | [ros2_control_node-1] [INFO] [1690988337.302640147] [controller_manager]: Configuring controller ‘rosbot_base_controller’

What is the seriel port for rosbot 2r rplidar?

@Brad_Towle

How do you boot the system?
Are you using the utility script ros_driver_start.sh or docker compose up?

Best regards
Jan Brzyk

I actually tried both.
ros_driver_start only activates microros and rosbot. (Which work fine)
I was using docker to boot up all three. Sometimes I will get errors, sometimes docker will appear as though it is working but not.