gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
708 stars 269 forks source link

Support loading more than one visual plugin on GUI side #1363

Open iche033 opened 2 years ago

iche033 commented 2 years ago

Environment

Description

Visual plugin support on the GUI side is added in https://github.com/ignitionrobotics/ign-gazebo/pull/1275. However when multiple visual plugins are specified for a <visual>, only the last one will be loaded, see https://github.com/ignitionrobotics/ign-gazebo/pull/1335#issuecomment-1049728543

This is mainly because we are only creating attaching one VisualPlugin component to a visual entity on the server side, which then get serialized and sent to the GUI side: https://github.com/ignitionrobotics/ign-gazebo/blob/0dead0578ba3f26cf97f8162e55a0dbe1112484c/src/SdfEntityCreator.cc#L752-L761

A potential fix is to use component that stores a list of visual plugins instead

chapulina commented 2 years ago

A potential fix is to use component that stores a list of visual plugins instead

We'll need some way of passing system information from the server to the client for #191. I was thinking of creating a component that stores a ignition::msgs::Plugin_V. Do you think that could address all the needs of the VisualPlugin, @iche033 ? I think that would be better to serialize than an sdf::ElementPtr.

iche033 commented 2 years ago

I think so. As long as contents of the plugin.proto msg can be converted back to an sdf::ElementPtr then it should be fine. For loading visual plugins, it comes down to this call on the GUI side: https://github.com/ignitionrobotics/ign-gazebo/blob/ign-gazebo6/src/gui/GuiRunner.cc#L343-L344