0
$\begingroup$

Gazebo Answers logo

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_link_state
/gazebo/set_model_state

So...now...why 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


Originally posted by Antares on Gazebo Answers with karma: 3 on 2015-05-06

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

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.


Originally posted by winston with karma: 449 on 2015-05-07

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.