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

Visualize rviz Marker/MarkerArray #8

Open
lucasw opened this issue Apr 11, 2024 · 4 comments
Open

Visualize rviz Marker/MarkerArray #8

lucasw opened this issue Apr 11, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@lucasw
Copy link

lucasw commented Apr 11, 2024

I've just started using rerun and am trying out making a Marker-to-rerun standalone node (I don't think I've seen one elsewhere): https://github.com/lucasw/cpp-example-ros-bridge/blob/viz_markers/rerun_bridge/scripts/rerun_marker.py (so far it only converts a line strip, but the other primitives should be easy). I could convert to C++ later once I've gotten it mostly working in python- and it ought to go into the bridge?

@roym899
Copy link
Collaborator

roym899 commented Apr 13, 2024

That would be awesome. It would require extending rerun_ros_interface.cpp and adding the corresponding subscriber factory method to the visualizer node.

I am currently porting the bridge to ROS 2 and will also work on adding support for more of the standard types once that is done.

@roym899 roym899 added the enhancement New feature or request label Apr 13, 2024
@lucasw
Copy link
Author

lucasw commented Apr 15, 2024

Here's what I have so far:

2024_04_15_rviz_markers_in_rerun

https://youtu.be/95s8YK3x8f0

rosrun visualization_marker_tutorials example_marker_array.py
rosrun rerun_bridge rerun_marker.py
  • The Arrow isn't rotating properly, but I haven't looked into it much (possibly that rotation matrix is bad)- any suggestions to fix it are welcome. Also am I squashing it flat? Having the rviz marker control over the length of the tip and shaft and tip base radius would be nice, but not super important to anything I'm doing. There's another mode where the rviz arrow is defined by start and end points and I'll try that next, I expect it will work better.

  • There's no cylinder primitive so it would have to be generated as a Mesh3D, not too hard but rerun support would be nice.

  • Have rerun generate triangle flat face normals if not provided, could be optional.

  • Optional support for faces on boxes instead of the wireframe? Or I could generate a box Mesh3D instead.

  • marker.pose.orientation is ignored for many types (though I never use it with any of the list marker types, I would instead make a parent ros transform handle it)- but adding a rerun transform for it seems like it would work.

I could take a look at adding any of the above that apply to the core rerun.

After fixing the arrows I can look at moving some of this to the bridge.

@roym899
Copy link
Collaborator

roym899 commented Apr 16, 2024

That looks great!

  • I'm not sure what the problem with the arrow is. This kind of flattening might suggest that the rotation matrix isn't actually a proper rotation matrix (?). If you provide a 3x3 matrix to Rerun it will apply it as a linear transformation.
  • Like you say, right now the best bet is to generate a Mesh3D to get cylinders (see Support for more 2D and 3D primitives rerun#1361).
  • I think for now just having the wireframe for the boxes is okay; I think showing / hiding faces of Box3D should be supported in Rerun; I'll open an issue for this in the main repo
  • Adding a Rerun transform for the pose seems like the right approach (and should be applicable to all marker types) 👍

@lucasw
Copy link
Author

lucasw commented Apr 16, 2024

I did create a rerun transform per marker, arrows are looking good and it turned out I did have a few cases of other marker types setting orientation so those all work now too.

def ros_pose_to_rr_transform(pose: Pose) -> rr.Transform3D:
    t = pose.position
    translation = [t.x, t.y, t.z]
    q = pose.orientation
    rotation = rr.Quaternion(xyzw=[q.x, q.y, q.z, q.w])
    return rr.Transform3D(translation=translation, rotation=rotation)
...
rr_transform = ros_pose_to_rr_transform(marker.pose)
rr_name = f"{parent_frame}/{marker.header.frame_id}/{marker.ns}/{marker.id}"
...
rr.log(rr_name, rr_transform)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants