gazebosim / gz-sim

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

Display more component types in the component inspector #158

Open chapulina opened 4 years ago

chapulina commented 4 years ago

The ComponentInspector GUI plugin displays all the components of an entity.

image

For all components, even custom ones, it will display the component name. But it will only display the values of the component if the component is listed in the plugin. We have several components which are not listed there yet though. On the example above, Physics Engine Plugin is the component's name, and its value is not being displayed.


If the component's data type is already supported, like String it should just be a matter of adding an #include and an if statement like the one below.

https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/src/gui/plugins/component_inspector/ComponentInspector.cc#L467-L475

That's the case of Physics Engine Plugin above, which has std::string data:

https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/include/ignition/gazebo/components/PhysicsEnginePlugin.hh#L34-L35


If the component's data type is not supported yet, the work should involve adding a new setData function for that type and an accompanying qml file, such as:

https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/src/gui/plugins/component_inspector/ComponentInspector.cc#L124-L132

That's the case of Scene above, which has sdf::Scene data:

https://github.com/ignitionrobotics/ign-gazebo/blob/44951e3ddfd238f24182d4d80b1376f0d426bd43/include/ignition/gazebo/components/Scene.hh#L44-L45

chapulina commented 2 years ago

When implementing new component displays, let's use the pattern introduced in https://github.com/gazebosim/gz-sim/pull/1400, to make the code more manageable. (That is, look at Pose3d as an example.)