Skip to content

Commit dcc67fe

Browse files
Example3: Add section on command mode switching (#624) (#625)
* 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]> (cherry picked from commit 1b6c0f1) Co-authored-by: Christoph Fröhlich <[email protected]>
1 parent 56004a1 commit dcc67fe

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
@@ -140,7 +140,30 @@ Tutorial steps
140140
[RRBotSystemMultiInterfaceHardware]: Got pos: 0.78500, vel: 0.00000, acc: 0.00000 for joint 0!
141141
[RRBotSystemMultiInterfaceHardware]: Got pos: 0.78500, vel: 0.00000, acc: 0.00000 for joint 1!
142142
143-
6. To demonstrate illegal controller configuration, use one of the following launch file arguments:
143+
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.
144+
145+
.. code-block:: shell
146+
147+
ros2 control load_controller forward_position_controller $(ros2 pkg prefix ros2_control_demo_example_3 --share)/config/rrbot_multi_interface_forward_controllers.yaml
148+
ros2 control set_controller_state forward_position_controller inactive
149+
150+
Then you can switch controllers using the following command:
151+
152+
.. code-block:: shell
153+
154+
ros2 control switch_controllers --deactivate forward_velocity_controller --activate forward_position_controller
155+
156+
Observe the output of the following CLI commands, and see how the command interfaces are claimed by the new controller.
157+
158+
.. code-block:: shell
159+
160+
ros2 control list_controllers
161+
ros2 control list_hardware_interfaces
162+
163+
Try now to send commands to the new controller, as described in the previous step.
164+
165+
166+
7. To demonstrate illegal controller configuration, use one of the following launch file arguments:
144167

145168
* ``robot_controller:=forward_illegal1_controller`` or
146169
* ``robot_controller:=forward_illegal2_controller``

0 commit comments

Comments
 (0)