Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
)
62 changes: 39 additions & 23 deletions example_1/doc/userdoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
what should return ``Successfully loaded controller joint_trajectory_position_controller``. Check the status
what should return ``Successfully loaded controller joint_trajectory_position_controller``.
Then check controllers' 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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
what shows you that the controller is loaded but unconfigured.
what shows you that the controller is loaded but unconfigured. Similar output is expected:


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

Expand Down Expand Up @@ -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

Expand Down