diff --git a/source/Tutorials/Intermediate/Monitoring-For-Parameter-Changes-CPP.rst b/source/Tutorials/Intermediate/Monitoring-For-Parameter-Changes-CPP.rst index cfc2729ae8d..137c018fcb9 100644 --- a/source/Tutorials/Intermediate/Monitoring-For-Parameter-Changes-CPP.rst +++ b/source/Tutorials/Intermediate/Monitoring-For-Parameter-Changes-CPP.rst @@ -120,10 +120,14 @@ The first statement, ``#include `` is included so that the code can util The next, ``#include "rclcpp/rclcpp.hpp"`` is included to allow the code to reference the various functionality provided by the rclcpp interface, including the ParameterEventHandler class. After the class declaration, the code defines a class, ``SampleNodeWithParameters``. -The constructor for the class, declares an integer parameter ``an_int_param``, with a default value of 0. +The constructor for the class declares an integer parameter ``an_int_param``, with a default value of 0. Next, the code creates a ``ParameterEventHandler`` that will be used to monitor changes to parameters. Finally, the code creates a lambda function and sets it as the callback to invoke whenever ``an_int_param`` is updated. +.. note:: + + It is very important to save the handle that is returned by ``add_parameter_callback``; otherwise, the callback will not be properly registered. + .. code-block:: C++ SampleNodeWithParameters() @@ -150,7 +154,7 @@ Following the ``SampleNodeWithParameters`` is a typical ``main`` function which .. code-block:: C++ - int main(int argc, char** argv) + int main(int argc, char ** argv) { rclcpp::init(argc, argv); rclcpp::spin(std::make_shared());