|
| 1 | +*********************************************************************** |
| 2 | +Example 6: Modular Robots with separate communication to each actuator |
| 3 | +*********************************************************************** |
| 4 | + |
| 5 | +The example shows how to implement robot hardware with separate communication to each actuator. This |
| 6 | +is implemented with a hardware interface of type ``hardware_interface::ActuatorInterface``. |
| 7 | + |
| 8 | +1. To check that *RRBot* descriptions are working properly use following launch commands |
| 9 | + |
| 10 | + .. code-block:: shell |
| 11 | +
|
| 12 | + ros2 launch ros2_control_demo_example_6 view_robot.launch.py |
| 13 | +
|
| 14 | + **NOTE**: Getting the following output in terminal is OK: ``Warning: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist``. |
| 15 | + This happens because ``joint_state_publisher_gui`` node need some time to start. |
| 16 | + The ``joint_state_publisher_gui`` provides a GUI to generate a random configuration for rrbot. It is immediately displayed in *RViz*. |
| 17 | + |
| 18 | + |
| 19 | +2. To start *RRBot* example open a terminal, source your ROS2-workspace and execute its launch file with |
| 20 | + |
| 21 | + .. code-block:: shell |
| 22 | +
|
| 23 | + ros2 launch ros2_control_demo_example_6 rrbot.launch.py |
| 24 | +
|
| 25 | + The launch file loads and starts the robot hardware, controllers and opens *RViz*. |
| 26 | + In starting terminal you will see a lot of output from the hardware implementation showing its internal states. |
| 27 | + This is only of exemplary purposes and should be avoided as much as possible in a hardware interface implementation. |
| 28 | + |
| 29 | + If you can see two orange and one yellow rectangle in in *RViz* everything has started properly. |
| 30 | + Still, to be sure, let's introspect the control system before moving *RRBot*. |
| 31 | + |
| 32 | +3. Check if the hardware interface loaded properly, by opening another terminal and executing |
| 33 | + |
| 34 | + .. code-block:: shell |
| 35 | +
|
| 36 | + ros2 control list_hardware_interfaces |
| 37 | +
|
| 38 | + .. code-block:: shell |
| 39 | +
|
| 40 | + command interfaces |
| 41 | + joint1/position [available] [claimed] |
| 42 | + joint2/position [available] [claimed] |
| 43 | + state interfaces |
| 44 | + joint1/position |
| 45 | + joint2/position |
| 46 | +
|
| 47 | + Marker ``[claimed]`` by command interfaces means that a controller has access to command *RRBot*. |
| 48 | + |
| 49 | +4. Check is controllers are running |
| 50 | + |
| 51 | + .. code-block:: shell |
| 52 | +
|
| 53 | + ros2 control list_controllers |
| 54 | +
|
| 55 | + .. code-block:: shell |
| 56 | +
|
| 57 | + forward_position_controller[forward_command_controller/ForwardCommandController] |
| 58 | + joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] |
| 59 | +
|
| 60 | +5. If you get output from above you can send commands to *Forward Command Controller*, either: |
| 61 | + |
| 62 | + #. Manually using ros2 cli interface. |
| 63 | + |
| 64 | + .. code-block:: shell |
| 65 | +
|
| 66 | + ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray "data: |
| 67 | + - 0.5 |
| 68 | + - 0.5" |
| 69 | +
|
| 70 | + #. Or you can start a demo node which sends two goals every 5 seconds in a loop |
| 71 | + |
| 72 | + .. code-block:: shell |
| 73 | +
|
| 74 | + ros2 launch ros2_control_demo_example_6 test_forward_position_controller.launch.py |
| 75 | +
|
| 76 | + You should now see orange and yellow blocks moving in *RViz*. |
| 77 | + Also, you should see changing states in the terminal where launch file is started, e.g. |
| 78 | + |
| 79 | + .. code-block:: shell |
| 80 | +
|
| 81 | + [RRBotModularJoint]: Writing...please wait... |
| 82 | + [RRBotModularJoint]: Got command 0.50000 for joint 'joint1'! |
| 83 | + [RRBotModularJoint]: Joints successfully written! |
| 84 | + [RRBotModularJoint]: Writing...please wait... |
| 85 | + [RRBotModularJoint]: Got command 0.50000 for joint 'joint2'! |
| 86 | + [RRBotModularJoint]: Joints successfully written! |
| 87 | +
|
| 88 | +
|
| 89 | +Files used for this demos |
| 90 | +######################### |
| 91 | + |
| 92 | +- Launch file: `rrbot_modular_actuators.launch.py <https://github.com/ros-controls/ros2_control_demos/example_6/bringup/launch/rrbot_modular_actuators.launch.py>`__ |
| 93 | +- Controllers yaml: `rrbot_modular_actuators.yaml <https://github.com/ros-controls/ros2_control_demos/example_6/bringup/config/rrbot_modular_actuators.yaml>`__ |
| 94 | +- URDF: `rrbot_modular_actuators.urdf.xacro <https://github.com/ros-controls/ros2_control_demos/example_6/description/urdf/rrbot_modular_actuators.urdf.xacro>`__ |
| 95 | + |
| 96 | + + ``ros2_control`` URDF tag: `rrbot_modular_actuators.ros2_control.xacro <https://github.com/ros-controls/ros2_control_demos/example_6/description/ros2_control/rrbot_modular_actuators.ros2_control.xacro>`__ |
| 97 | + |
| 98 | +- RViz configuration: `rrbot.rviz <https://github.com/ros-controls/ros2_control_demos/example_6/description/rviz/rrbot.rviz>`__ |
| 99 | + |
| 100 | +- Hardware interface plugin: `rrbot_modular_actuators.cpp <https://github.com/ros-controls/ros2_control_demos/example_6/hardware/rrbot_modular_actuators.cpp>`__ |
| 101 | + |
| 102 | +Controllers from this demo |
| 103 | +########################## |
| 104 | +- ``Joint State Broadcaster`` (`ros2_controllers repository <https://github.com/ros-controls/ros2_controllers>`__): `doc <https://control.ros.org/master/doc/ros2_controllers/joint_state_broadcaster/doc/userdoc.html>`__ |
| 105 | +- ``Forward Command Controller`` (`ros2_controllers repository <https://github.com/ros-controls/ros2_controllers>`__): `doc <https://control.ros.org/master/doc/ros2_controllers/forward_command_controller/doc/userdoc.html>`__ |
0 commit comments