ubi-agni / mujoco_ros_pkgs

Wrappers, tools and additional API's for using ROS with MuJoCo
54 stars 11 forks source link

Enable applying render callbacks for specific cameras #19

Open DavidPL1 opened 1 year ago

DavidPL1 commented 1 year ago

Based on a discussion about #17 we decided that we should somehow define which plugins should render to which cameras.

Use case example: Two cameras are defined: workspace_cam and demo_cam. We have to plugins that implement the render callback: plugin_a and plugin_b. plugin_a renders objects that should be captured by all cameras and should be processed. plugin_b renders a helpful visualization that should not be processed by a data pipeline and thus should only be rendered on the image of camera demo_cam.

The current Idea is to

rhaschke commented 1 year ago

Hm. This introduction of information levels seems to be rather brittle. Why not explicitly specify for each camera, which plugins (by name) should get processed? I suggest defaulting to all, but allowing for exclusions as this seems to be more common?

DavidPL1 commented 1 year ago

Depends on where the lists of plugin names is configured. The idea was not to cause too much overhead to enable/disable rendering plugin output and keep configurations as genericly applicable as possible. For instance, I wouldn't like specifying this explicitly in the model file, as it would tailor the model to a specific plugin setup.

But I'm also not a 100% convinced of the information level approach.

We could include this in the camera config on the parameter server, as it is a separate config that is also easily changeable e.g.:

cam_config:
  gripper_cam: # Will display content rendered by plugins except for ExamplePlugin0 and ExamplePlugin3
    stream_type: 3 # RGB and DEPTH
    frequency: 15
    width: 1080
    height: 720
    allow_plugin_rendering: true
    exclude_plugin_list:
      - ExamplePlugin0
      - ExamplePlugin3
  workspace_cam: # Will not display anything rendered by plugins
    stream_type: 3 # RGB and DEPTH
    frequency: 15
    width: 1080
    height: 720
  demo_cam: # Will display everything rendered by plugins
    stream_type: 3 # RGB and DEPTH
    frequency: 15
    width: 1080
    height: 720
    allow_plugin_rendering: true

However, I would disable plugin rendering by default, introduce a flag to enable it (e.g. allow_plugin_rendering above) and then use an exclude list.