Skip to content

Commit

Permalink
Fix launch
Browse files Browse the repository at this point in the history
Signed-off-by: Yadunund <yadunund@gmail.com>
  • Loading branch information
Yadunund committed Jan 18, 2025
1 parent 541083e commit 5c714dd
Show file tree
Hide file tree
Showing 11 changed files with 446 additions and 187 deletions.
48 changes: 0 additions & 48 deletions nexus_integration_tests/config/office/tinyRobot_config.yaml

This file was deleted.

Binary file added nexus_integration_tests/config/rmf/depot_scan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 0 additions & 41 deletions nexus_integration_tests/launch/depot.launch.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def activate_node(target_node: LifecycleNode, depend_node: LifecycleNode = None)

def launch_setup(context, *args, **kwargs):
ros_domain_id = LaunchConfiguration("ros_domain_id")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
use_rmf_transporter = LaunchConfiguration("use_rmf_transporter")
use_zenoh_bridge = LaunchConfiguration("use_zenoh_bridge")
zenoh_config_package = LaunchConfiguration("zenoh_config_package")
zenoh_config_filename = LaunchConfiguration("zenoh_config_filename")
Expand All @@ -115,8 +117,11 @@ def launch_setup(context, *args, **kwargs):
main_bt_filename = LaunchConfiguration("main_bt_filename")
remap_task_types = LaunchConfiguration("remap_task_types")

rviz_config_filename = "nexus_panel.rviz"
if (use_rmf_transporter.perform(context).lower() == "true"):
rviz_config_filename = "nexus_panel_rmf.rviz"
nexus_panel_rviz_path = os.path.join(
get_package_share_directory("nexus_integration_tests"), "rviz", "nexus_panel.rviz"
get_package_share_directory("nexus_integration_tests"), "rviz", rviz_config_filename
)

system_orchestrator_node = LifecycleNode(
Expand All @@ -137,6 +142,27 @@ def launch_setup(context, *args, **kwargs):
],
)

rmf_transporter = GroupAction(
actions=[
IncludeLaunchDescription(
[
PathJoinSubstitution(
[
FindPackageShare("nexus_integration_tests"),
"launch",
"rmf_transporter.launch.xml",
]
)
],
launch_arguments={
"use_simulator": use_fake_hardware,
"headless": headless,
}.items(),
condition=IfCondition(use_rmf_transporter),
)
],
)

transporter_node = LifecycleNode(
namespace="",
package="nexus_transporter",
Expand All @@ -149,6 +175,14 @@ def launch_setup(context, *args, **kwargs):
{"speed": 1.0},
{"unloading_station": "unloading"},
],
condition=UnlessCondition(use_rmf_transporter),
)

activate_transporter_node = GroupAction(
[
activate_node(transporter_node),
],
condition=UnlessCondition(use_rmf_transporter),
)

mock_emergency_alarm_node = LifecycleNode(
Expand All @@ -166,40 +200,45 @@ def launch_setup(context, *args, **kwargs):
condition=UnlessCondition(headless),
)

zenoh_bridge = GroupAction(
[
IncludeLaunchDescription(
[
PathJoinSubstitution(
[
FindPackageShare("nexus_integration_tests"),
"launch",
"zenoh_bridge.launch.py",
]
)
],
launch_arguments={
"zenoh_config_package": zenoh_config_package,
"zenoh_config_filename": zenoh_config_filename,
"ros_domain_id": ros_domain_id.perform(context),
}.items(),
)
],
condition=IfCondition(use_zenoh_bridge),
)

activate_system_orchestrator = GroupAction(
[
activate_node(system_orchestrator_node),
],
condition=IfCondition(activate_system_orchestrator),
)

return [
SetEnvironmentVariable("ROS_DOMAIN_ID", ros_domain_id),
system_orchestrator_node,
rmf_transporter,
transporter_node,
mock_emergency_alarm_node,
nexus_panel,
GroupAction(
[
IncludeLaunchDescription(
[
PathJoinSubstitution(
[
FindPackageShare("nexus_integration_tests"),
"launch",
"zenoh_bridge.launch.py",
]
)
],
launch_arguments={
"zenoh_config_package": zenoh_config_package,
"zenoh_config_filename": zenoh_config_filename,
"ros_domain_id": ros_domain_id.perform(context),
}.items(),
)
],
condition=IfCondition(use_zenoh_bridge),
),
GroupAction(
[
activate_node(system_orchestrator_node),
],
condition=IfCondition(activate_system_orchestrator),
),
activate_node(transporter_node),
zenoh_bridge,
activate_system_orchestrator,
activate_transporter_node,
activate_node(mock_emergency_alarm_node),
]

