Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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/set_link_state, /gazebo/set_model_state 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/set_link_state. 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/set_model_state. Because messages on the topic /gazebo/set_model_state have fields of both velocity and pose and it is tricky to set both of them.