Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LINE_STRIP and LINE_LIST markers have no width #898

Open
jrutgeer opened this issue Sep 5, 2023 · 0 comments
Open

LINE_STRIP and LINE_LIST markers have no width #898

jrutgeer opened this issue Sep 5, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jrutgeer
Copy link

jrutgeer commented Sep 5, 2023

Environment

  • Gazebo Sim Garden

Description

I was expecting the LINE_STRIP and LINE_LIST markers to have the same behavior as their RViz counterparts:

Line strips/lists also have some special handling for scale: only scale.x is used and it controls the width of the line segments."

However, in Gazebo the scale is an actual scale of the point coordinates, and the line is always very thin (1 pixel width?).

E.g. a thin line from {0,0,0} to {0,1,0} is scaled by scale:{x:1,y:10,z:1} into an equally thin line from {0,0,0} to {0,10,0}.

(Note also that the RViz 'scale' has units, e.g. scale.x == 0.05 implies a line width of 5 cm.)

Test

  • Open an empty world that loads the MarkerManager plugin,

  • Run following command with different values for the scale and compare the output:

gz service -s /marker --reqtype gz.msgs.Marker --reptype gz.msgs.Empty --req 'action:ADD_MODIFY,ns:"line_ns",id:1,type:LINE_LIST,lifetime:{sec:10,nsec:0},pose:{position:{x:0,y:0,z:0},orientation{x:0,y:0,z:0,w:1}},point:{x:0,y:0,z:0.15},point:{x:0,y:10,z:0.15},point:{x:2,y:10,z:0.15},point:{x:2,y:0,z:0.15},materials:{ambient:{r:1,g:0,b:0,a:1},diffuse:{r:1,g:0,b:0,a:1},specular:{r:1,g:0,b:0,a:1},emissive:{r:1,g:0,b:0,a:1}},materials:{ambient:{r:0,g:0,b:1,a:1},diffuse:{r:0,g:0,b:1,a:1},specular:{r:0,g:0,b:1,a:1},emissive:{r:0,g:0,b:1,a:1}},scale:{x:1,y:1,z:1},visibility:ALL' --timeout 3000

Proposed solution

Implement similar behavior to RViz

Pro:

  • Identical to RViz,
  • I assume for Ogre2 this would allow for PBR textures to be applied to the line, so you could very easily create lines with blurred edges, or dashed lines, etc. (similar to the fog albedo map for a particle emitter). That is nice!

Con:

  • It breaks behavior for somebody who is currently applying a scale to a line marker.
  • However here's an idea for a possible backwards-compatible implementation:
    • It is very unlikely that someone currently would specify a scale zero for both y and z (as that would imply projecting all line coordinates onto the X-axis). So the change could be implemented such that:
    • The new behavior explicitly requires scale:x to be non-zero and scale:y and scale:z both to be zero,
    • If that is not the case, the old behavior is kept,
    • So this is likely to be backwards compatible for any 'real life' application.

Alternatives considered

Draw a thick line by calculating the corner coordinates instead of just the start and end point, and drawing a TRIANGLE_LIST instead of a line

Pro:

  • This is currently possible, i.e. requires no change to gz-rendering,

Con:

  • Different behavior than RViz,
  • Extra burden to calculate the corner coordinates,
  • Not possible to add PBR textures, or at least not trivially, as I assume that some sort of UV mapping would be needed between the texture and the triangles?
@jrutgeer jrutgeer added the bug Something isn't working label Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: To do
Development

No branches or pull requests

1 participant