Skip to content

Commit

Permalink
optional config dir
Browse files Browse the repository at this point in the history
  • Loading branch information
BOOTCFG committed Dec 9, 2024
1 parent d3da0b5 commit 95b49be
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 10 deletions.
16 changes: 12 additions & 4 deletions husarion_ugv_bringup/launch/bringup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -119,6 +126,7 @@ def generate_launch_description():
)

actions = [
declare_common_dir_path_arg,
declare_disable_manager_arg,
declare_namespace_arg,
welcome_info,
Expand Down
33 changes: 30 additions & 3 deletions husarion_ugv_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,39 @@


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",
Expand Down Expand Up @@ -288,6 +314,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
Expand Down
20 changes: 19 additions & 1 deletion husarion_ugv_lights/launch/lights.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down
21 changes: 20 additions & 1 deletion husarion_ugv_localization/launch/localization.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)
Expand Down Expand Up @@ -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,
Expand Down
21 changes: 20 additions & 1 deletion husarion_ugv_manager/launch/manager.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,33 @@
EnvironmentVariable,
LaunchConfiguration,
PathJoinSubstitution,
PythonExpression,
)
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare


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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 95b49be

Please sign in to comment.