Skip to content

Commit 1b6c0f1

Browse files
Example3: Add section on command mode switching (#624)
* Add section on command mode switching * Update example_3/doc/userdoc.rst Co-authored-by: Sai Kishor Kothakota <[email protected]> --------- Co-authored-by: Sai Kishor Kothakota <[email protected]>
1 parent b7b3844 commit 1b6c0f1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

example_3/doc/userdoc.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,30 @@ Tutorial steps
142142
[ros2_control_node-1] pos: 0.67, vel: 5.00, acc: 0.00 for joint 0
143143
[ros2_control_node-1] pos: 0.67, vel: 5.00, acc: 0.00 for joint 1
144144
145-
6. To demonstrate illegal controller configuration, use one of the following launch file arguments:
145+
6. Now you can also switch controllers during runtime, which also changes the command mode automatically. First, you have to load the new controller, for example the ``forward_position_controller`` if you haven't changed the launch file argument.
146+
147+
.. code-block:: shell
148+
149+
ros2 control load_controller forward_position_controller $(ros2 pkg prefix ros2_control_demo_example_3 --share)/config/rrbot_multi_interface_forward_controllers.yaml
150+
ros2 control set_controller_state forward_position_controller inactive
151+
152+
Then you can switch controllers using the following command:
153+
154+
.. code-block:: shell
155+
156+
ros2 control switch_controllers --deactivate forward_velocity_controller --activate forward_position_controller
157+
158+
Observe the output of the following CLI commands, and see how the command interfaces are claimed by the new controller.
159+
160+
.. code-block:: shell
161+
162+
ros2 control list_controllers
163+
ros2 control list_hardware_interfaces
164+
165+
Try now to send commands to the new controller, as described in the previous step.
166+
167+
168+
7. To demonstrate illegal controller configuration, use one of the following launch file arguments:
146169

147170
* ``robot_controller:=forward_illegal1_controller`` or
148171
* ``robot_controller:=forward_illegal2_controller``

0 commit comments

Comments
 (0)