rviz not keeping up with Gazebo

asked 2020-11-02 15:00:44 -0500

updated 2020-11-05 12:11:11 -0500

I have a Gazebo world with a Husky bot and a sqaure obstacle infront of the bot. I have also launched the rviz. I have added the Robotmodel plugin. I have written a node that makes the bot move towards the obstacle.

As soon as I launch the node, I can see the bot moving towards the obstacle in Gazebo as well as in Rviz.

However, when I click on the 'Pause' button in Gazebo and manually move the bot to a different place in the Gazebo world, the same doesn't get reflected in Rviz.

Why is that? What am I missing?

edit retag flag offensive close merge delete



Isn't this just caused by the fact that while Gazebo is paused, none of the plugins responsible for publishing model state to ROS are active? How would RViz "know" objects should be somewhere they're not if it doesn't get notified?

RViz knows nothing about Gazebo, and vice-versa. They are not linked, nor do they share any state by default.

Teleporting objects in Gazebo will not be reflected in RViz unless something is telling RViz "what just happened".

gvdhoorn gravatar image gvdhoorn  ( 2020-11-03 03:35:20 -0500 )edit

It makes sense why the new position of the bot is not reflected in Rviz when Gazebo is paused.

However, consider this.

Let's say that we launch Gazebo with a bot. We also launch Rviz and insert the RobotModel plugin and set the 'Fixed Frame' as '/odom'.

We start our simulation and the bot starts moving in the Gazebo as well as Rviz. After let's say 5 seconds, we pause our Gazebo simulation. The bot stops moving in Gazebo as well as Rviz. Now, in the Gazebo world, we teleport the bot back to its initial position and resume the Gazebo simulation.

Why doesn't the bot teleport to its initial position in Rviz?

skpro19 gravatar image skpro19  ( 2020-11-05 08:30:33 -0500 )edit

You'd have to check how the gazebo_ros_pkgs deal with teleported objects. It could be that the odom topic does not "reset", which is very much possible, as odom is not an absolute position in some world-referenced coordinate system, but a cumulative guestimate based on how much "the wheels have turned".

Tele-porting a mobile robot will not make it undo all that motion, it will just mean the distance (compared to the starting point in a world-referenced coordinate system) will now be less than what the messages on the odom topic report.

But while tele-porting, the robot will not "un-move" so to say. Compare to when you lift a wheeled robot, and without rotating its wheels, transport it to somewhere else. It's internal odometer will most likely be oblivious to how many metres you've moved the robot, and will just resume counting the second you put the robot ...(more)

gvdhoorn gravatar image gvdhoorn  ( 2020-11-05 11:42:19 -0500 )edit

Okay. Thanks for the detailed explanation. Really appreciate it. That helped me build a lot more intuition about the 'odom' frame.

I would look into the 'truth' and update it here itself for future reference. :-)

skpro19 gravatar image skpro19  ( 2020-11-05 12:09:54 -0500 )edit

Any update?

germonio gravatar image germonio  ( 2023-06-21 17:30:21 -0500 )edit