Skip to content

Commit 5c714dd

Browse files
committed
Fix launch
Signed-off-by: Yadunund <[email protected]>
1 parent 541083e commit 5c714dd

File tree

11 files changed

+446
-187
lines changed

11 files changed

+446
-187
lines changed

nexus_integration_tests/config/office/tinyRobot_config.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.
4.87 KB
Loading

nexus_integration_tests/config/rmf_bts/transportation.xml renamed to nexus_integration_tests/config/rmf/transportation.xml

File renamed without changes.

nexus_integration_tests/launch/depot.launch.xml

Lines changed: 0 additions & 41 deletions
This file was deleted.

nexus_integration_tests/launch/control_center.launch.py renamed to nexus_integration_tests/launch/inter_workcell.launch.py

Lines changed: 79 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def activate_node(target_node: LifecycleNode, depend_node: LifecycleNode = None)
106106

107107
def launch_setup(context, *args, **kwargs):
108108
ros_domain_id = LaunchConfiguration("ros_domain_id")
109+
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
110+
use_rmf_transporter = LaunchConfiguration("use_rmf_transporter")
109111
use_zenoh_bridge = LaunchConfiguration("use_zenoh_bridge")
110112
zenoh_config_package = LaunchConfiguration("zenoh_config_package")
111113
zenoh_config_filename = LaunchConfiguration("zenoh_config_filename")
@@ -115,8 +117,11 @@ def launch_setup(context, *args, **kwargs):
115117
main_bt_filename = LaunchConfiguration("main_bt_filename")
116118
remap_task_types = LaunchConfiguration("remap_task_types")
117119

120+
rviz_config_filename = "nexus_panel.rviz"
121+
if (use_rmf_transporter.perform(context).lower() == "true"):
122+
rviz_config_filename = "nexus_panel_rmf.rviz"
118123
nexus_panel_rviz_path = os.path.join(
119-
get_package_share_directory("nexus_integration_tests"), "rviz", "nexus_panel.rviz"
124+
get_package_share_directory("nexus_integration_tests"), "rviz", rviz_config_filename
120125
)
121126

122127
system_orchestrator_node = LifecycleNode(
@@ -137,6 +142,27 @@ def launch_setup(context, *args, **kwargs):
137142
],
138143
)
139144

145+
rmf_transporter = GroupAction(
146+
actions=[
147+
IncludeLaunchDescription(
148+
[
149+
PathJoinSubstitution(
150+
[
151+
FindPackageShare("nexus_integration_tests"),
152+
"launch",
153+
"rmf_transporter.launch.xml",
154+
]
155+
)
156+
],
157+
launch_arguments={
158+
"use_simulator": use_fake_hardware,
159+
"headless": headless,
160+
}.items(),
161+
condition=IfCondition(use_rmf_transporter),
162+
)
163+
],
164+
)
165+
140166
transporter_node = LifecycleNode(
141167
namespace="",
142168
package="nexus_transporter",
@@ -149,6 +175,14 @@ def launch_setup(context, *args, **kwargs):
149175
{"speed": 1.0},
150176
{"unloading_station": "unloading"},
151177
],
178+
condition=UnlessCondition(use_rmf_transporter),
179+
)
180+
181+
activate_transporter_node = GroupAction(
182+
[
183+
activate_node(transporter_node),
184+
],
185+
condition=UnlessCondition(use_rmf_transporter),
152186
)
153187

154188
mock_emergency_alarm_node = LifecycleNode(
@@ -166,40 +200,45 @@ def launch_setup(context, *args, **kwargs):
166200
condition=UnlessCondition(headless),
167201
)
168202

203+
zenoh_bridge = GroupAction(
204+
[
205+
IncludeLaunchDescription(
206+
[
207+
PathJoinSubstitution(
208+
[
209+
FindPackageShare("nexus_integration_tests"),
210+
"launch",
211+
"zenoh_bridge.launch.py",
212+
]
213+
)
214+
],
215+
launch_arguments={
216+
"zenoh_config_package": zenoh_config_package,
217+
"zenoh_config_filename": zenoh_config_filename,
218+
"ros_domain_id": ros_domain_id.perform(context),
219+
}.items(),
220+
)
221+
],
222+
condition=IfCondition(use_zenoh_bridge),
223+
)
224+
225+
activate_system_orchestrator = GroupAction(
226+
[
227+
activate_node(system_orchestrator_node),
228+
],
229+
condition=IfCondition(activate_system_orchestrator),
230+
)
231+
169232
return [
170233
SetEnvironmentVariable("ROS_DOMAIN_ID", ros_domain_id),
171234
system_orchestrator_node,
235+
rmf_transporter,
172236
transporter_node,
173237
mock_emergency_alarm_node,
174238
nexus_panel,
175-
GroupAction(
176-
[
177-
IncludeLaunchDescription(
178-
[
179-
PathJoinSubstitution(
180-
[
181-
FindPackageShare("nexus_integration_tests"),
182-
"launch",
183-
"zenoh_bridge.launch.py",
184-
]
185-
)
186-
],
187-
launch_arguments={
188-
"zenoh_config_package": zenoh_config_package,
189-
"zenoh_config_filename": zenoh_config_filename,
190-
"ros_domain_id": ros_domain_id.perform(context),
191-
}.items(),
192-
)
193-
],
194-
condition=IfCondition(use_zenoh_bridge),
195-
),
196-
GroupAction(
197-
[
198-
activate_node(system_orchestrator_node),
199-
],
200-
condition=IfCondition(activate_system_orchestrator),
201-
),
202-
activate_node(transporter_node),
239+
zenoh_bridge,
240+
activate_system_orchestrator,
241+
activate_transporter_node,
203242
activate_node(mock_emergency_alarm_node),
204243
]
205244

