diff --git a/doc/index.rst b/doc/index.rst index f4c4af214..d279ba44f 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -272,3 +272,4 @@ Examples Example 10: Industrial robot with GPIO interfaces <../example_10/doc/userdoc.rst> Example 12: Controller chaining <../example_12/doc/userdoc.rst> Example 14: Modular robots with actuators not providing states <../example_14/doc/userdoc.rst> + Example 15: Multi-robot system with namespaced controller_manager <../example_15/doc/userdoc.rst> diff --git a/example_15/doc/userdoc.rst b/example_15/doc/userdoc.rst index 973569ea8..a3c58b254 100644 --- a/example_15/doc/userdoc.rst +++ b/example_15/doc/userdoc.rst @@ -2,99 +2,159 @@ .. _ros2_control_demos_example_15_userdoc: -Example 15: Multi-robot system with namepaced controller_manager +Example 15: Multi-robot system with namespaced controller_manager ================================================================= + +.. include:: ../../doc/run_from_docker.rst + Scenario showcase: Using ros2_control within a local namespace ---------------------------------------------------------------- -- Launch file: [rrbot_namespace.launch.py](ros2_control_demo_bringup/launch/rrbot_namespace.launch.py) -- URDF: [rrbot.urdf.xacro](ros2_control_demo_bringup/config/rrbot.yaml) -- ros2_control URDF: [rrbot.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/rrbot.ros2_control.xacro) -- Controllers config: [rrbot_namespace_controllers.yaml](ros2_control_demo_bringup/config/rrbot_namespace_controllers.yaml) +* Launch file: `rrbot_namespace.launch.py `__ +* Controllers yaml: `rrbot_namespace_controllers.yaml `__ +* URDF file: `rrbot.urdf.xacro `__ + + * Description: `rrbot_description.urdf.xacro `__ + * ``ros2_control`` tag: `rrbot.ros2_control.xacro `__ + +* RViz configuration: `rrbot.rviz `__ +* Test nodes goals configuration: + + + `rrbot_forward_position_publisher `__ + + `rrbot_joint_trajectory_publisher `__ + +* Hardware interface plugin: `rrbot.cpp `__ + +.. note:: -**NOTE:**when running `ros2 control` CLI commands you have to use additional parameter with exact controller manager node name, i.e., `-c /rrbot/controller_manager`. + When running ``ros2 control`` CLI commands you have to use additional parameter with exact controller manager node name, i.e., ``-c /rrbot/controller_manager``. - Command interfaces: + - joint1/position - joint2/position + - State interfaces: + - joint1/position - joint2/position Available controllers: (nodes under namespace "/rrbot") -- `forward_position_controller[forward_command_controller/ForwardCommandController]` -- `joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster]` + +- ``forward_position_controller[forward_command_controller/ForwardCommandController]`` +- ``joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster]`` List controllers: -``` -ros2 control list_controllers -c /rrbot/controller_manager -``` -Commanding the robot using `ForwardCommandController` (name: `/rrbot/forward_position_controller`) -``` -ros2 launch ros2_control_demo_bringup test_forward_position_controller.launch.py publisher_config:=rrbot_namespace_forward_position_publisher.yaml -``` +.. code-block:: shell + + ros2 control list_controllers -c /rrbot/controller_manager + + +Commanding the robot using ``/rrbot/forward_position_controller`` (a ``ForwardCommandController``)) -Switch controller to use `position_trajectory_controller` (`JointTrajectoryController`): -``` -ros2 control switch_controllers -c /rrbot/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller -``` +.. code-block:: shell -Commanding the robot using `JointTrajectoryController` (name: `/rrbot/position_trajectory_controller`) -``` -ros2 launch ros2_control_demo_bringup test_joint_trajectory_controller.launch.py publisher_config:=rrbot_namespace_joint_trajectory_publisher.yaml -``` + ros2 launch ros2_control_demo_bringup test_forward_position_controller.launch.py publisher_config:=rrbot_namespace_forward_position_publisher.yaml + + +Switch controller to use ``JointTrajectoryController`` (name: ``/rrbot/position_trajectory_controller``): + +.. code-block:: shell + + ros2 control switch_controllers -c /rrbot/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller + +Commanding the robot using ``JointTrajectoryController`` (name: ``/rrbot/position_trajectory_controller``) + +.. code-block:: shell + + ros2 launch ros2_control_demo_bringup test_joint_trajectory_controller.launch.py publisher_config:=rrbot_namespace_joint_trajectory_publisher.yaml Scenario showcase: Using multiple controller managers on the same machine ------------------------------------------------------------------------- -- Launch file: [multi_controller_manager_example_two_rrbots.launch.py](ros2_control_demo_bringup/launch/multi_controller_manager_example_two_rrbots.launch.py) -- URDF: [rrbot.urdf.xacro](ros2_control_demo_bringup/config/rrbot.yaml) -- ros2_control URDF: [rrbot.ros2_control.xacro](ros2_control_demo_description/rrbot_description/ros2_control/rrbot.ros2_control.xacro) -- Controllers config 1: [multi_controller_manager_rrbot_1_controllers.yaml](ros2_control_demo_bringup/config/multi_controller_manager_rrbot_1_controllers.yaml) -- Controllers config 2: [multi_controller_manager_rrbot_2_controllers.yaml](ros2_control_demo_bringup/config/multi_controller_manager_rrbot_2_controllers.yaml) +* Launch file: `multi_controller_manager_example_two_rrbots.launch.py `__ +* Controllers yaml: + - `multi_controller_manager_rrbot_1_controllers.yaml `__ + - `multi_controller_manager_rrbot_2_controllers.yaml `__ +* URDF file: `rrbot.urdf.xacro `__ -**NOTE:**when running `ros2 control` CLI commands you have to use additional parameter with exact controller manager node name, e.g., `-c /rrbot_1/controller_manager` or `-c /rrbot_2/controller_manager`. + * Description: `rrbot_description.urdf.xacro `__ + * ``ros2_control`` tag: `rrbot.ros2_control.xacro `__ -`rrbot_1` namespace: -- Command interfaces: - - rrbot_1_joint1/position - - rrbot_1_joint2/position -- State interfaces: - - rrbot_1_joint1/position - - rrbot_1_joint2/position +* RViz configuration: `rrbot.rviz `__ +* Test nodes goals configuration: + + + `rrbot_forward_position_publisher `__ + + `rrbot_joint_trajectory_publisher `__ + +* Hardware interface plugin: `rrbot.cpp `__ -`rrbot_2` namespace: -- Command interfaces: - - rrbot_2_joint1/position - - rrbot_2_joint2/position -- State interfaces: - - rrbot_2_joint1/position - - rrbot_2_joint2/position -Available controllers: (nodes under namespace "/rrbot_1" and "/rrbot_2") -- `forward_position_controller[forward_command_controller/ForwardCommandController]` -- `joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster]` +.. note:: + + When running ``ros2 control`` CLI commands you have to use additional parameter with exact controller manager node name, e.g., ``-c /rrbot_1/controller_manager`` or ``-c /rrbot_2/controller_manager``. + +``rrbot_1`` namespace: + + - Command interfaces: + + - rrbot_1_joint1/position + - rrbot_1_joint2/position + + - State interfaces: + + - rrbot_1_joint1/position + - rrbot_1_joint2/position + +``rrbot_2`` namespace: + + - Command interfaces: + + - rrbot_2_joint1/position + - rrbot_2_joint2/position + + - State interfaces: + + - rrbot_2_joint1/position + - rrbot_2_joint2/position + +Available controllers (nodes under namespace "/rrbot_1" and "/rrbot_2"): + +- ``forward_position_controller[forward_command_controller/ForwardCommandController]`` +- ``joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster]`` List controllers: -``` -ros2 control list_controllers -c /rrbot_1/controller_manager -ros2 control list_controllers -c /rrbot_2/controller_manager -``` - -Commanding the robot using `ForwardCommandController`s (`forward_position_controller`) -``` -ros2 launch ros2_control_demo_bringup test_multi_controller_manager_forward_position_controller.launch.py -``` - -Switch controller to use `position_trajectory_controller`s (`JointTrajectoryController`) - alternatively start main launch file with argument `robot_controller:=position_trajectory_controller`: -``` -ros2 control switch_controllers -c /rrbot_1/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller -ros2 control switch_controllers -c /rrbot_2/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller -``` - -Commanding the robot using `JointTrajectoryController` (`position_trajectory_controller`): -``` -ros2 launch ros2_control_demo_bringup test_multi_controller_manager_joint_trajectory_controller.launch.py -``` + +.. code-block:: shell + + ros2 control list_controllers -c /rrbot_1/controller_manager + ros2 control list_controllers -c /rrbot_2/controller_manager + +Commanding the robot using ``forward_position_controller`` (a ``ForwardCommandController``) + + +.. code-block:: shell + + ros2 launch ros2_control_demo_bringup test_multi_controller_manager_forward_position_controller.launch.py + +Switch controller to use ``position_trajectory_controller`` (a ``JointTrajectoryController``) - alternatively start main launch file with argument ``robot_controller:=position_trajectory_controller``: + + +.. code-block:: shell + + ros2 control switch_controllers -c /rrbot_1/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller + ros2 control switch_controllers -c /rrbot_2/controller_manager --deactivate forward_position_controller --activate position_trajectory_controller + +Commanding the robot using ``position_trajectory_controller`` (a ``JointTrajectoryController``): + +.. code-block:: shell + + ros2 launch ros2_control_demo_bringup test_multi_controller_manager_joint_trajectory_controller.launch.py + +Controllers from this demo +-------------------------- + * ``Joint State Broadcaster`` (`ros2_controllers repository `__): `doc `__ + * ``Forward Command Controller`` (`ros2_controllers repository `__): `doc `__ + * ``Joint Trajectory Controller`` (`ros2_controllers repository `__): `doc `__