You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: example_7/doc/userdoc.rst
+11-40Lines changed: 11 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -333,17 +333,21 @@ Certain interface methods are called during transitions between these states. Du
333
333
334
334
The following code blocks will explain the requirements for writing a new controller.
335
335
336
-
The controller plugin for the tutorial robot is a class called ``RobotController`` that inherits from ``controller_interface::ControllerInterface``. The ``RobotController`` must implement nine public methods. The last six are `managed node <https://design.ros2.org/articles/node_lifecycle.html>`__ transitions callbacks.
336
+
The controller plugin for the tutorial robot is a class called ``RobotController`` that inherits from ``controller_interface::ControllerInterface``. The ``RobotController`` must implement the following public methods:
337
337
338
338
1. ``command_interface_configuration``
339
339
2. ``state_interface_configuration``
340
340
3. ``update``
341
-
4. ``on_configure``
342
-
5. ``on_activate``
343
-
6. ``on_deactivate``
344
-
7. ``on_cleanup``
345
-
8. ``on_error``
346
-
9. ``on_shutdown``
341
+
342
+
The following methods are `managed node <https://design.ros2.org/articles/node_lifecycle.html>`__ transitions callbacks. These overrides are optional and only the ``on_configure``, ``on_activate`` and ``on_deactivate`` have been used in this example.
343
+
The ``on_cleanup`` and ``on_shutdown`` methods are called when the controller's lifecycle node transitions to the shutdown state. They should handle memory deallocation and general cleanup. The ``on_error`` method is invoked if the managed node encounters a failure during a state transition.
344
+
345
+
1. ``on_configure``
346
+
2. ``on_activate``
347
+
3. ``on_deactivate``
348
+
4. ``on_cleanup``
349
+
5. ``on_error``
350
+
6. ``on_shutdown``
347
351
348
352
349
353
.. code-block:: c++
@@ -357,9 +361,6 @@ The controller plugin for the tutorial robot is a class called ``RobotController
@@ -442,36 +443,6 @@ The ``on_deactivate`` is called when a controller stops running. It is important
442
443
return CallbackReturn::SUCCESS;
443
444
}
444
445
445
-
The ``on_cleanup`` and ``on_shutdown`` are called when the controller's lifecycle node is transitioning to shutting down. Freeing any allocated memory and general cleanup should be done in these methods.
0 commit comments