# Render plugin force for debugging

I have a plugin that is applying a force on a link, and I would want that plugin to inject a visual for that force into the link. For instance, say that the link is a box, and my plugin applies a force on the side of the box that makes it translate in the world, I would want my plugin to add an arrow showing that force.

Because I don't know how to make an arrow, for now let's say I just draw a sphere where that force applies. So in my plugin's Load function, I get the model and the SDF:

void MyPlugin::Load(physics::ModelPtr model, sdf::ElementPtr sdf)


I can get the link, say my_link, with model->GetLink("my_link"). And I would like to inject the following visual into it:

  <visual name='test_sphere_visual'>
<pose>0 0 1</pose>
<geometry>
<sphere>
</sphere>
</geometry>
</visual>


I have been following the "spawn spheres" tutorial, where I successfully manage to create an msgs::Model from a string and inject it into the world. But in this case, instead of injecting a whole new model, I want to inject a visual into an existing link.

Is there a way to do that from a plugin?

edit retag close merge delete

Sort by » oldest newest most voted

If there is any contact that's applying the force to the box, you can visualize the contact force by selecting in the menu View > Contacts.

If the force isn't covered by any of the items in the View menu, are you using ROS with Gazebo? If you are, a much easier way that's usually done is to visualize in RViz: http://wiki.ros.org/rviz

All the supported types, including arrows, are listed here http://wiki.ros.org/rviz/DisplayTypes...

Adding a visual dynamically is really not the usual way that this is done.

more