Gazebo | Ignition | Community
Ask Your Question

Moving a ROS robot in Gazebo, are plugins necessary or can I use topic/node method instead?

asked 2015-05-06 04:34:25 -0600

Antares gravatar image

Hi all, I'm really newbye in Gazebo and I tried in last days to read everything I could find to use Gazebo for my simulated robot.

So far so good..I've a small robot which moves really good under RViz and now I'm interested to simulate it in Gazebo. Since the ROS Node is going to simulate the robot's dynamic I want at first move it under Gazebo. Something similar I 've found in this question. But I'm still a little bit confused about Plugins in Gazebo. For my understanding one could move the robot just publishing from ROS information about velocity and position on the following two topics:

/gazebo/set_model_state should I need a plugin? What's the purpose for?

Is the way (publishing on these topics) right? Or one should create a plugin of the robot to get simulated in Gazebo?

Many thanks in advance Regards

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-05-07 06:46:26 -0600

winston gravatar image

I recommend you take a closer look at the Gazebo plugin. As it said,

A plugin is a chunk of code that is compiled as a shared library and inserted into the simulation. The plugin has direct access to all the functionality of Gazebo through the standard C++ classes.

So if you want to use all the functionality of Gazebo(get model name, set velocity, acceleration, change simulation physics properties, etc.), not only limiting to publishing messages on /gazebo/setlinkstate, /gazebo/setmodelstate or other topics to change the model or link state(yes, you can publish messages on these topics to make your model move), you should learn to write a plugin.

Actually, Gazebo has been developed independent of ROS, so it is not using ROS messages, service, topics, etc any more. It adopts protobuf for message passing(take a look at "Transport Library" tutorial) and you will not see ROS topics like /gazebo/setlinkstate. The reason that you can use them is because a package called gazebo_ros_pkgs. As the tutorial said:

To achieve ROS integration with stand-alone Gazebo, a new set of ROS packages named gazebo_ros_pkgs has been created to provide wrappers around the stand-alone Gazebo. They provide the necessary interfaces to simulate a robot in Gazebo using ROS messages, services and dynamic reconfigure.

Now I am using model plugin to control my robot and works well. Actually, if you want to move your robot in simulation, I think it is better to use gazebo function SetAngularVel() or SetLinearVel() instead of publishing messages on topic /gazebo/setmodelstate. Because messages on the topic /gazebo/setmodelstate have fields of both velocity and pose and it is tricky to set both of them.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2015-05-06 04:34:25 -0600

Seen: 4,168 times

Last updated: May 07 '15