Expand All @@ -213,6 +252,17 @@ def generate_launch_description():
default_value="0",
description="ROS_DOMAIN_ID environment variable",
),
DeclareLaunchArgument(
"use_fake_hardware",
default_value="true",
description="Set True if running with real hardware.",
),
DeclareLaunchArgument(
"use_rmf_transporter",
default_value="false",
description="Set true to rely on an Open-RMF managed fleet to transport material\
between workcells.",
),
DeclareLaunchArgument(
"use_zenoh_bridge",
default_value="true",
Expand Down
40 changes: 27 additions & 13 deletions nexus_integration_tests/launch/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,31 @@ def launch_setup(context, *args, **kwargs):
exit(1)

headless = LaunchConfiguration("headless")
use_rmf_transporter = LaunchConfiguration("use_rmf_transporter")
use_zenoh_bridge = LaunchConfiguration("use_zenoh_bridge")
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
robot1_ip = LaunchConfiguration("robot1_ip")
robot2_ip = LaunchConfiguration("robot2_ip")
run_workcell_1 = LaunchConfiguration("run_workcell_1")
run_workcell_2 = LaunchConfiguration("run_workcell_2")

control_center_domain_id = 0
inter_workcell_domain_id = 0
workcell_1_domain_id = 0
workcell_2_domain_id = 0
log_msg = ""

if "ROS_DOMAIN_ID" in os.environ:
control_center_domain_id = int(os.environ["ROS_DOMAIN_ID"])
if not 0 < control_center_domain_id < 230:
inter_workcell_domain_id = int(os.environ["ROS_DOMAIN_ID"])
if not 0 < inter_workcell_domain_id < 230:
log_msg += (
"ROS_DOMAIN_ID not within the range of 0 to 230, setting it to 0. \n"
)
control_center_domain_id = 0
inter_workcell_domain_id = 0

if use_zenoh_bridge.perform(context).lower() == "true":
log_msg += "Using the zenoh bridge\n"
workcell_1_domain_id = control_center_domain_id + 1
workcell_2_domain_id = control_center_domain_id + 2
workcell_1_domain_id = inter_workcell_domain_id + 1
workcell_2_domain_id = inter_workcell_domain_id + 2
else:
log_msg += "Not using zenoh bridge\n"
if (
Expand All @@ -73,33 +74,40 @@ def launch_setup(context, *args, **kwargs):
):
print("To run both workcells, enable the Zenoh Bridge")
sys.exit(1)
workcell_1_domain_id = control_center_domain_id
workcell_2_domain_id = control_center_domain_id
log_msg += f"Control Center has ROS_DOMAIN_ID {control_center_domain_id}\n"
workcell_1_domain_id = inter_workcell_domain_id
workcell_2_domain_id = inter_workcell_domain_id
log_msg += f"Inter-workcell has ROS_DOMAIN_ID {inter_workcell_domain_id}\n"
if run_workcell_1.perform(context).lower() == "true":
log_msg += f"Workcell 1 has ROS_DOMAIN_ID {workcell_1_domain_id}\n"
if run_workcell_2.perform(context).lower() == "true":
log_msg += f"Workcell 2 has ROS_DOMAIN_ID {workcell_2_domain_id}\n"

launch_control_center = GroupAction(
main_bt_filename = "main.xml"
if (use_rmf_transporter.perform(context).lower() == "true"):
main_bt_filename = "main_rmf.xml"
log_msg += f"System Orchestrator will load : {main_bt_filename}\n"

launch_inter_workcell = GroupAction(
actions=[
IncludeLaunchDescription(
[
PathJoinSubstitution(
[
FindPackageShare("nexus_integration_tests"),
"launch",
"control_center.launch.py",
"inter_workcell.launch.py",
]
)
],
launch_arguments={
"ros_domain_id": str(control_center_domain_id),
"ros_domain_id": str(inter_workcell_domain_id),
"zenoh_config_package": "nexus_integration_tests",
"zenoh_config_filename": "config/zenoh/system_orchestrator.json5",
"use_rmf_transporter": use_rmf_transporter,
"transporter_plugin": "nexus_transporter::MockTransporter",
"activate_system_orchestrator": headless,
"headless": headless,
"main_bt_filename": main_bt_filename,
}.items(),
),
],
Expand Down Expand Up @@ -193,7 +201,7 @@ def launch_setup(context, *args, **kwargs):

return [
LogInfo(msg=log_msg),
launch_control_center,
launch_inter_workcell,
launch_workcell_1,
launch_workcell_2,
]
Expand All @@ -207,6 +215,12 @@ def generate_launch_description():
default_value="true",
description="Launch in headless mode (no gui)",
),
DeclareLaunchArgument(
"use_rmf_transporter",
default_value="false",
description="Set true to rely on an Open-RMF managed fleet to transport material\
between workcells.",
),
DeclareLaunchArgument(
"use_zenoh_bridge",
default_value="true",
Expand Down
37 changes: 0 additions & 37 deletions nexus_integration_tests/launch/rmf/common.launch.xml

This file was deleted.

Loading

0 comments on commit 5c714dd

Please sign in to comment.