Gazebo camera: render only some objects
Hi guys,
I've read this post about modifying a visual's visibility flags to render it in the GUI but not in a camera sensor:
Make gazebo camera ignore certain objects
As suggested, my plugin sets all visuals' visibility flags to GZVISIBILITYGUI, except for some whitelisted ones I want to render (visible = true;
) Example line:
node->SetVisibilityFlags(visible ? 0xffffffff : GZ_VISIBILITY_GUI);
If I add a gazebo camera to my world, the in-simulation preview image does exactly the right thing: only the vehicle is visible. However, the published image contains all models (see screenshot). I want it to look like the camera image in the gazebo GUI where only the vehicle is rendered.
What am I doing wrong? Are there some camera options, or do I have to set different flags?
Best regards!
Asked by c_rist on 2016-11-27 14:42:38 UTC
Answers
What type of plugin did you write? You might be changing only the client's scene but not the server's? Sensor data gets generated on the server's scene.
I'd suggest you make it a visual plugin. The downside is that you'll have to add that plugin to every visual which you wish not to render.
Asked by chapulina on 2016-11-28 11:28:25 UTC
Comments
Thanks for your answer. I've written a GUIPlugin. So I guess this might be the problem. Is a visual plugin the only plugin type capable of changing the server's scene?
Asked by c_rist on 2016-11-30 04:25:46 UTC
As far as I know, yes. Maybe a system plugin could also do it, but I'm not sure
Asked by chapulina on 2016-11-30 11:22:06 UTC
A world or model plugin could get the server side scene using the rendering::get_scene() function. https://bitbucket.org/osrf/gazebo/src/default/gazebo/rendering/RenderingIface.hh
Asked by nkoenig on 2016-11-30 12:20:47 UTC
Comments