Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS 2 config dir #444

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions husarion_ugv_controller/launch/controller.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@


def generate_launch_description():
husarion_ugv_controller_common_dir = PathJoinSubstitution(
["/config", "husarion_ugv_controller"]
)

robot_model = LaunchConfiguration("robot_model")
robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")

robot_description_pkg = PythonExpression(["'", robot_model, "_description'"])
robot_description_common_dir = PathJoinSubstitution(["/config", robot_description_pkg])

declare_robot_model_arg = DeclareLaunchArgument(
"robot_model",
default_value=robot_model_dict[robot_model_env],
description="Specify robot model",
choices=["lynx", "panther"],
)

battery_config_path = LaunchConfiguration("battery_config_path")
declare_battery_config_path_arg = DeclareLaunchArgument(
"battery_config_path",
Expand All @@ -48,7 +66,7 @@ def generate_launch_description():
declare_components_config_path_arg = DeclareLaunchArgument(
"components_config_path",
default_value=PathJoinSubstitution(
[FindPackageShare("panther_description"), "config", "components.yaml"]
[robot_description_common_dir, "config", "components.yaml"]
),
description=(
"Additional components configuration file. Components described in this file "
Expand All @@ -64,7 +82,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 @@ -94,16 +112,6 @@ def generate_launch_description():
choices=["True", "true", "False", "false"],
)

robot_model = LaunchConfiguration("robot_model")
robot_model_dict = {"LNX": "lynx", "PTH": "panther"}
robot_model_env = os.environ.get("ROBOT_MODEL", default="PTH")
declare_robot_model_arg = DeclareLaunchArgument(
"robot_model",
default_value=robot_model_dict[robot_model_env],
description="Specify robot model",
choices=["lynx", "panther"],
)

use_sim = LaunchConfiguration("use_sim")
declare_use_sim_arg = DeclareLaunchArgument(
"use_sim",
Expand All @@ -112,7 +120,6 @@ 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",
Expand Down Expand Up @@ -143,7 +150,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 Down
2 changes: 1 addition & 1 deletion husarion_ugv_lights/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ user_animations:
- type: husarion_ugv_lights::ImageAnimation
segments: all
animation:
image: $(find husarion_ugv_lights)/animations/strip01_red.png
image: $(find husarion_ugv_lights)/animations/panther/strip01_red.png
duration: 2
repeat: 2
color: 0xffff00
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