diff --git a/husarion_ugv_bringup/launch/bringup.launch.py b/husarion_ugv_bringup/launch/bringup.launch.py index 1e5421432..824112ebf 100644 --- a/husarion_ugv_bringup/launch/bringup.launch.py +++ b/husarion_ugv_bringup/launch/bringup.launch.py @@ -29,6 +29,13 @@ def generate_launch_description(): + common_dir_path = LaunchConfiguration("common_dir_path") + declare_common_dir_path_arg = DeclareLaunchArgument( + "common_dir_path", + default_value="", + description="Path to the common configuration directory.", + ) + disable_manager = LaunchConfiguration("disable_manager") declare_disable_manager_arg = DeclareLaunchArgument( "disable_manager", @@ -55,7 +62,7 @@ def generate_launch_description(): [FindPackageShare("husarion_ugv_controller"), "launch", "controller.launch.py"] ) ), - launch_arguments={"namespace": namespace}.items(), + launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(), ) system_monitor_launch = IncludeLaunchDescription( @@ -77,7 +84,7 @@ def generate_launch_description(): [FindPackageShare("husarion_ugv_lights"), "launch", "lights.launch.py"] ) ), - launch_arguments={"namespace": namespace}.items(), + launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(), ) battery_launch = IncludeLaunchDescription( @@ -95,7 +102,7 @@ def generate_launch_description(): [FindPackageShare("husarion_ugv_localization"), "launch", "localization.launch.py"] ) ), - launch_arguments={"namespace": namespace}.items(), + launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(), ) manager_launch = IncludeLaunchDescription( @@ -105,7 +112,7 @@ def generate_launch_description(): ) ), condition=UnlessCondition(disable_manager), - launch_arguments={"namespace": namespace}.items(), + launch_arguments={"namespace": namespace, "common_dir_path": common_dir_path}.items(), ) delayed_action = TimerAction( @@ -119,6 +126,7 @@ def generate_launch_description(): ) actions = [ + declare_common_dir_path_arg, declare_disable_manager_arg, declare_namespace_arg, welcome_info, diff --git a/husarion_ugv_controller/launch/controller.launch.py b/husarion_ugv_controller/launch/controller.launch.py index 843bbbc66..e83b986e5 100644 --- a/husarion_ugv_controller/launch/controller.launch.py +++ b/husarion_ugv_controller/launch/controller.launch.py @@ -34,13 +34,40 @@ def generate_launch_description(): - husarion_ugv_controller_common_dir = PathJoinSubstitution( - ["/config", "husarion_ugv_controller"] + common_dir_path = LaunchConfiguration("common_dir_path") + declare_common_dir_path_arg = DeclareLaunchArgument( + "common_dir_path", + default_value="", + description="Path to the common configuration directory.", ) + husarion_ugv_controller_common_dir = PythonExpression( + [ + "'", + common_dir_path, + "/husarion_ugv_controller' if '", + common_dir_path, + "' else '", + FindPackageShare("husarion_ugv_controller"), + "'", + ] + ) + robot_model = LaunchConfiguration("robot_model") robot_description_pkg = PythonExpression(["'", robot_model, "_description'"]) - robot_description_common_dir = PathJoinSubstitution(["/config", robot_description_pkg]) + robot_description_common_dir = PythonExpression( + [ + "'", + common_dir_path, + "/", + robot_description_pkg, + "' if '", + common_dir_path, + "' else '", + FindPackageShare(robot_description_pkg), + "'", + ] + ) declare_robot_model_arg = DeclareLaunchArgument( "robot_model", @@ -288,6 +315,7 @@ def generate_launch_description(): ) actions = [ + declare_common_dir_path_arg, declare_battery_config_path_arg, declare_robot_model_arg, # robot_model is used by wheel_type declare_wheel_type_arg, # wheel_type is used by controller_config_path diff --git a/husarion_ugv_lights/launch/lights.launch.py b/husarion_ugv_lights/launch/lights.launch.py index 27023d825..c7326de4d 100644 --- a/husarion_ugv_lights/launch/lights.launch.py +++ b/husarion_ugv_lights/launch/lights.launch.py @@ -33,7 +33,24 @@ def generate_launch_description(): robot_model = LaunchConfiguration("robot_model") husarion_ugv_lights_pkg = FindPackageShare("husarion_ugv_lights") - husarion_ugv_lights_common_dir = PathJoinSubstitution(["/config", "husarion_ugv_lights"]) + common_dir_path = LaunchConfiguration("common_dir_path") + declare_common_dir_path_arg = DeclareLaunchArgument( + "common_dir_path", + default_value="", + description="Path to the common configuration directory.", + ) + husarion_ugv_lights_common_dir = PythonExpression( + [ + "'", + common_dir_path, + "/husarion_ugv_lights' if '", + common_dir_path, + "' else '", + FindPackageShare("husarion_ugv_lights"), + "'", + ] + ) + animations_config = PythonExpression(["'", robot_model, "_animations.yaml'"]) animations_config_path = LaunchConfiguration("animations_config_path") @@ -112,6 +129,7 @@ def generate_launch_description(): ) actions = [ + declare_common_dir_path_arg, declare_robot_model_arg, # robot_model is used by animations_config_path declare_animations_config_path_arg, declare_namespace_arg, diff --git a/husarion_ugv_localization/launch/localization.launch.py b/husarion_ugv_localization/launch/localization.launch.py index f03843e7f..86e0e2d81 100644 --- a/husarion_ugv_localization/launch/localization.launch.py +++ b/husarion_ugv_localization/launch/localization.launch.py @@ -86,11 +86,29 @@ def generate_launch_description(): ["'", mode_prefix, "localization", gps_postfix, ".yaml'"] ) + common_dir_path = LaunchConfiguration("common_dir_path") + declare_common_dir_path_arg = DeclareLaunchArgument( + "common_dir_path", + default_value="", + description="Path to the common configuration directory.", + ) + husarion_ugv_localization_common_dir = PythonExpression( + [ + "'", + common_dir_path, + "/husarion_ugv_localization' if '", + common_dir_path, + "' else '", + FindPackageShare("husarion_ugv_localization"), + "'", + ] + ) + localization_config_path = LaunchConfiguration("localization_config_path") declare_localization_config_path_arg = DeclareLaunchArgument( "localization_config_path", default_value=PathJoinSubstitution( - ["/config", "husarion_ugv_localization", "config", localization_config_filename] + [husarion_ugv_localization_common_dir, "config", localization_config_filename] ), description="Specify the path to the localization configuration file.", ) @@ -135,6 +153,7 @@ def generate_launch_description(): ) actions = [ + declare_common_dir_path_arg, declare_fuse_gps_arg, declare_launch_nmea_gps_arg, declare_localization_mode_arg, diff --git a/husarion_ugv_manager/launch/manager.launch.py b/husarion_ugv_manager/launch/manager.launch.py index 60c0b4f52..fe5e8943a 100644 --- a/husarion_ugv_manager/launch/manager.launch.py +++ b/husarion_ugv_manager/launch/manager.launch.py @@ -21,6 +21,7 @@ EnvironmentVariable, LaunchConfiguration, PathJoinSubstitution, + PythonExpression, ) from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare @@ -28,8 +29,25 @@ def generate_launch_description(): + common_dir_path = LaunchConfiguration("common_dir_path") + declare_common_dir_path_arg = DeclareLaunchArgument( + "common_dir_path", + default_value="", + description="Path to the common configuration directory.", + ) + husarion_ugv_manager_common_dir = PythonExpression( + [ + "'", + common_dir_path, + "/husarion_ugv_manager' if '", + common_dir_path, + "' else '", + FindPackageShare("husarion_ugv_manager"), + "'", + ] + ) + husarion_ugv_manager_pkg = FindPackageShare("husarion_ugv_manager") - husarion_ugv_manager_common_dir = PathJoinSubstitution(["/config", "husarion_ugv_manager"]) lights_bt_project_path = LaunchConfiguration("lights_bt_project_path") declare_lights_bt_project_path_arg = DeclareLaunchArgument( @@ -105,6 +123,7 @@ def generate_launch_description(): ) actions = [ + declare_common_dir_path_arg, declare_lights_bt_project_path_arg, declare_safety_bt_project_path_arg, declare_namespace_arg,