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 GZ_VISIBILITY_GUI, 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!