Home | Tutorials | Wiki | Issues
Ask Your Question
0

Gazebo camera: render only some objects

asked 2016-11-27 13:42:38 -0500

c_rist gravatar image

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.

image description

What am I doing wrong? Are there some camera options, or do I have to set different flags?

Best regards!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-11-28 10:28:25 -0500

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.

edit flag offensive delete link more

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?

c_rist gravatar imagec_rist ( 2016-11-30 03:25:46 -0500 )edit

As far as I know, yes. Maybe a system plugin could also do it, but I'm not sure

chapulina gravatar imagechapulina ( 2016-11-30 10:22:06 -0500 )edit
1

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

nkoenig gravatar imagenkoenig ( 2016-11-30 11:20:47 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-11-27 13:42:38 -0500

Seen: 570 times

Last updated: Nov 28 '16