ROSbot2 Pro - Gazebo model sometimes not responding to cmd_vel

Hi,

We are using gazebo 11 and launching using
ros2 launch rosbot_description rosbot_sim.launch.py

We run teleop_keyboard to control the robot in the simulator, but sometimes the robot does not respond to the commands.
I can see that the cmd_vel topic has messages published to it by:
ros2 topic echo /cmd_vel

The problem is that the robot model in gazebo is not responding.
If we shutdown gazebo (by ctrl-c in the launching terminal) and restart - sometimes the problem is fixed sometimes it is not. The behaviour is strange.
Please also note that we use ROS_LOCALHOST_ONLY=1

Our suspicion is that the problem relates to how gazebo and the robot model is launched, but we do not know where to begin to debug this issue. Please can you provide any clues for us? Thank you for your help.

Kind regards,
Jon.

Hi Jon,

I will investigate your problem soon. Seems like there might be a problem with gazebo_ros_pkgs plugins. Probably the node that is translating ROS messages to Gazebo messages does not have communication on one the ends.

Best regards,
Krzysztof Wojciechowski.

Hi Jon,

checked if I can find any solution to your problem. For ROS Foxy I encountered exactly the same issues as you described after adding ROS_LOCALHOST_ONLY=1. Actually the issue didn’t appear every single time I tried it. I ran it with docker so I was sort of simulating isolated network with n devices in it. If I ran a single docker with simulation every time I checked /cmd_vel existed and Gazebo was subscribing to it. If I added any additional docker (not necessary with Gazebo, just andy ROS docker) to the network /cmd_vel was in roughly 90% of cases not available.

Then I checked if anything changes in Galactic. And so far the issue does not appear in this distro. I checked Galactic on a simulation of our different robot since ROSbot doesn’t support Galactic yet. The robot I checked on Galactic uses the same Gazebo plugin as Fox’s URDF for ROSbot. My guess is that the issue is with the Gazebo plugin itself.

I haven’t found anyone having a similar problem so far. I would suggest opening issue on gazebo_ros_pkgs repo. They will know best how it works on Foxy.

Best regards,
Krzysztof Wojciechowski.

Hi Krzysztof,
Thank you for your details. I am pleased that you have been able to replicate the problem. I may also try Galactic as a test, however, we have to continue with Foxy on all our PC’s for the time being. I will try to raise issue on the gazebo ros packages repo.
In the meantime, if you have any ideas for a simple workaround please let me know.
Thank you and kind regards,
Jon.

The simplest walkaround is to set a different ROS_DOMAIN_ID on all PCs. I’m sure this will work.

Best regards,
Krzysztof Wojciechowski.

Hi Krzysztof,

I tried setting ROS_DOMAIN_ID on a PC (no other PC’s on the network were running ROS). Initially, it worked, but then I saw some failures of ROSbot does not move in gazebo. I also tried setting ROS_LOCALHOST_ONLY=0, and had similar result.
Therefore, it seems the workaround to set ROS_DOMAIN_ID does not work in this case.
We have to look deeper i.e. gazebo ros packages as you mentioned previously.

Kind regards,
Jon.

Hi Jon,

that is odd. I remember people in our office working like this. I checked it now and the problem is present on my side as well. We need a bit more time to figure out how to solve it.

Best regards,
Krzysztof Wojciechowski.

Hi,

Did this issue get resolved? We still see the problem. Thank you.

Kind regards,
Jon.

Hi Jon

I am terribly sorry for such late response, but this issue required much more effort than one might expect.
I hope the issue is resolved. We created a new branch with rewritten URDF model and updated launch files.
It is now on galactic branch on our repository:

It should be tested and confirmed to be 100% working soon. So far, it was tested on a ROS Galactic with Cyclon DDS with ROS_LOCALHOST_ONLY set to true. Robot was responding to the /cmd_vel topic, and outside given machine topics were invisible.

I really hope it solved your problem.

Best regards,
Krzysztof Wojciechowski.

Hi,

Thank you for your reply. We really appreciate your help on this issue. It seems you have a fix and I would like to try it as soon as it is available for Foxy branch.

Kind regards,
Jon.