Robotics StackExchange | Archived questions

rviz not keeping up with Gazebo

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?

Asked by skpro19 on 2020-11-02 16:00:44 UTC

Comments

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".

Asked by gvdhoorn on 2020-11-03 04:35:20 UTC

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?

Asked by skpro19 on 2020-11-05 09:30:33 UTC

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 down.

Somewhat similar to a kidnapped robot problem.

But this is all just a guess. The code has the truth.

Asked by gvdhoorn on 2020-11-05 12:42:19 UTC

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. :-)

Asked by skpro19 on 2020-11-05 13:09:54 UTC

Any update?

Asked by germonio on 2023-06-21 17:30:21 UTC

Answers