From 2bd87009d45cbe202ce7f6c219347bba0df2d5c0 Mon Sep 17 00:00:00 2001 From: ConnorN Date: Tue, 7 Oct 2025 11:20:05 -0400 Subject: [PATCH] feat: add bringup support for container launcher --- setup/start_rover.sh | 11 ++++--- src/Bringup/launch/arm.launch.py | 1 - src/Bringup/launch/arm_tasks.launch.py | 30 ------------------- src/Bringup/launch/basic_drive.launch.py | 27 ----------------- src/Bringup/launch/core.launch.py | 15 +++++++--- src/Bringup/launch/localization.launch.py | 30 ------------------- src/Bringup/launch/navigation.launch.py | 35 ----------------------- src/Bringup/launch/science.launch.py | 30 ------------------- src/Bringup/package.xml | 1 + 9 files changed, 19 insertions(+), 161 deletions(-) delete mode 100644 src/Bringup/launch/arm_tasks.launch.py delete mode 100644 src/Bringup/launch/basic_drive.launch.py delete mode 100644 src/Bringup/launch/localization.launch.py delete mode 100644 src/Bringup/launch/navigation.launch.py delete mode 100644 src/Bringup/launch/science.launch.py diff --git a/setup/start_rover.sh b/setup/start_rover.sh index bdf37417..c9fbd2a7 100755 --- a/setup/start_rover.sh +++ b/setup/start_rover.sh @@ -1,6 +1,9 @@ #!/bin/bash -source ~/gstreamer/setupGstreamer.sh -source /opt/ros/humble/setup.bash -source /opt/ros/humble/cprt_setup.bash sudo enablecan.sh -ros2 launch rosbridge_server rosbridge_websocket_launch.xml \ No newline at end of file + +echo "Starting the container launcher..." + +docker run --rm \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -p 8080:8080 \ + cprtsoftware/container-launcher:latest \ No newline at end of file diff --git a/src/Bringup/launch/arm.launch.py b/src/Bringup/launch/arm.launch.py index 26ffa88b..aca9e1da 100644 --- a/src/Bringup/launch/arm.launch.py +++ b/src/Bringup/launch/arm.launch.py @@ -20,6 +20,5 @@ def generate_launch_description(): SetEnvironmentVariable("ROS_LOG_LEVEL", "WARN") launch_files = [ ("arm_srdf", "servo.launch.py"), - ("arm_srdf", "talon.launch.py"), ] return LaunchDescription(get_included_launch_descriptions(launch_files)) diff --git a/src/Bringup/launch/arm_tasks.launch.py b/src/Bringup/launch/arm_tasks.launch.py deleted file mode 100644 index 7cb9d05c..00000000 --- a/src/Bringup/launch/arm_tasks.launch.py +++ /dev/null @@ -1,30 +0,0 @@ -from launch import LaunchDescription -from launch_ros.substitutions import FindPackageShare -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable -import os - - -def get_included_launch_descriptions(launch_files): - included_launches = [] - for pkg, file in launch_files: - pkg_share = FindPackageShare(pkg).find(pkg) - file_path = os.path.join(pkg_share, "launch", file) - included_launches.append( - IncludeLaunchDescription(PythonLaunchDescriptionSource(file_path)) - ) - return included_launches - - -def generate_launch_description(): - SetEnvironmentVariable("ROS_LOG_LEVEL", "warn"), - launch_files = [ - ("drive_cpp", "talon.launch.py"), - ("arm_srdf", "servo.launch.py"), - ("arm_srdf", "talon.launch.py"), - ("camera_streaming", "webRTC.launch.py"), - ("gps", "rover.launch.py"), - ("joystick_control", "controller.launch.py"), - ("servo_pkg", "usb_servo_launch.launch.py"), - ] - return LaunchDescription(get_included_launch_descriptions(launch_files)) diff --git a/src/Bringup/launch/basic_drive.launch.py b/src/Bringup/launch/basic_drive.launch.py deleted file mode 100644 index 89a256e7..00000000 --- a/src/Bringup/launch/basic_drive.launch.py +++ /dev/null @@ -1,27 +0,0 @@ -from launch import LaunchDescription -from launch_ros.substitutions import FindPackageShare -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable -import os - - -def get_included_launch_descriptions(launch_files): - included_launches = [] - for pkg, file in launch_files: - pkg_share = FindPackageShare(pkg).find(pkg) - file_path = os.path.join(pkg_share, "launch", file) - included_launches.append( - IncludeLaunchDescription(PythonLaunchDescriptionSource(file_path)) - ) - return included_launches - - -def generate_launch_description(): - SetEnvironmentVariable("ROS_LOG_LEVEL", "warn"), - launch_files = [ - ("drive_cpp", "talon.launch.py"), - ("camera_streaming", "webRTC.launch.py"), - ("joystick_control", "controller.launch.py"), - ("servo_pkg", "usb_servo_launch.launch.py"), - ] - return LaunchDescription(get_included_launch_descriptions(launch_files)) diff --git a/src/Bringup/launch/core.launch.py b/src/Bringup/launch/core.launch.py index 993837eb..46370a22 100644 --- a/src/Bringup/launch/core.launch.py +++ b/src/Bringup/launch/core.launch.py @@ -1,6 +1,7 @@ from launch import LaunchDescription from launch_ros.substitutions import FindPackageShare from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch_xml.launch_description_sources import XMLLaunchDescriptionSource from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable import os @@ -10,16 +11,22 @@ def get_included_launch_descriptions(launch_files): for pkg, file in launch_files: pkg_share = FindPackageShare(pkg).find(pkg) file_path = os.path.join(pkg_share, "launch", file) - included_launches.append( - IncludeLaunchDescription(PythonLaunchDescriptionSource(file_path)) - ) + + if file.endswith(".py"): + source = PythonLaunchDescriptionSource(file_path) + elif file.endswith(".xml"): + source = XMLLaunchDescriptionSource(file_path) + else: + raise ValueError(f"Unsupported launch file format: {file}") + + included_launches.append(IncludeLaunchDescription(source)) return included_launches def generate_launch_description(): - SetEnvironmentVariable("ROS_LOG_LEVEL", "WARN") launch_files = [ ("joystick_control", "controller.launch.py"), ("servo_pkg", "usb_servo_launch.launch.py"), + ("rosbridge_server", "rosbridge_websocket_launch.xml"), ] return LaunchDescription(get_included_launch_descriptions(launch_files)) diff --git a/src/Bringup/launch/localization.launch.py b/src/Bringup/launch/localization.launch.py deleted file mode 100644 index 52fb487c..00000000 --- a/src/Bringup/launch/localization.launch.py +++ /dev/null @@ -1,30 +0,0 @@ -from launch import LaunchDescription -from launch_ros.substitutions import FindPackageShare -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable -import os - - -def get_included_launch_descriptions(launch_files): - included_launches = [] - for pkg, file in launch_files: - pkg_share = FindPackageShare(pkg).find(pkg) - file_path = os.path.join(pkg_share, "launch", file) - included_launches.append( - IncludeLaunchDescription(PythonLaunchDescriptionSource(file_path)) - ) - return included_launches - - -def generate_launch_description(): - SetEnvironmentVariable("ROS_LOG_LEVEL", "info"), - launch_files = [ - ("localization", "description.launch.py"), - ("localization", "ekf.launch.py"), - ("localization", "navsat.launch.py"), - ("localization", "rtabmap.launch.py"), - ("gps", "gps.launch.py"), - ("navigation", "zed.launch.py"), - ("navigation", "traversability_gridmap.launch.py"), - ] - return LaunchDescription(get_included_launch_descriptions(launch_files)) diff --git a/src/Bringup/launch/navigation.launch.py b/src/Bringup/launch/navigation.launch.py deleted file mode 100644 index 9c6bc4b9..00000000 --- a/src/Bringup/launch/navigation.launch.py +++ /dev/null @@ -1,35 +0,0 @@ -from launch import LaunchDescription -from launch_ros.substitutions import FindPackageShare -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable -import os - - -def get_included_launch_descriptions(launch_files): - included_launches = [] - for pkg, file in launch_files: - pkg_share = FindPackageShare(pkg).find(pkg) - file_path = os.path.join(pkg_share, "launch", file) - included_launches.append( - IncludeLaunchDescription(PythonLaunchDescriptionSource(file_path)) - ) - return included_launches - - -def generate_launch_description(): - launch_files = [ - ("navigation", "nav2.launch.py"), - ("navigation", "rtabmap.launch.py"), - ("nav_commanders", "gps_commander.launch.py"), - ] - lights_node = Node( - package="gpio_controller", - executable="lights", - name="lights_controller_node", # Assign a unique name to the node - output="screen", # Show output in the console - emulate_tty=True, # Required for output to show in terminal when using 'screen' - # parameters=[{'some_param': 'some_value'}] # Uncomment and add parameters if needed - ) - return LaunchDescription( - get_included_launch_descriptions(launch_files) + [lights_node] - ) diff --git a/src/Bringup/launch/science.launch.py b/src/Bringup/launch/science.launch.py deleted file mode 100644 index f3c35c22..00000000 --- a/src/Bringup/launch/science.launch.py +++ /dev/null @@ -1,30 +0,0 @@ -from launch import LaunchDescription -from launch_ros.substitutions import FindPackageShare -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable -import os - - -def get_included_launch_descriptions(launch_files): - included_launches = [] - for pkg, file in launch_files: - pkg_share = FindPackageShare(pkg).find(pkg) - file_path = os.path.join(pkg_share, "launch", file) - included_launches.append( - IncludeLaunchDescription(PythonLaunchDescriptionSource(file_path)) - ) - return included_launches - - -def generate_launch_description(): - SetEnvironmentVariable("ROS_LOG_LEVEL", "warn"), - launch_files = [ - ("drive_cpp", "talon.launch.py"), - ("camera_streaming", "webRTC.launch.py"), - ("gps", "rover.launch.py"), - ("joystick_control", "controller.launch.py"), - ("servo_pkg", "usb_servo_launch.launch.py"), - ("science_sensors", "panoramic.launch.py"), - ("science_sensors", "can_module_reader.launch.py"), - ] - return LaunchDescription(get_included_launch_descriptions(launch_files)) diff --git a/src/Bringup/package.xml b/src/Bringup/package.xml index 9facac3c..639afee5 100644 --- a/src/Bringup/package.xml +++ b/src/Bringup/package.xml @@ -6,6 +6,7 @@ TODO: Package description connor TODO: License declaration + rosbridge_server ament_copyright ament_flake8