Ask Your Question

How to control a real robot and simulate it in Gazebo at the same time ?

asked 2019-09-13 03:16:31 -0500

Lycanthropy gravatar image

We created a hardware interface and controllers that we will be using for a real robot. The problem is, whenever we load Gazebo and our own custom controller manager, Gazebo unsubscribes from the 'joint_state_publisher' topic and so we only have our own custom controller manager subscribed to it so we can't monitor the activity on Gazebo. Is there a way to operate both simultaneously ? In other words, we need to simulate the activity of a real robot in Gazebo. Here's the rqt graph:

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-09-13 05:04:20 -0500

There is a theoretical problem with what you're trying to achieve. Gazebo is a simulation and is used to replace a real robot in your robotic system. If you want to control your real robot and a gazebo simulated robot you are in effect controlling two different robots not one. You should be able to set this up using namespaces, but I'm not sure this is what you're trying to do.

Why do you want to run Gazebo alongside the real robot?

edit flag offensive delete link more


E.g. if we attain telemetry and odometry information from our real robot, and we're sitting in another room, and want to monitor it, kind of like a simulated monitoring program, we'd like to monitor the movement in Gazebo.

Lycanthropy gravatar image Lycanthropy  ( 2019-09-13 05:39:44 -0500 )edit

Why not use RViz instead of Gazebo?

jayess gravatar image jayess  ( 2019-09-13 05:58:52 -0500 )edit

I agree, this is exactly what RVIZ is designed for. Gazebo is not designed to visualise anything apart from it's own internal simulation.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-09-13 06:07:07 -0500 )edit

@Lycanthropy: to add to what the previous posters wrote: consider Gazebo as a stand-in of your robot. It's not a visualisation tool.

See #q316396 for a related Q&A.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-13 06:25:49 -0500 )edit

Thank you so much for your responses. I figured it out. Putting it as the answer. Upvoting for help.

Lycanthropy gravatar image Lycanthropy  ( 2019-09-13 06:27:43 -0500 )edit

answered 2019-09-13 06:33:09 -0500

Lycanthropy gravatar image

updated 2019-09-13 06:34:04 -0500

Figured out the solution. I just take the messages published to the joint_state topic, manipulate them into a gazebo_msgs/ModelState message and publish them to the /gazebo/set_model_state topic. Although the exact real life scenario and the gazebo simulation is different for the similar commands, it gives me an appropriate scenario to compare what should be happening (in gazebo) vs what is really happening (the real life robot). E.g. if I implement an odometry correction algorithm, if it is properly corrected in gazebo and not in the real robot, that would mean the real robot might have a mechanical or environment problem (keeping in consideration that the gazebo environment and the robot model is configured according to the desired situation). Refer to 'Gazebo subscribed topics' in this link for further help:

edit flag offensive delete link more


Hi, I am in a similar situation. Can you elaborate a little bit more on how you did: "manipulate them into a gazebo_msgs/ModelState message"? And also just curious: Was syncing gazebo to a real robot useful?

jaiswalharsh gravatar image jaiswalharsh  ( 2020-08-07 03:18:59 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-09-13 03:06:51 -0500

Seen: 787 times

Last updated: Sep 13 '19