gazebosim / gz-rendering

C++ library designed to provide an abstraction for different rendering engines. It offers unified APIs for creating 3D graphics applications.
https://gazebosim.org
Apache License 2.0
50 stars 48 forks source link

Add Arrow and Axis markers #493

Open chapulina opened 2 years ago

chapulina commented 2 years ago

The creation of arrow and axis visuals has been supported since https://github.com/ignitionrobotics/ign-rendering/pull/87. But these shapes can't be used as markers yet:

https://github.com/ignitionrobotics/ign-rendering/blob/04a50f8a88653c25a0824aa1277e5b8b0e17d704/include/ignition/rendering/Marker.hh#L35-L72

Desired behavior

I'd like to create markers shaped like arrows and axes.

Alternatives considered

Creating axis and arrow visuals instead of markers. I think the main functionality we miss is lifetime:

https://github.com/ignitionrobotics/ign-rendering/blob/04a50f8a88653c25a0824aa1277e5b8b0e17d704/include/ignition/rendering/Marker.hh#L85-L88

Another option would be for downstream applications to create separate markers for each piece of these more complex markers (i.e. cylinders and cones).

Implementation suggestion

What sets axis and arrow apart from the other geometries and renderables being used as markers is that they're CompositeVisuals and have multiple geometries inside them. That's complicated because Marker derives from Geometry, and there are multiple places in the code that assume that geometries have only one "object" (i.e. one OgreObject).

In hindsight, I wish we had made Marker derive from Visual instead, so it could hold many geometries.

I explored the idea of making a marker hold many geometries, but that breaks many assumptions. In particular, we'd need to also allow Ogre*Geometry to hold many OgreObjects. At that point, we're basically treating geometries as visuals.

Another idea is creating axis and arrow meshes that are glued together, so they can be used as primitives. The disadvantage would be losing control over materials / scale for each piece.

The last thing I can think of is creating a "composite marker" which can hold many markers... Or can hold visuals...

Additional context

There's already axis and arrow support on the marker message, see https://github.com/ignitionrobotics/ign-msgs/pull/62

chapulina commented 2 years ago

I explored the idea of making a marker hold many geometries

That work is on these branches, but only the first geometry is being shown right now :confused: