Skip to content

Commit 0662e18

Browse files
[Example 13] Multi-robot system with lifecycle management (#417) (#606)
* Add description for r3bot Co-authored-by: Denis Štogl <[email protected]> Co-authored-by: bailaC <[email protected]> * Remove camera links etc * Initial commit for example_13 from old PRs Co-authored-by: Denis Štogl <[email protected]> Co-authored-by: bailaC <[email protected]> * Change MD to rst syntax * Update test node syntax * Fix test nodes launch file * Enhance docs * Fix wrench config * Use global joint_state_broadcaster * Add tests * FIx links to files * Add some text * Fix dependencies * Add example13 to workflows+packages * Apply suggestions from code review Co-authored-by: Sai Kishor Kothakota <[email protected]> * Update example_13/doc/userdoc.rst Co-authored-by: Sai Kishor Kothakota <[email protected]> * Fix rst syntax * Use new ros2controlcli verb * Add initial version for launch_test * Add a more complete test * Fix whitespaces * Fix decimal numbers Co-authored-by: Sai Kishor Kothakota <[email protected]> * Fix more decimal numbers Co-authored-by: Sai Kishor Kothakota <[email protected]> --------- Co-authored-by: Denis Štogl <[email protected]> Co-authored-by: bailaC <[email protected]> Co-authored-by: Sai Kishor Kothakota <[email protected]> Co-authored-by: Sai Kishor Kothakota <[email protected]> (cherry picked from commit d6e730f) Co-authored-by: Christoph Fröhlich <[email protected]>
1 parent a9cd247 commit 0662e18

19 files changed

+1957
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ The following examples are part of this demo repository:
6666

6767
The example shows a simple chainable controller and its integration to form a controller chain to control the joints of *RRBot*.
6868

69-
* Example 13: "Multi-robot example (tba.)"
69+
* Example 13: ["Multi-robot system with hardware lifecycle management"](example_13)
70+
71+
This example shows how to handle multiple robots in a single controller manager instance.
7072

7173
* Example 14: ["Modular robots with actuators not providing states and with additional sensors"](example_14)
7274

doc/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ Example 11: "CarlikeBot"
7676
Example 12: "Controller chaining"
7777
The example shows a simple chainable controller and its integration to form a controller chain to control the joints of *RRBot*.
7878

79-
Example 13: "Multi-robot example (tba.)"
79+
Example 13: "Multi-robot system with hardware lifecycle management"
80+
This example shows how to handle multiple robots in a single controller manager instance.
8081

8182
Example 14: "Modular robots with actuators not providing states and with additional sensors"
8283
The example shows how to implement robot hardware with actuators not providing states and with additional sensors.
@@ -276,5 +277,6 @@ Examples
276277
Example 10: Industrial robot with GPIO interfaces <../example_10/doc/userdoc.rst>
277278
Example 11: CarlikeBot <../example_11/doc/userdoc.rst>
278279
Example 12: Controller chaining <../example_12/doc/userdoc.rst>
280+
Example 13: Multiple robots <../example_13/doc/userdoc.rst>
279281
Example 14: Modular robots with actuators not providing states <../example_14/doc/userdoc.rst>
280282
Example 15: Using multiple controller managers <../example_15/doc/userdoc.rst>

example_13/CMakeLists.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(ros2_control_demo_example_13 LANGUAGES CXX)
3+
4+
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
5+
add_compile_options(-Wall -Wextra)
6+
endif()
7+
8+
# find dependencies
9+
set(THIS_PACKAGE_INCLUDE_DEPENDS
10+
)
11+
12+
# find dependencies
13+
find_package(ament_cmake REQUIRED)
14+
foreach(Dependency IN ITEMS ${THIS_PACKAGE_INCLUDE_DEPENDS})
15+
find_package(${Dependency} REQUIRED)
16+
endforeach()
17+
18+
# INSTALL
19+
install(
20+
DIRECTORY description/ros2_control description/urdf description/rviz
21+
DESTINATION share/ros2_control_demo_example_13
22+
)
23+
install(
24+
DIRECTORY bringup/launch bringup/config
25+
DESTINATION share/ros2_control_demo_example_13
26+
)
27+
28+
if(BUILD_TESTING)
29+
find_package(ament_cmake_pytest REQUIRED)
30+
31+
ament_add_pytest_test(example_13_urdf_xacro test/test_urdf_xacro.py)
32+
ament_add_pytest_test(view_example_13_launch test/test_view_robot_launch.py)
33+
ament_add_pytest_test(run_example_13_launch test/test_three_robots_launch.py)
34+
endif()
35+
36+
## EXPORTS
37+
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
38+
ament_package()

example_13/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# ros2_control_demo_example_13
2+
3+
This example shows how to handle multiple robots in a single controller manager instance.
4+
5+
Find the documentation in [doc/userdoc.rst](doc/userdoc.rst) or on [control.ros.org](https://control.ros.org/master/doc/ros2_control_demos/example_13/doc/userdoc.html).
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
controller_manager:
2+
ros__parameters:
3+
update_rate: 100 # Hz
4+
5+
hardware_components_initial_state:
6+
unconfigured:
7+
# Decide which hardware component will be only loaded
8+
- FakeThreeDofBot
9+
inactive:
10+
# Decide which hardware component will start configured
11+
- RRBotSystemWithSensor
12+
# not listed hardware component should be started immediately
13+
14+
# Global controllers
15+
joint_state_broadcaster:
16+
type: joint_state_broadcaster/JointStateBroadcaster
17+
18+
# RRBot controllers
19+
rrbot_joint_state_broadcaster:
20+
type: joint_state_broadcaster/JointStateBroadcaster
21+
22+
rrbot_position_controller:
23+
type: forward_command_controller/ForwardCommandController
24+
25+
rrbot_external_fts_broadcaster:
26+
type: force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster
27+
28+
# RRBot with sensor controllers
29+
rrbot_with_sensor_joint_state_broadcaster:
30+
type: joint_state_broadcaster/JointStateBroadcaster
31+
32+
rrbot_with_sensor_position_controller:
33+
type: forward_command_controller/ForwardCommandController
34+
35+
rrbot_with_sensor_fts_broadcaster:
36+
type: force_torque_sensor_broadcaster/ForceTorqueSensorBroadcaster
37+
38+
# ThreeDofBot controllers
39+
threedofbot_joint_state_broadcaster:
40+
type: joint_state_broadcaster/JointStateBroadcaster
41+
42+
threedofbot_position_controller:
43+
type: forward_command_controller/ForwardCommandController
44+
45+
threedofbot_pid_gain_controller:
46+
type: forward_command_controller/ForwardCommandController
47+
48+
# global joint_state_broadcaster
49+
# joint_state_broadcaster:
50+
# ros__parameters:
51+
# nothing to configure
52+
53+
# RRBot controllers
54+
rrbot_joint_state_broadcaster:
55+
ros__parameters:
56+
use_local_topics: True
57+
joints:
58+
- rrbot_joint1
59+
- rrbot_joint2
60+
interfaces:
61+
- position
62+
63+
rrbot_position_controller:
64+
ros__parameters:
65+
joints:
66+
- rrbot_joint1
67+
- rrbot_joint2
68+
interface_name: position
69+
70+
rrbot_external_fts_broadcaster:
71+
ros__parameters:
72+
sensor_name: rrbot_tcp_fts_sensor
73+
frame_id: rrbot_tool_link
74+
75+
76+
# RRBot with sensor controllers
77+
rrbot_with_sensor_joint_state_broadcaster:
78+
ros__parameters:
79+
use_local_topics: True
80+
joints:
81+
- rrbot_with_sensor_joint1
82+
- rrbot_with_sensor_joint2
83+
interfaces:
84+
- position
85+
86+
rrbot_with_sensor_position_controller:
87+
ros__parameters:
88+
joints:
89+
- rrbot_with_sensor_joint1
90+
- rrbot_with_sensor_joint2
91+
interface_name: position
92+
93+
rrbot_with_sensor_fts_broadcaster:
94+
ros__parameters:
95+
interface_names.force.x: rrbot_with_sensor_tcp_fts_sensor/force.x
96+
interface_names.torque.z: rrbot_with_sensor_tcp_fts_sensor/torque.z
97+
frame_id: rrbot_with_sensor_tool_link
98+
99+
# ThreeDofBot controllers
100+
threedofbot_joint_state_broadcaster:
101+
ros__parameters:
102+
use_local_topics: True
103+
joints:
104+
- threedofbot_joint1
105+
- threedofbot_joint2
106+
- threedofbot_joint3
107+
interfaces:
108+
- position
109+
- pid_gain
110+
111+
threedofbot_position_controller:
112+
ros__parameters:
113+
joints:
114+
- threedofbot_joint1
115+
- threedofbot_joint2
116+
- threedofbot_joint3
117+
interface_name: position
118+
119+
threedofbot_pid_gain_controller:
120+
ros__parameters:
121+
joints:
122+
- threedofbot_joint1
123+
- threedofbot_joint2
124+
- threedofbot_joint3
125+
interface_name: pid_gain
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
rrbot_position_command_publisher:
2+
ros__parameters:
3+
4+
publish_topic: "/rrbot_position_controller/commands"
5+
wait_sec_between_publish: 5
6+
7+
goal_names: ["pos1", "pos2", "pos3", "pos4"]
8+
pos1: [0.785, 0.785]
9+
pos2: [0.0, 0.0]
10+
pos3: [-0.785, -0.785]
11+
pos4: [0.0, 0.0]
12+
13+
14+
rrbot_with_sensor_position_command_publisher:
15+
ros__parameters:
16+
17+
publish_topic: "/rrbot_with_sensor_position_controller/commands"
18+
wait_sec_between_publish: 4
19+
20+
goal_names: ["pos1", "pos2", "pos3", "pos4"]
21+
pos1: [0.785, 0.785]
22+
pos2: [0.0, 0.0]
23+
pos3: [-0.785, -0.785]
24+
pos4: [0.0, 0.0]
25+
26+
27+
threedofbot_position_command_publisher:
28+
ros__parameters:
29+
30+
publish_topic: "/threedofbot_position_controller/commands"
31+
wait_sec_between_publish: 3
32+
33+
goal_names: ["pos1", "pos2", "pos3", "pos4"]
34+
pos1: [0.785, 0.785, 0.785]
35+
pos2: [0.0, 0.0, 0.0]
36+
pos3: [-0.785, -0.785, -0.785]
37+
pos4: [0.0, 0.0, 0.0]

0 commit comments

Comments
 (0)