rerun-io / cpp-example-ros-bridge

An example implementation of a ROS to Rerun bridge
https://rerun.io/
Apache License 2.0
23 stars 4 forks source link

Visualize rviz Marker/MarkerArray #8

Open lucasw opened 4 months ago

lucasw commented 4 months ago

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 commented 4 months ago

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.

lucasw commented 4 months ago

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

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 commented 4 months ago

That looks great!

lucasw commented 4 months ago

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)