Skip to content

Commit

Permalink
use configs from /config dir
Browse files Browse the repository at this point in the history
  • Loading branch information
KmakD committed Nov 20, 2024
1 parent 66de8ed commit 3c3a3ac
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
17 changes: 10 additions & 7 deletions husarion_ugv_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 "
Expand All @@ -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'"]),
]
Expand Down Expand Up @@ -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. "
),
)
Expand All @@ -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")
Expand All @@ -157,7 +160,7 @@ def generate_launch_description():
" ",
PathJoinSubstitution(
[
FindPackageShare(robot_description_pkg),
FindPackageShare(husarion_ugv_desctiption_pkg),
"urdf",
robot_description_file,
]
Expand Down
20 changes: 20 additions & 0 deletions husarion_ugv_lights/config/user_animations.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 7 additions & 4 deletions husarion_ugv_lights/launch/lights.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)

Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion husarion_ugv_localization/launch/localization.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)
Expand Down
13 changes: 7 additions & 6 deletions husarion_ugv_manager/launch/manager.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
)
Expand All @@ -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.",
)
Expand All @@ -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",
]
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 3c3a3ac

Please sign in to comment.