ROS2 official parameter monitor example doesn't compile
Hi, I tried on two different Ubuntu 20 machines with ROS2 Galactic and Foxy full desktop versions, but the official example about parameters monitoring highlighted here doesn't compile.
Relevant part of the output is the following
/home/white/ros2_ws/src/parameters/src/parameters_monitor.cpp:32:29: error: ‘ParameterEventHandler’ is not a member of ‘rclcpp’; did you mean ‘ParameterEventsQoS’?
I didn't find issue tickets or something about on the web. Does anyone know anything about or I miss something??
Asked by dottant on 2022-04-26 10:55:39 UTC
Answers
Did you happen to use #include "rclcpp/node.hpp"
in your parameters_monitor.cpp, as opposed to the #include "rclcpp/rclcpp.hpp"
that's used in the tutorials? (I managed to reproduce your issue by using #include "rclcpp/node.hpp
.)
As @aprotyas explained, the feature only seems available for ROS2 Galactic onwards.
Using #include rclcpp/rclcpp.hpp
will call #include "rclcpp/parameter_event_handler.hpp"
.
Asked by ijnek on 2022-04-28 07:52:21 UTC
Comments
Thank you guys.
I investigated and unfortunately I didn't find anything on the official DOC and repo about the accessibility of the Parameter Monitor in other versions different than Galactic, so your answer is right and yes, on my Galactic platfom I was sourcing Foxy, that's why I got the error.
I guess it is better to update the DOC section of Galactic about the Parameter Monitor saying that is exclusively available for Galactic because it's not mentioned (or I didnt see it....sorry if it's that)
Asked by dottant on 2022-04-28 11:08:22 UTC
It's probably not as visible as it should be, but: the tutorial you link to is not available for Foxy. If you search for it on the Foxy version of the documentation (selectable from the popup menu in the left bottom corner), you won't find it.
The indications you're looking at the "Galactic version":
and:
Asked by gvdhoorn on 2022-04-28 11:28:19 UTC
@gvdhoom sure, I wrote it in my answer, I know that the link points to Galactic and I tried to find it within the Foxy stuff and it's not available. Maybe just a line in the Galactic doc about this thing could be useful, just a suggestion. Anyway thank you so much about the speedy response, that's why I love this community.
Asked by dottant on 2022-04-28 11:37:49 UTC
I agree that sometimes you don't end up on the docs for the distro that your looking for. May I suggest you make a PR against ros2_documentation with the additional note, I'm sure it won't hurt anyone.
Asked by ijnek on 2022-04-28 20:08:21 UTC
Comments
ParameterEventHandler
exists only in Galactic and later distributions. It looks like your rclcpp library may be setup incorrectly and the Foxy version is present in the underlay you're building on top of. Mind posting the full error trace from the compiler?Asked by aprotyas on 2022-04-27 15:04:39 UTC