Hi!
I’d like to show you a tool I’ve been working on and that I think could be useful to many people.
I suppose more than once some of you have had to create an RVIZ plugin, and you’ve probably been quite lost the first time, as always happens when you enter a new world. In my case, I’ve always ended up looking for someone else’s plugin to learn how to do it and seeing everything the QT library could offer. In the end, I’d end up wasting a day or two just making a simple panel to debug my application.
To avoid having to deal with QT, whether learning or simply having to design the application yourself, I’ve prepared the following package:
With this package, we can generate our own RVIZ plugin. For now, just a panel with buttons, where we can publish any messages we want.
Still in development, it’s based on the rosidl_defaults_generator function, which, for those who don’t know, is the package we use to create our custom messages and does the magic so we can use them jajaja. Let me tell you a little about how it works:
First, we add the following lines to the CMakeLists.txt
of the package that will generate a plugin:
find_package(rviz_publisher_cmake REQUIRED)
generate_rviz_panel(
<path_to_the_yaml>
)
Next, we configure the yaml file we’re going to add to our CMakeLists.txt
in a similar way:
panel:
- name: "Hello"
topic: "/example"
topic_type: "std_msgs/msg/String"
message:
data: "Hello, world!"
- name: "Forward"
topic: "/cmd_vel"
topic_type: "geometry_msgs/msg/Twist"
message:
linear:
x: 0.5
- name: "Move"
topic: "/cmd_vel"
topic_type: "geometry_msgs/msg/Twist"
message:
linear:
x: 0.5
y: 0.0
angular:
z: 0.5
Finally, we build, open rviz, add our panel, and magic happens.
So, nothing. I hope it’s useful to people who, as I’ve already said, don’t want to spend too much time creating their own plugin, although it’s always good to learn new things jeje.
And I’m posting this now, even though there’s still a lot missing, because I’d also like to gather ideas about what people would like to have, since I also plan to use it for actions, services, and to generate sliders…
Finally, I would like to say that I know that rviz is ultimately a tool used to visualize information, not to publish, and that rqt_publisher would also be used for that. However, having an all-in-one is always useful when you want to debug things, and having to switch windows or write in a terminal ends up being too repetitive, and I think this is going to help a lot.
Thank you very much for reading, and I hope it helps.
Best regards.