@@ -213,6 +252,17 @@ def generate_launch_description():
213252
default_value="0",
214253
description="ROS_DOMAIN_ID environment variable",
215254
),
255+
DeclareLaunchArgument(
256+
"use_fake_hardware",
257+
default_value="true",
258+
description="Set True if running with real hardware.",
259+
),
260+
DeclareLaunchArgument(
261+
"use_rmf_transporter",
262+
default_value="false",
263+
description="Set true to rely on an Open-RMF managed fleet to transport material\
264+
between workcells.",
265+
),
216266
DeclareLaunchArgument(
217267
"use_zenoh_bridge",
218268
default_value="true",

nexus_integration_tests/launch/launch.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,31 @@ def launch_setup(context, *args, **kwargs):
4141
exit(1)
4242

4343
headless = LaunchConfiguration("headless")
44+
use_rmf_transporter = LaunchConfiguration("use_rmf_transporter")
4445
use_zenoh_bridge = LaunchConfiguration("use_zenoh_bridge")
4546
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
4647
robot1_ip = LaunchConfiguration("robot1_ip")
4748
robot2_ip = LaunchConfiguration("robot2_ip")
4849
run_workcell_1 = LaunchConfiguration("run_workcell_1")
4950
run_workcell_2 = LaunchConfiguration("run_workcell_2")
5051

51-
control_center_domain_id = 0
52+
inter_workcell_domain_id = 0
5253
workcell_1_domain_id = 0
5354
workcell_2_domain_id = 0
5455
log_msg = ""
5556

5657
if "ROS_DOMAIN_ID" in os.environ:
57-
control_center_domain_id = int(os.environ["ROS_DOMAIN_ID"])
58-
if not 0 < control_center_domain_id < 230:
58+
inter_workcell_domain_id = int(os.environ["ROS_DOMAIN_ID"])
59+
if not 0 < inter_workcell_domain_id < 230:
5960
log_msg += (
6061
"ROS_DOMAIN_ID not within the range of 0 to 230, setting it to 0. \n"
6162
)
62-
control_center_domain_id = 0
63+
inter_workcell_domain_id = 0
6364

6465
if use_zenoh_bridge.perform(context).lower() == "true":
6566
log_msg += "Using the zenoh bridge\n"
66-
workcell_1_domain_id = control_center_domain_id + 1
67-
workcell_2_domain_id = control_center_domain_id + 2
67+
workcell_1_domain_id = inter_workcell_domain_id + 1
68+
workcell_2_domain_id = inter_workcell_domain_id + 2
6869
else:
6970
log_msg += "Not using zenoh bridge\n"
7071
if (
@@ -73,33 +74,40 @@ def launch_setup(context, *args, **kwargs):
7374
):
7475
print("To run both workcells, enable the Zenoh Bridge")
7576
sys.exit(1)
76-
workcell_1_domain_id = control_center_domain_id
77-
workcell_2_domain_id = control_center_domain_id
78-
log_msg += f"Control Center has ROS_DOMAIN_ID {control_center_domain_id}\n"
77+
workcell_1_domain_id = inter_workcell_domain_id
78+
workcell_2_domain_id = inter_workcell_domain_id
79+
log_msg += f"Inter-workcell has ROS_DOMAIN_ID {inter_workcell_domain_id}\n"
7980
if run_workcell_1.perform(context).lower() == "true":
8081
log_msg += f"Workcell 1 has ROS_DOMAIN_ID {workcell_1_domain_id}\n"
8182
if run_workcell_2.perform(context).lower() == "true":
8283
log_msg += f"Workcell 2 has ROS_DOMAIN_ID {workcell_2_domain_id}\n"
8384

84-
launch_control_center = GroupAction(
85+
main_bt_filename = "main.xml"
86+
if (use_rmf_transporter.perform(context).lower() == "true"):
87+
main_bt_filename = "main_rmf.xml"
88+
log_msg += f"System Orchestrator will load : {main_bt_filename}\n"
89+
90+
launch_inter_workcell = GroupAction(
8591
actions=[
8692
IncludeLaunchDescription(
8793
[
8894
PathJoinSubstitution(
8995
[
9096
FindPackageShare("nexus_integration_tests"),
9197
"launch",
92-
"control_center.launch.py",
98+
"inter_workcell.launch.py",
9399
]
94100
)
95101
],
96102
launch_arguments={
97-
"ros_domain_id": str(control_center_domain_id),
103+
"ros_domain_id": str(inter_workcell_domain_id),
98104
"zenoh_config_package": "nexus_integration_tests",
99105
"zenoh_config_filename": "config/zenoh/system_orchestrator.json5",
106+
"use_rmf_transporter": use_rmf_transporter,
100107
"transporter_plugin": "nexus_transporter::MockTransporter",
101108
"activate_system_orchestrator": headless,
102109
"headless": headless,
110+
"main_bt_filename": main_bt_filename,
103111
}.items(),
104112
),
105113
],
@@ -193,7 +201,7 @@ def launch_setup(context, *args, **kwargs):
193201

194202
return [
195203
LogInfo(msg=log_msg),
196-
launch_control_center,
204+
launch_inter_workcell,
197205
launch_workcell_1,
198206
launch_workcell_2,
199207
]
@@ -207,6 +215,12 @@ def generate_launch_description():
207215
default_value="true",
208216
description="Launch in headless mode (no gui)",
209217
),
218+
DeclareLaunchArgument(
219+
"use_rmf_transporter",
220+
default_value="false",
221+
description="Set true to rely on an Open-RMF managed fleet to transport material\
222+
between workcells.",
223+
),
210224
DeclareLaunchArgument(
211225
"use_zenoh_bridge",
212226
default_value="true",

nexus_integration_tests/launch/rmf/common.launch.xml

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)