Gazebo Answers logo


I'm new to ROS/Gazebo so excuse me for lame words, terms and my English... and Hi everybody here, it's my first post!

I need to update link's visual material in ModelPlugin depending on some conditions (for example, when switch is up I need to assign Gazebo/GreenGlow to the visual, when it is down then Gazebo/Grey). Can this be achieved from the code ? I tried to update SDF parameters (link->GetSDF()) - I changed to necessary value but this works only once (on gazebo gui startup). After gui is shown gazebo does not update visual using current SDF values without explicit request. So I tried to call link->UpdateParameters(sdf) with an updated sdf but got only this message in the console:

Service call failed: transport error completing service call: unable to receive data from sender, check sender's logs for details Segmentation fault (core dumped) [gazebo-2] process has died [pid 1019, exit code 139, cmd /opt/ros/fuerte/stacks/simulator_gazebo/gazebo/scripts/gazebo /home/ubuntu/work/robonaut2_taskboard_controller/stacks/nasa_r2_simulator/r2_gazebo/gazebo/r2_empty.world __name:=gazebo __log:=/home/ubuntu/.ros/log/48332fd8-7695-11e2-9689-080027b96a58/gazebo-2.log]. log file: /home/ubuntu/.ros/log/48332fd8-7695-11e2-9689-080027b96a58/gazebo-2.log*

I would greatly appreciate any help on this question. Thanks.

Originally posted by Artem on Gazebo Answers with karma: 11 on 2013-02-14

Post score: 1


1 Answer 1


Gazebo Answers logo

Hi, the gazebo api is very powerful and well designed.

I try to solve the problem using a VisualPlugin. The ModelPlugins exist to access the physics features of a Model. Nowadays the tutorials says that exists four kind of plugins: World, Model, Sensor and System. But the VisualPlugin exists too, I don't know if there is no documentation about it.

Well I copy the code of "ModelPush" plugin example and modify to do a visual plugin that changes the color of a box. my_plugin.h and my_plugin.cpp and finally the world file teste.world.

I don't know if there is another solution, this one is a little complicated, but maybe it serves you.

After you compile the code and run the gazebo with the world file, you should see a static box that changes the color between red and black.

If you need to change the color of things dynamically probably you need some custom messages to communicate a "physical event" to the visual plugin.

I hope that answer helps you.

Well there is an example in folder examples/plugins/model_visuals of gazebo source. Take a look: Example passing a message

This way is the correct way, I think. Once you known the visual name that you need to modify, you just need to create a visual message and sends it to gazebo. The advantage is that you can keep entire code in the ModelPlugin and modify the visuals through messages.

Originally posted by Daniel Vaz with karma: 305 on 2013-02-16

This answer was ACCEPTED on the original site

Post score: 6


Your Answer

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