From 863ef77ab3a0357cabfa5d1e26f0874d640f12ed Mon Sep 17 00:00:00 2001 From: Jakub Delicat <109142865+delihus@users.noreply.github.com> Date: Thu, 10 Oct 2024 18:23:34 +0200 Subject: [PATCH] Fixed namespaces and updated ros_component_description (#424) * Fixed namespaces and updated ros_component_description Signed-off-by: Jakub Delicat * Remove panther_version --------- Signed-off-by: Jakub Delicat Co-authored-by: rafal-gorecki --- panther/panther_hardware.repos | 2 +- panther/panther_simulation.repos | 2 +- panther_docking/README.md | 1 - panther_docking/config/panther_docking_server.yaml | 2 +- panther_docking/launch/docking.launch.py | 5 +---- panther_docking/launch/station.launch.py | 13 +++++++++---- panther_docking/src/panther_charging_dock.cpp | 3 --- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/panther/panther_hardware.repos b/panther/panther_hardware.repos index 27289d3b..c6df86e1 100644 --- a/panther/panther_hardware.repos +++ b/panther/panther_hardware.repos @@ -14,7 +14,7 @@ repositories: ros_components_description: type: git url: https://github.com/husarion/ros_components_description.git - version: b29f5637a243b0008ac197032575c8df47883b2c + version: 99e0189970293bb0110aad0a3b609bc659ecc663 ros2_controllers: # Caused by two error: 1. https://github.com/ros-controls/ros2_controllers/pull/1104 2. There is no nice way to change `sensor_name` imu_bradcaster param when spawning multiple robots -> ros2_control refer only to single imu entity type: git url: https://github.com/husarion/ros2_controllers/ diff --git a/panther/panther_simulation.repos b/panther/panther_simulation.repos index 83df44fa..d6c6932f 100644 --- a/panther/panther_simulation.repos +++ b/panther/panther_simulation.repos @@ -14,7 +14,7 @@ repositories: ros_components_description: type: git url: https://github.com/husarion/ros_components_description.git - version: b29f5637a243b0008ac197032575c8df47883b2c + version: 99e0189970293bb0110aad0a3b609bc659ecc663 ros2_controllers: # Caused by two error: 1. https://github.com/ros-controls/ros2_controllers/pull/1104 2. There is no nice way to change `sensor_name` imu_bradcaster param when spawning multiple robots -> ros2_control refer only to single imu entity type: git url: https://github.com/husarion/ros2_controllers/ diff --git a/panther_docking/README.md b/panther_docking/README.md index d41c232c..228f1359 100644 --- a/panther_docking/README.md +++ b/panther_docking/README.md @@ -33,7 +33,6 @@ The package contains a `PantherChargingDock` plugin for the [opennav_docking](ht #### Parameters -- `~panther_version` [*double*, default: **1.21**]: A version of Panther robot. - `~.base_frame` [*string*, default: **base_link**]: A base frame id of a robot. - `~.external_detection_timeout` [*double*, default: **0.2**]: A timeout in seconds for looking up a transformation from an april tag of a dock to a base frame id. - `~.external_detection_translation_x` [*double*, default: **0.0**]: A translation over an X axis between a detected frame and a dock pose. diff --git a/panther_docking/config/panther_docking_server.yaml b/panther_docking/config/panther_docking_server.yaml index 4593b716..7d3ecea1 100644 --- a/panther_docking/config/panther_docking_server.yaml +++ b/panther_docking/config/panther_docking_server.yaml @@ -37,7 +37,7 @@ docks: ["main_dock"] main_dock: type: panther_charging_dock - frame: /wibotic_station_link + frame: /main_wibotic_station_link pose: [0.0, 0.0, 0.0] # position of the dock device (not the staging position), the front (X+) of the dock should point away from the robot controller: diff --git a/panther_docking/launch/docking.launch.py b/panther_docking/launch/docking.launch.py index 3583db64..d386bd31 100644 --- a/panther_docking/launch/docking.launch.py +++ b/panther_docking/launch/docking.launch.py @@ -26,8 +26,6 @@ def generate_launch_description(): - panther_version = EnvironmentVariable(name="PANTHER_ROBOT_VERSION", default_value="1.0") - use_sim = LaunchConfiguration("use_sim") declare_use_sim_arg = DeclareLaunchArgument( "use_sim", @@ -61,9 +59,8 @@ def generate_launch_description(): package="opennav_docking", executable="opennav_docking", parameters=[ - {"panther_version": panther_version}, namespaced_docking_server_config, - {"use_sim_time": True}, + {"use_sim_time": use_sim}, ], namespace=namespace, emulate_tty=True, diff --git a/panther_docking/launch/station.launch.py b/panther_docking/launch/station.launch.py index d9e6ac12..f1303cdf 100644 --- a/panther_docking/launch/station.launch.py +++ b/panther_docking/launch/station.launch.py @@ -26,6 +26,7 @@ PythonExpression, ) from launch_ros.actions import Node +from launch_ros.parameter_descriptions import ParameterValue from launch_ros.substitutions import FindPackageShare from moms_apriltag import TagGenerator2 @@ -41,7 +42,7 @@ def generate_apriltag_and_get_path(tag_id): def launch_setup(context, *args, **kwargs): - namespace = LaunchConfiguration("namespace") + namespace = LaunchConfiguration("namespace").perform(context) apriltag_id = int(LaunchConfiguration("apriltag_id").perform(context)) apriltag_size = LaunchConfiguration("apriltag_size").perform(context) @@ -58,8 +59,8 @@ def launch_setup(context, *args, **kwargs): "wibotic_station.urdf.xacro", ] ), - " namespace:=", - namespace, + " device_namespace:=", + "main", " apriltag_image_path:=", apriltag_image_path, " apriltag_size:=", @@ -69,12 +70,16 @@ def launch_setup(context, *args, **kwargs): namespace_ext = PythonExpression(["'", namespace, "' + '/' if '", namespace, "' else ''"]) + station_description = { + "robot_description": ParameterValue(station_description_content, value_type=str) + } + station_state_pub_node = Node( package="robot_state_publisher", executable="robot_state_publisher", name="wibotic_station_state_publisher", parameters=[ - {"robot_description": station_description_content}, + station_description, {"frame_prefix": namespace_ext}, ], remappings=[("robot_description", "station_description")], diff --git a/panther_docking/src/panther_charging_dock.cpp b/panther_docking/src/panther_charging_dock.cpp index 0e13221d..dc0bf779 100644 --- a/panther_docking/src/panther_charging_dock.cpp +++ b/panther_docking/src/panther_charging_dock.cpp @@ -70,9 +70,6 @@ void PantherChargingDock::deactivate() void PantherChargingDock::declareParameters(const rclcpp_lifecycle::LifecycleNode::SharedPtr & node) { - nav2_util::declare_parameter_if_not_declared( - node, "panther_version", rclcpp::ParameterValue(1.0)); - nav2_util::declare_parameter_if_not_declared( node, name_ + ".base_frame", rclcpp::ParameterValue("base_link")); nav2_util::declare_parameter_if_not_declared(