diff --git a/README.md b/README.md index 29adba35b..2f37c321c 100644 --- a/README.md +++ b/README.md @@ -89,28 +89,35 @@ Each of the described example cases from the roadmap has its own launch and URDF joint2/position ``` -3. Open another terminal and load, configure, and start controllers: - ``` - ros2 control load_start_controller joint_state_controller - ros2 control load_configure_controller forward_command_controller_position - ``` - - Check if the controller is loaded properly: - ``` - ros2 control list_controllers - ``` - You should get the response: - ``` - joint_state_controller[joint_state_controller/JointStateController] active - forward_command_controller_position[forward_command_controller/ForwardCommandController] inactive - ``` - -4. Starting controller: - ``` - ros2 control switch_controllers --start-controllers forward_command_controller_position - ``` - - Check if controllers are activated: +3. Open another terminal and load, configure and start controllers: + - Using the provided launch file: + ``` + ros2 launch ros2_control_demo_robot joint_state_controller.launch.py + ros2 launch ros2_control_demo_robot forward_command_controller_position.launch.py + ``` + +- Using `ros2 control` cli interface: + ``` + ros2 control load_start_controller joint_state_controller + ros2 control load_configure_controller forward_command_controller_position + ``` + + Check if the controller is loaded properly: + ``` + ros2 control list_controllers + ``` + You should get the response: + ``` + joint_state_controller[joint_state_controller/JointStateController] active + forward_command_controller_position[forward_command_controller/ForwardCommandController] inactive + ``` + + Starting controller: + ``` + ros2 control switch_controllers --start-controllers forward_command_controller_position + ``` + +4. Check if controllers are activated: ``` ros2 control list_controllers ``` diff --git a/ros2_control_demo_robot/launch/forward_command_controller_position.launch.py b/ros2_control_demo_robot/launch/forward_command_controller_position.launch.py new file mode 100644 index 000000000..67fbd62db --- /dev/null +++ b/ros2_control_demo_robot/launch/forward_command_controller_position.launch.py @@ -0,0 +1,22 @@ +# Copyright (c) 2021 PAL Robotics S.L. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from controller_manager.launch_utils import generate_load_controller_launch_description + + +def generate_launch_description(): + return generate_load_controller_launch_description( + controller_name='forward_command_controller_position', + controller_type=None, + controller_params_file=None) diff --git a/ros2_control_demo_robot/launch/joint_state_controller.launch.py b/ros2_control_demo_robot/launch/joint_state_controller.launch.py new file mode 100644 index 000000000..f90b3070c --- /dev/null +++ b/ros2_control_demo_robot/launch/joint_state_controller.launch.py @@ -0,0 +1,22 @@ +# Copyright (c) 2021 PAL Robotics S.L. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from controller_manager.launch_utils import generate_load_controller_launch_description + + +def generate_launch_description(): + return generate_load_controller_launch_description( + controller_name='joint_state_controller', + controller_type=None, + controller_params_file=None) diff --git a/ros2_control_demo_robot/package.xml b/ros2_control_demo_robot/package.xml index b0c761395..75192a3fc 100644 --- a/ros2_control_demo_robot/package.xml +++ b/ros2_control_demo_robot/package.xml @@ -17,6 +17,8 @@ ros2_control_demo_hardware + controller_manager + ament_cmake_gtest