I’d like to share the release of a fun project I had been working on: ROS 2 CMV! - a custom message visualizer for RViz. With this package, you can generate rviz plugins for your custom messages!! The link to the repository is https://github.com/suchetanrs/ros2_cmv
This can be done using a GUI or directly in your CMakeLists by adding the following line just after the creation of your message:
generate_rviz_plugin("msg/Sample.msg")
Here are some plugins I was able to generate and play around with.
A 2D occupancy map + markers showing the heights of obstacles + robot path with the evolution of the covariance over time.
Similar to the previous one, but a live demonstration of a robot moving in a corridor.
A snapshot of two robots with the paths that they will take, the laser-scan and a couple of obstacles (I should have done better here :p)
All of this is visualized in a single message type!
If you like my work, please do leave a on the repository. It will mean the world to me!
Would something like this also be possible using message introspection? Like plotjuggler or foxglove do for example?
That would reduce the (very little) need for a CMakeLists.txt modification.
For use cases like yours, I’ve just pushed a new method to obtain the message as the actual type and added this to the any_subscriber example.
This allows for handling known messages as ROS messages without using the message introspection wrapper. So, you could just use your visualizations as they are.
During the cast, it is checked that it is the requested message type; if not, it will throw.
Example:
// Assume I got a message with a field pose
if ( compound["pose"].name() == "geometry_msgs/msg/Pose" ) {
std::shared_ptr<geometry_msgs::msg::Pose> pose =
compound["pose"].message<geometry_msgs::msg::Pose>();
processPose(pose);
}
Please note that this method is experimental; I am quite certain it should work for any message type, but I haven’t tested it for messages other than geometry_msgs/msg/Point.
Thanks for the appreciation! @Timple
I wanted to get this to work directly with message introspection when I first started the project but since I was not familiar with it’s usage, I decided to take this route for the initial release. My immediate next step is to get it working with any message type directly out of the box!
Thanks for sharing the package @StefanFabian ! I will try this out and let you know if I face issues.