|
| 1 | +# RRBot |
| 2 | + |
| 3 | +**** |
| 4 | + |
| 5 | +**RRBot**, or *Revolute-Revolute Manipulator Robot*, is a simple 3-linkage, 2-joint arm used to demonstrate various features. |
| 6 | + |
| 7 | +It is essentially a double inverted pendulum and demonstrates some control concepts within a simulator. It was originally introduced for Gazebo tutorials. |
| 8 | + |
| 9 | +For *example\_1*, the hardware interface plugin is implemented with only one interface: |
| 10 | + |
| 11 | +* Communication is done using proprietary API to communicate with the robot control box. |
| 12 | +* Data for all joints is exchanged at once. |
| 13 | +* Example: KUKA RSI |
| 14 | + |
| 15 | +The **RRBot** URDF files can be found in the `description/urdf` folder. |
| 16 | + |
| 17 | +## Tutorial Steps |
| 18 | + |
| 19 | +### 0. Prerequisites |
| 20 | + |
| 21 | +Ensure you have the following packages installed: |
| 22 | + |
| 23 | +```sh |
| 24 | +cd |
| 25 | +mkdir -p colcon_control_ws/src |
| 26 | +cd colcon_control_ws/src |
| 27 | +git clone -b demo/tricycle https://github.com/ipa-vsp/ros2_control_demos.git |
| 28 | +cd .. |
| 29 | +rosdep install --from-paths src -iry |
| 30 | +colcon build --symlink-install |
| 31 | +source install/setup.bash |
| 32 | +``` |
| 33 | + |
| 34 | +### 1. Check RRBot Description Launch |
| 35 | + |
| 36 | +(Optional) To verify that RRBot descriptions are working properly, run: |
| 37 | + |
| 38 | +```sh |
| 39 | +ros2 launch ros2_control_demo_example_1 view_robot.launch.py |
| 40 | +``` |
| 41 | + |
| 42 | +In another terminal, launch the GUI: |
| 43 | + |
| 44 | +```sh |
| 45 | +source /opt/ros/${ROS_DISTRO}/setup.bash |
| 46 | +ros2 run joint_state_publisher_gui joint_state_publisher_gui |
| 47 | +``` |
| 48 | + |
| 49 | +Start RViz: |
| 50 | + |
| 51 | +```sh |
| 52 | +source /opt/ros/${ROS_DISTRO}/setup.bash |
| 53 | +rviz2 -d src/ros2_control_demos/ros2_control_demo_description/rrbot/rviz/rrbot.rviz |
| 54 | +``` |
| 55 | + |
| 56 | +> **Note**: Warning `Invalid frame ID "odom" passed to canTransform` is expected. It happens while `joint_state_publisher_gui` is starting. |
| 57 | +
|
| 58 | + |
| 59 | + |
| 60 | +Once working, stop RViz using `CTRL+C`. |
| 61 | + |
| 62 | +### 2. Start RRBot Launch |
| 63 | + |
| 64 | +```sh |
| 65 | +ros2 launch ros2_control_demo_example_1 rrbot.launch.py |
| 66 | +``` |
| 67 | + |
| 68 | +This starts the robot hardware, controllers, and opens RViz. If you see two orange and one yellow rectangle in RViz, it is working. |
| 69 | + |
| 70 | +### 3. Check Hardware Interface |
| 71 | + |
| 72 | +```sh |
| 73 | +ros2 control list_hardware_interfaces |
| 74 | +``` |
| 75 | + |
| 76 | +Expected output: |
| 77 | + |
| 78 | +```sh |
| 79 | +command interfaces |
| 80 | + joint1/position [available] [claimed] |
| 81 | + joint2/position [available] [claimed] |
| 82 | +state interfaces |
| 83 | + joint1/position |
| 84 | + joint2/position |
| 85 | +``` |
| 86 | + |
| 87 | +### 4. Check Running Controllers |
| 88 | + |
| 89 | +```sh |
| 90 | +ros2 control list_controllers |
| 91 | +``` |
| 92 | + |
| 93 | +Expected output: |
| 94 | + |
| 95 | +```sh |
| 96 | +joint_state_broadcaster[joint_state_broadcaster/JointStateBroadcaster] active |
| 97 | +forward_position_controller[forward_command_controller/ForwardCommandController] active |
| 98 | +``` |
| 99 | + |
| 100 | +### 5. Send Commands |
| 101 | + |
| 102 | +**a. Using CLI:** |
| 103 | + |
| 104 | +```sh |
| 105 | +ros2 topic pub /forward_position_controller/commands std_msgs/msg/Float64MultiArray "data: |
| 106 | +- 0.5 |
| 107 | +- 0.5" |
| 108 | +``` |
| 109 | + |
| 110 | +**b. Using Demo Node:** |
| 111 | + |
| 112 | +```sh |
| 113 | +ros2 launch ros2_control_demo_example_1 test_forward_position_controller.launch.py |
| 114 | +``` |
| 115 | + |
| 116 | +You should see motion in RViz and terminal logs like: |
| 117 | + |
| 118 | +```sh |
| 119 | +[INFO] Writing commands: |
| 120 | + 0.50 for joint 'joint2/position' |
| 121 | + 0.50 for joint 'joint1/position' |
| 122 | +``` |
| 123 | + |
| 124 | +To verify joint state outputs: |
| 125 | + |
| 126 | +```sh |
| 127 | +ros2 topic echo /joint_states |
| 128 | +ros2 topic echo /dynamic_joint_states |
| 129 | +``` |
| 130 | + |
| 131 | +### 6. Switch to Joint Trajectory Controller |
| 132 | + |
| 133 | +Load controller: |
| 134 | + |
| 135 | +```sh |
| 136 | +ros2 control load_controller joint_trajectory_position_controller $(ros2 pkg prefix ros2_control_demo_example_1 --share)/config/rrbot_jtc.yaml |
| 137 | +``` |
| 138 | + |
| 139 | +List controllers: |
| 140 | + |
| 141 | +```sh |
| 142 | +ros2 control list_controllers |
| 143 | +``` |
| 144 | + |
| 145 | +Expected: |
| 146 | + |
| 147 | +```sh |
| 148 | +joint_state_broadcaster[...] active |
| 149 | +forward_position_controller[...] active |
| 150 | +joint_trajectory_position_controller[...] unconfigured |
| 151 | +``` |
| 152 | + |
| 153 | +Configure controller: |
| 154 | + |
| 155 | +```sh |
| 156 | +ros2 control set_controller_state joint_trajectory_position_controller inactive |
| 157 | +``` |
| 158 | + |
| 159 | +Alternatively: |
| 160 | + |
| 161 | +```sh |
| 162 | +ros2 control load_controller --set-state inactive joint_trajectory_position_controller $(ros2 pkg prefix ros2_control_demo_example_1 --share)/config/rrbot_jtc.yaml |
| 163 | +``` |
| 164 | + |
| 165 | +Activate controller: |
| 166 | + |
| 167 | +```sh |
| 168 | +ros2 control switch_controllers --activate joint_trajectory_position_controller --deactivate forward_position_controller |
| 169 | +``` |
| 170 | + |
| 171 | +Verify: |
| 172 | + |
| 173 | +```sh |
| 174 | +ros2 control list_controllers |
| 175 | +``` |
| 176 | + |
| 177 | +Should return: |
| 178 | + |
| 179 | +```sh |
| 180 | +joint_state_broadcaster[...] active |
| 181 | +forward_position_controller[...] inactive |
| 182 | +joint_trajectory_position_controller[...] active |
| 183 | +``` |
| 184 | + |
| 185 | +Launch demo node: |
| 186 | + |
| 187 | +```sh |
| 188 | +ros2 launch ros2_control_demo_example_1 test_joint_trajectory_controller.launch.py |
| 189 | +``` |
| 190 | + |
| 191 | +### 7. Use rqt\_joint\_trajectory\_controller GUI |
| 192 | + |
| 193 | +```sh |
| 194 | +ros2 control load_controller joint_trajectory_position_controller $(ros2 pkg prefix ros2_control_demo_example_1 --share)/config/rrbot_jtc.yaml --set-state inactive && ros2 control switch_controllers --activate joint_trajectory_position_controller --deactivate forward_position_controller |
| 195 | +``` |
| 196 | + |
| 197 | +Launch GUI: |
| 198 | + |
| 199 | +```sh |
| 200 | +ros2 run rqt_joint_trajectory_controller rqt_joint_trajectory_controller |
| 201 | +``` |
| 202 | + |
| 203 | +Features: |
| 204 | + |
| 205 | +* Dropdown to select controller |
| 206 | +* Sliders to set joint positions |
| 207 | +* Control execution time |
| 208 | +* Send trajectory commands |
| 209 | + |
| 210 | +## Files Used for This Demo |
| 211 | + |
| 212 | +* **Launch file**: [rrbot.launch.py](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/launch/rrbot.launch.py) |
| 213 | +* **Controllers YAML**: |
| 214 | + |
| 215 | + * [rrbot\_controllers.yaml](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/config/rrbot_controllers.yaml) |
| 216 | + * [rrbot\_jtc.yaml](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/config/rrbot_jtc.yaml) |
| 217 | +* **URDF files**: |
| 218 | + |
| 219 | + * [rrbot.urdf.xacro](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/description/urdf/rrbot.urdf.xacro) |
| 220 | + * [rrbot\_description.urdf.xacro](https://github.com/ros-controls/ros2_control_demos/tree/master/ros2_control_demo_description/rrbot/urdf/rrbot_description.urdf.xacro) |
| 221 | + * [rrbot.ros2\_control.xacro](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/description/ros2_control/rrbot.ros2_control.xacro) |
| 222 | +* **RViz config**: [rrbot.rviz](https://github.com/ros-controls/ros2_control_demos/tree/master/ros2_control_demo_description/rrbot/rviz/rrbot.rviz) |
| 223 | +* **Test configs**: |
| 224 | + |
| 225 | + * [rrbot\_forward\_position\_publisher](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/config/rrbot_forward_position_publisher.yaml) |
| 226 | + * [rrbot\_joint\_trajectory\_publisher](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/bringup/config/rrbot_joint_trajectory_publisher.yaml) |
| 227 | +* **Hardware interface**: [rrbot.cpp](https://github.com/ros-controls/ros2_control_demos/tree/master/example_1/hardware/rrbot.cpp) |
| 228 | + |
| 229 | +## Controllers in This Demo |
| 230 | + |
| 231 | +* **Joint State Broadcaster** ([docs](https://github.com/ros-controls/ros2_controllers/tree/master/joint_state_broadcaster)) |
| 232 | +* **Forward Command Controller** ([docs](https://github.com/ros-controls/ros2_controllers/tree/master/forward_command_controller)) |
| 233 | +* **Joint Trajectory Controller** ([docs](https://github.com/ros-controls/ros2_controllers/tree/master/joint_trajectory_controller)) |
0 commit comments