-
Notifications
You must be signed in to change notification settings - Fork 299
Add example of starting controllers with launch files #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
christophfroehlich
wants to merge
1
commit into
ros-controls:master
from
christophfroehlich:extend_example1
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
example_1/bringup/launch/joint_trajectory_position_controller.launch.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # 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 | ||
|
|
||
|
|
||
| # we do not need to specify controller_type and params_file if it was loaded already | ||
| def generate_launch_description(): | ||
| return generate_load_controller_launch_description( | ||
| controller_name="joint_trajectory_position_controller", | ||
| controller_type=None, | ||
| controller_params_file=None, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -120,46 +120,62 @@ Tutorial steps | |||||
| ros2 topic echo /dynamic_joint_states | ||||||
|
|
||||||
| 6. Let's switch to a different controller, the ``Joint Trajectory Controller``. | ||||||
| Load the controller manually by | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
| .. note:: | ||||||
|
|
||||||
| ros2 control load_controller joint_trajectory_position_controller | ||||||
| The parameters are already set in `rrbot_controllers.yaml <https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/config/rrbot_controllers.yaml>`__ | ||||||
| but the controller was not loaded from the `launch file rrbot.launch.py <https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/launch/rrbot.launch.py>`__ before. | ||||||
|
|
||||||
| what should return ``Successfully loaded controller joint_trajectory_position_controller``. Check the status | ||||||
| There are different ways to achieve this: | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
| a. Load the controller manually by | ||||||
|
|
||||||
| ros2 control list_controllers | ||||||
| .. code-block:: shell | ||||||
|
|
||||||
| what shows you that the controller is loaded but unconfigured. | ||||||
| ros2 control load_controller joint_trajectory_position_controller | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
| what should return ``Successfully loaded controller joint_trajectory_position_controller``. Check the status | ||||||
|
|
||||||
| joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active | ||||||
| forward_position_controller[forward_command_controller/ForwardCommandController] active | ||||||
| joint_trajectory_position_controller[joint_trajectory_controller/JointTrajectoryController] unconfigured | ||||||
| .. code-block:: shell | ||||||
|
|
||||||
| Configure the controller by setting it ``inactive`` by | ||||||
| ros2 control list_controllers | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
| what shows you that the controller is loaded but unconfigured. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ros2 control set_controller_state joint_trajectory_position_controller inactive | ||||||
| .. code-block:: shell | ||||||
|
|
||||||
| what should give ``Successfully configured joint_trajectory_position_controller``. | ||||||
| joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active | ||||||
| forward_position_controller[forward_command_controller/ForwardCommandController] active | ||||||
| joint_trajectory_position_controller[joint_trajectory_controller/JointTrajectoryController] unconfigured | ||||||
|
|
||||||
| .. note:: | ||||||
| Configure the controller by setting it ``inactive`` by | ||||||
|
|
||||||
| The parameters are already set in `rrbot_controllers.yaml <https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/config/rrbot_controllers.yaml>`__ | ||||||
| but the controller was not loaded from the `launch file rrbot.launch.py <https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/launch/rrbot.launch.py>`__ before. | ||||||
| .. code-block:: shell | ||||||
|
|
||||||
| As an alternative, you can load the controller directly in ``inactive``-state by means of the option for ``load_controller`` | ||||||
| ros2 control set_controller_state joint_trajectory_position_controller inactive | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
| what should give ``Successfully configured joint_trajectory_position_controller``. | ||||||
|
|
||||||
| b. As one alternative, you can load the controller directly in ``inactive``-state by means of the option for ``load_controller`` | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
|
|
||||||
| ros2 control load_controller joint_trajectory_position_controller --set-state inactive | ||||||
|
|
||||||
| which should five the result ``Successfully loaded controller joint_trajectory_position_controller into state inactive``. | ||||||
|
|
||||||
| c. Another alternative is the use of a launch file, see | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
|
|
||||||
| ros2 launch ros2_control_demo_example_1 joint_trajectory_position_controller.launch.py | ||||||
|
|
||||||
| giving the following output (which is not accurate, because the controller was not activated yet) | ||||||
|
|
||||||
| ros2 control load_controller joint_trajectory_position_controller --set-state inactive | ||||||
| .. code-block:: shell | ||||||
|
|
||||||
| You should get the result ``Successfully loaded controller joint_trajectory_position_controller into state inactive``. | ||||||
| [spawner_joint_trajectory_position_controller]: Loaded joint_trajectory_position_controller | ||||||
| [spawner_joint_trajectory_position_controller]: Configured and activated joint_trajectory_position_controller | ||||||
|
|
||||||
| See if it loaded properly with | ||||||
|
|
||||||
|
|
@@ -202,7 +218,7 @@ Tutorial steps | |||||
| forward_position_controller[forward_command_controller/ForwardCommandController] inactive | ||||||
| joint_trajectory_position_controller[joint_trajectory_controller/JointTrajectoryController] active | ||||||
|
|
||||||
| Send a command to the controller using demo node, which sends four goals every 6 seconds in a loop: | ||||||
| Send a command to the controller using the demo node, which sends four goals every 6 seconds in a loop: | ||||||
|
|
||||||
| .. code-block:: shell | ||||||
|
|
||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.