ros-visualization / rviz

ROS 3D Robot Visualizer
BSD 3-Clause "New" or "Revised" License
792 stars 459 forks source link

Suggestion: Arrow List Marker #1785

Open rr-tom-noble opened 1 year ago

rr-tom-noble commented 1 year ago

Hi,

I've found myself frequently using arrow markers to visualise paths in rviz, however, using separate markers for each arrow feels messy and I imagine quite inefficient compared to using marker types which support lists of geometries. Furthermore, they tend to behave unreliably when rendering in large amounts i.e. >100 (usually frame transformation issues despite the frames existing).

I've tried switching over to the line strip geometry type, however, I've found it lacking in a couple of ways for my use case:

With this in mind, I'm wondering if it'd be useful to add an arrow list marker type? I'm imagining that properties such as scaling and colour would apply to all arrows in the list so that they're uniformly shaped, and the points field would contain N points, defining N-1 arrows tip to tail.

I'm happy to attempt raising a PR if this sounds like a sensible idea

rhaschke commented 1 year ago

I understand your need. As far as I understand it would be a variant of LINE_STRIP: instead of simply drawing a line, draw the arrow strip. Such a PR is definitely welcome. However, it's quite different from the existing [SPHERE|CUBE|POINT]_LIST, whose geoms all share the same orientation. Thus, I suggest naming the new type ARROW_STRIP.

rr-tom-noble commented 1 year ago

Thanks for the advice. I'll try to get a PR raised some time this week. Could you let me know if there are any automated tests / additional documentation I should add before opening a PR?

rhaschke commented 1 year ago

We don't have many automated tests for rviz as validation typically involves visual inspection of the result. Please prepare a small test script to feed your display with data - in the vein of the send_*.py files in src/test.

rr-tom-noble commented 1 year ago

@rhaschke I've implemented an ArrowStripMarker class which implements the onNewMessage() method. Could you let me know which other files would need updating to hook everything up to use the new class?

Thanks!

rhaschke commented 1 year ago

I think you just need to adapt createMarker() in marker_utils.cpp as well.