Updating the visual of a model using the ModelPlugin

asked 2020-04-02 11:08:22 -0600

updated 2020-04-08 11:05:53 -0600

I am working on a plugin that updates needs to update the mesh of a model or a scene object. The data of visual and collision links both needs to be updated at the same time.

I tried to implement these updates solely using the ModelPlugin, I can see the changes taking place for the collision but updates to the visual link are never reflected in Gazebo GUI. I can only observe these updates reflected in Gazebo if I move the code that updates the visual link into a VisualPlugin. This means that I have to split my code into two plugins to manipulate a single model.

To give better insight you may refer to the current implementation: https://github.com/Samahu/robotics-dy.... You should notice that I have two separate plugins to update a single terrain object.

Is this the expected behavior or there is a better way?


edit retag flag offensive close merge delete


Have you tried using the ModelPlugin to publish to ~/visual?

scpeters gravatar imagescpeters ( 2020-04-08 16:26:21 -0600 )edit

Is there a way to manipulate object mesh vertices or terrain heightmap values by pushing message to ~/visual? any example on this?

Samahu gravatar imageSamahu ( 2020-04-08 18:00:54 -0600 )edit

No, that kind of deformation is not exposed through the message API. You'd have to create a visual plugin and handle the communication yourself.

chapulina gravatar imagechapulina ( 2020-04-08 18:02:57 -0600 )edit

Hm...that's a good question. We have an example plugin that creates a visual by publishing to this topic, but I'll have to check if it can modify as well: https://bitbucket.org/osrf/gazebo/src...

scpeters gravatar imagescpeters ( 2020-04-08 18:03:16 -0600 )edit

Yes, it looks like it can modify existing visuals: https://bitbucket.org/osrf/gazebo/src...

scpeters gravatar imagescpeters ( 2020-04-08 18:07:14 -0600 )edit

There was a branch from a while ago that tried to support deformation of mesh vertices, but it never got merged and might be a bit slow: https://bitbucket.org/osrf/gazebo/bra...

scpeters gravatar imagescpeters ( 2020-04-08 18:29:27 -0600 )edit

Knowing that I need to have a separate visual plugin for my case is enough since this was the path I already took to manipulate the object on low level. I mainly wanted to make sure there is no better way to address this. I will check the mesh deformation branch to see what can I learn from it. Thanks scpeters and chapulina!

Samahu gravatar imageSamahu ( 2020-04-08 18:39:43 -0600 )edit