From 3c3a3accb2434851fb85ba0d573278a004d59077 Mon Sep 17 00:00:00 2001 From: kmakd Date: Wed, 20 Nov 2024 11:59:40 +0000 Subject: [PATCH] use configs from /config dir --- .../launch/controller.launch.py | 17 +++++++++------- .../config/user_animations.yaml | 20 +++++++++++++++++++ husarion_ugv_lights/launch/lights.launch.py | 11 ++++++---- .../launch/localization.launch.py | 2 +- husarion_ugv_manager/launch/manager.launch.py | 13 ++++++------ 5 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 husarion_ugv_lights/config/user_animations.yaml diff --git a/husarion_ugv_controller/launch/controller.launch.py b/husarion_ugv_controller/launch/controller.launch.py index 2e61a370..70d262ef 100644 --- a/husarion_ugv_controller/launch/controller.launch.py +++ b/husarion_ugv_controller/launch/controller.launch.py @@ -34,6 +34,11 @@ def generate_launch_description(): + husarion_ugv_desctiption_pkg = FindPackageShare("husarion_ugv_description") + husarion_ugv_controller_common_dir = PathJoinSubstitution( + ["/config", "husarion_ugv_controller"] + ) + battery_config_path = LaunchConfiguration("battery_config_path") declare_battery_config_path_arg = DeclareLaunchArgument( "battery_config_path", @@ -48,7 +53,7 @@ def generate_launch_description(): declare_components_config_path_arg = DeclareLaunchArgument( "components_config_path", default_value=PathJoinSubstitution( - [FindPackageShare("panther_description"), "config", "components.yaml"] + [husarion_ugv_desctiption_pkg, "config", "components.yaml"] ), description=( "Additional components configuration file. Components described in this file " @@ -64,7 +69,7 @@ def generate_launch_description(): "controller_config_path", default_value=PathJoinSubstitution( [ - FindPackageShare("husarion_ugv_controller"), + husarion_ugv_controller_common_dir, "config", PythonExpression(["'", wheel_type, "_controller.yaml'"]), ] @@ -112,20 +117,19 @@ def generate_launch_description(): choices=["True", "true", "False", "false"], ) - robot_description_pkg = PythonExpression(["'", robot_model, "_description'"]) wheel_config_path = LaunchConfiguration("wheel_config_path") declare_wheel_config_path_arg = DeclareLaunchArgument( "wheel_config_path", default_value=PathJoinSubstitution( [ - FindPackageShare(robot_description_pkg), + FindPackageShare(husarion_ugv_desctiption_pkg), "config", PythonExpression(["'", wheel_type, ".yaml'"]), ] ), description=( "Path to wheel configuration file. By default, it is located in " - "'panther_description/config/{wheel_type}.yaml'. You can also specify the path " + "'husarion_ugv_description/config/{wheel_type}.yaml'. You can also specify the path " "to your custom wheel configuration file here. " ), ) @@ -143,7 +147,6 @@ def generate_launch_description(): ) # Get URDF via xacro - robot_description_pkg = PythonExpression(["'", robot_model, "_description'"]) robot_description_file = PythonExpression(["'", robot_model, ".urdf.xacro'"]) imu_pos_x = os.environ.get("ROBOT_IMU_LOCALIZATION_X", "0.168") imu_pos_y = os.environ.get("ROBOT_IMU_LOCALIZATION_Y", "0.028") @@ -157,7 +160,7 @@ def generate_launch_description(): " ", PathJoinSubstitution( [ - FindPackageShare(robot_description_pkg), + FindPackageShare(husarion_ugv_desctiption_pkg), "urdf", robot_description_file, ] diff --git a/husarion_ugv_lights/config/user_animations.yaml b/husarion_ugv_lights/config/user_animations.yaml new file mode 100644 index 00000000..01771347 --- /dev/null +++ b/husarion_ugv_lights/config/user_animations.yaml @@ -0,0 +1,20 @@ +# This file is a placeholder for user-defined animations for the Husarion UGV +# robots lights system. Users can define their own light animations in this +# YAML file. +# +# For more examples and detailed documentation, please visit: +# https://github.com/husarion/panther_ros/blob/ros2/panther_lights/CONFIGURATION.md#defining-animations +# +# Example including a simple custom animation: +# +# user_animations: +# - id: 21 +# name: CUSTOM_IMAGE_ANIMATION +# priority: 3 +# animations: +# - type: panther_lights::ImageAnimation +# segments: all +# animation: +# image: /config/husarion_ugv_lights/animations/example.png +# duration: 3 +# repeat: 1 diff --git a/husarion_ugv_lights/launch/lights.launch.py b/husarion_ugv_lights/launch/lights.launch.py index fa45aa53..8fd1f466 100644 --- a/husarion_ugv_lights/launch/lights.launch.py +++ b/husarion_ugv_lights/launch/lights.launch.py @@ -33,13 +33,14 @@ def generate_launch_description(): robot_model = LaunchConfiguration("robot_model") - lights_pkg = FindPackageShare("husarion_ugv_lights") + husarion_ugv_lights_pkg = FindPackageShare("husarion_ugv_lights") + husarion_ugv_lights_common_dir = PathJoinSubstitution(["/config", "husarion_ugv_lights"]) animations_config = PythonExpression(["'", robot_model, "_animations.yaml'"]) animations_config_path = LaunchConfiguration("animations_config_path") declare_animations_config_path_arg = DeclareLaunchArgument( "animations_config_path", - default_value=PathJoinSubstitution([lights_pkg, "config", animations_config]), + default_value=PathJoinSubstitution([husarion_ugv_lights_pkg, "config", animations_config]), description="Path to a YAML file with a description of led configuration.", ) @@ -69,12 +70,14 @@ def generate_launch_description(): user_led_animations_path = LaunchConfiguration("user_led_animations_path") declare_user_led_animations_path_arg = DeclareLaunchArgument( "user_led_animations_path", - default_value="", + default_value=PathJoinSubstitution( + [husarion_ugv_lights_common_dir, "config", "user_animations.yaml"] + ), description="Path to a YAML file with a description of the user defined animations.", ) driver_config = PythonExpression(["'", robot_model, "_driver.yaml'"]) - driver_config_path = PathJoinSubstitution([lights_pkg, "config", driver_config]) + driver_config_path = PathJoinSubstitution([husarion_ugv_lights_pkg, "config", driver_config]) lights_container = ComposableNodeContainer( package="rclcpp_components", name="lights_container", diff --git a/husarion_ugv_localization/launch/localization.launch.py b/husarion_ugv_localization/launch/localization.launch.py index e948eb28..f03843e7 100644 --- a/husarion_ugv_localization/launch/localization.launch.py +++ b/husarion_ugv_localization/launch/localization.launch.py @@ -90,7 +90,7 @@ def generate_launch_description(): declare_localization_config_path_arg = DeclareLaunchArgument( "localization_config_path", default_value=PathJoinSubstitution( - [FindPackageShare("husarion_ugv_localization"), "config", localization_config_filename] + ["/config", "husarion_ugv_localization", "config", localization_config_filename] ), description="Specify the path to the localization configuration file.", ) diff --git a/husarion_ugv_manager/launch/manager.launch.py b/husarion_ugv_manager/launch/manager.launch.py index 1412e924..60c0b4f5 100644 --- a/husarion_ugv_manager/launch/manager.launch.py +++ b/husarion_ugv_manager/launch/manager.launch.py @@ -28,13 +28,14 @@ def generate_launch_description(): - husarion_ugv_manager_dir = 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( "lights_bt_project_path", default_value=PathJoinSubstitution( - [husarion_ugv_manager_dir, "behavior_trees", "LightsBT.btproj"] + [husarion_ugv_manager_common_dir, "behavior_trees", "LightsBT.btproj"] ), description="Path to BehaviorTree project file, responsible for lights management.", ) @@ -50,7 +51,7 @@ def generate_launch_description(): declare_safety_bt_project_path_arg = DeclareLaunchArgument( "safety_bt_project_path", default_value=PathJoinSubstitution( - [husarion_ugv_manager_dir, "behavior_trees", "SafetyBT.btproj"] + [husarion_ugv_manager_pkg, "behavior_trees", "SafetyBT.btproj"] ), description="Path to BehaviorTree project file, responsible for safety and shutdown management.", ) @@ -60,7 +61,7 @@ def generate_launch_description(): "shutdown_hosts_config_path", default_value=PathJoinSubstitution( [ - FindPackageShare("husarion_ugv_manager"), + husarion_ugv_manager_common_dir, "config", "shutdown_hosts.yaml", ] @@ -80,7 +81,7 @@ def generate_launch_description(): executable="lights_manager_node", name="lights_manager", parameters=[ - PathJoinSubstitution([husarion_ugv_manager_dir, "config", "lights_manager.yaml"]), + PathJoinSubstitution([husarion_ugv_manager_pkg, "config", "lights_manager.yaml"]), {"bt_project_path": lights_bt_project_path}, ], namespace=namespace, @@ -92,7 +93,7 @@ def generate_launch_description(): executable="safety_manager_node", name="safety_manager", parameters=[ - PathJoinSubstitution([husarion_ugv_manager_dir, "config", "safety_manager.yaml"]), + PathJoinSubstitution([husarion_ugv_manager_pkg, "config", "safety_manager.yaml"]), { "bt_project_path": safety_bt_project_path, "shutdown_hosts_path": shutdown_hosts_config_path,