Updating the visual of a model using the ModelPlugin
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-dynamic-terrain. 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?
Thanks!
Asked by Samahu on 2020-04-02 11:08:03 UTC
Comments
Have you tried using the
ModelPlugin
to publish to~/visual
?Asked by scpeters on 2020-04-08 16:26:21 UTC
Is there a way to manipulate object mesh vertices or terrain heightmap values by pushing message to ~/visual? any example on this?
Asked by Samahu on 2020-04-08 18:00:54 UTC
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.
Asked by chapulina on 2020-04-08 18:02:57 UTC
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/cde54284e90b59a9af9fade096946c0cd4a91c44/examples/plugins/model_visuals/model_visuals.cc#lines-32:57
Asked by scpeters on 2020-04-08 18:03:16 UTC
Yes, it looks like it can modify existing visuals: https://bitbucket.org/osrf/gazebo/src/cde54284e90b59a9af9fade096946c0cd4a91c44/gazebo/rendering/Scene.cc#lines-2708:2738
Asked by scpeters on 2020-04-08 18:07:14 UTC
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/branches/compare/dart_deform_tire_test%0D2591f95#diff
Asked by scpeters on 2020-04-08 18:29:27 UTC
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!
Asked by Samahu on 2020-04-08 18:39:43 UTC
Hi, is there an equivalent functionality or even a example within Ignition Gazebo (Fortress)? If so, which is the appropriate topic a message should be send so in order to change a model's visual, which is equivalent to the formers model plugin and therefore publisher's namespace/topic
BR
Asked by Illuminatur on 2022-04-18 11:32:53 UTC