From f751caa9d967a8d802a10391f8545feffbce7903 Mon Sep 17 00:00:00 2001 From: Latuuuuu Date: Wed, 25 Nov 2026 22:27:16 +0800 Subject: [PATCH] feat(base): share opennav_docking_msgs between navigation and main --- base/opennav_docking_msgs/CMakeLists.txt | 21 +++++++++ base/opennav_docking_msgs/README.md | 30 +++++++++++++ .../action/DockRobot.action | 44 +++++++++++++++++++ .../action/UndockRobot.action | 25 +++++++++++ base/opennav_docking_msgs/package.xml | 28 ++++++++++++ .../srv/ReloadDatabase.srv | 5 +++ 6 files changed, 153 insertions(+) create mode 100644 base/opennav_docking_msgs/CMakeLists.txt create mode 100644 base/opennav_docking_msgs/README.md create mode 100644 base/opennav_docking_msgs/action/DockRobot.action create mode 100644 base/opennav_docking_msgs/action/UndockRobot.action create mode 100644 base/opennav_docking_msgs/package.xml create mode 100644 base/opennav_docking_msgs/srv/ReloadDatabase.srv diff --git a/base/opennav_docking_msgs/CMakeLists.txt b/base/opennav_docking_msgs/CMakeLists.txt new file mode 100644 index 0000000..d35d4e2 --- /dev/null +++ b/base/opennav_docking_msgs/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.5) +project(opennav_docking_msgs) + +find_package(ament_cmake REQUIRED) +find_package(builtin_interfaces REQUIRED) +find_package(nav_msgs REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(rosidl_default_generators REQUIRED) +find_package(std_msgs REQUIRED) +find_package(action_msgs REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + "action/DockRobot.action" + "action/UndockRobot.action" + "srv/ReloadDatabase.srv" + DEPENDENCIES builtin_interfaces geometry_msgs std_msgs action_msgs nav_msgs +) + +ament_export_dependencies(rosidl_default_runtime) + +ament_package() diff --git a/base/opennav_docking_msgs/README.md b/base/opennav_docking_msgs/README.md new file mode 100644 index 0000000..2ba31c5 --- /dev/null +++ b/base/opennav_docking_msgs/README.md @@ -0,0 +1,30 @@ +# opennav_docking_msgs + +The docking actions of [opennav_docking](https://github.com/open-navigation/opennav_docking) +(`DockRobot`, `UndockRobot`, `ReloadDatabase`). Navigation serves them (its vendored +`opennav_docking` in `Eurobot-Template-Navigation`), main calls `DockRobot`, so the definition +lives here in the base like every other cross-domain type: one copy, built once. + +Upstream name kept on purpose: the action type name (`opennav_docking_msgs/action/DockRobot`) is +part of what both sides match on, and the vendored Nav2 / opennav_docking code includes these +headers by that name. + +## Where it came from + +Copied from `Eurobot-Template-Navigation` `src/third_party/opennav_docking/opennav_docking_msgs` +(= `Eurobot-2026-Navigation2` `develop` bb0ab0c, upstream `package.xml` version 0.0.2). + +DIT changes on top of upstream (2026; compared with upstream `main` on 2026-11-25, which has +901–906 and 999): + +- `DockRobot` result error codes `STOP_ROBOT=900` and `BLOCK_BY_RIVAL=907`. + +DIT-X changes: + +- `package.xml` lists only what the interfaces use (upstream also depended on rclcpp, + rclcpp_action, rclcpp_lifecycle, nav2_util, nav2_msgs and tf2_ros); it adds `std_msgs` and + `action_msgs`, which `CMakeLists.txt` already used. + +2026 main kept its own copy in `src/Interface/opennav_docking_msgs`, which had already drifted: +it lacked `STOP_ROBOT=900`. Constants do not change the wire format, so 2026 still worked, but +that is exactly the drift a single copy in the base prevents. diff --git a/base/opennav_docking_msgs/action/DockRobot.action b/base/opennav_docking_msgs/action/DockRobot.action new file mode 100644 index 0000000..40de318 --- /dev/null +++ b/base/opennav_docking_msgs/action/DockRobot.action @@ -0,0 +1,44 @@ +#goal definition + +bool use_dock_id True # Whether to use the dock_id or dock_pose fields +string dock_id # Dock name or ID to dock at, from given dock database + +geometry_msgs/PoseStamped dock_pose # Dock pose +string dock_type # If using dock_pose, what type of dock it is. Not necessary if only using one type of dock. + +float32 max_staging_time 1000.0 # Maximum time for navigation to get to the dock's staging pose. +bool navigate_to_staging_pose True # Whether or not to navigate to staging pose or assume robot is already at staging pose within tolerance to execute behavior + +--- +#result definition + +# Error codes +# Note: The expected priority order of the errors should match the message order +uint16 NONE=0 +uint16 STOP_ROBOT=900 +uint16 DOCK_NOT_IN_DB=901 +uint16 DOCK_NOT_VALID=902 +uint16 FAILED_TO_STAGE=903 +uint16 FAILED_TO_DETECT_DOCK=904 +uint16 FAILED_TO_CONTROL=905 +uint16 FAILED_TO_CHARGE=906 +uint16 BLOCK_BY_RIVAL=907 +uint16 UNKNOWN=999 + +bool success True # docking success status +uint16 error_code 0 # Contextual error code, if any +uint16 num_retries 0 # Number of retries attempted + +--- +#feedback definition + +uint16 NONE=0 +uint16 NAV_TO_STAGING_POSE=1 +uint16 INITIAL_PERCEPTION=2 +uint16 CONTROLLING=3 +uint16 WAIT_FOR_CHARGE=4 +uint16 RETRY=5 + +uint16 state # Current docking state +builtin_interfaces/Duration docking_time # Docking time elapsed +uint16 num_retries 0 # Number of retries attempted diff --git a/base/opennav_docking_msgs/action/UndockRobot.action b/base/opennav_docking_msgs/action/UndockRobot.action new file mode 100644 index 0000000..4ab21a7 --- /dev/null +++ b/base/opennav_docking_msgs/action/UndockRobot.action @@ -0,0 +1,25 @@ +#goal definition + +# If initialized on a dock so the server doesn't know what type of dock its on, +# you must specify what dock it is to know where to stage for undocking. +# If only one type of dock plugin is present, it is not necessary to set. +# If not set & server instance was used to dock, server will use current dock information from last docking request. +string dock_type + +float32 max_undocking_time 30.0 # Maximum time to undock + +--- +#result definition + +# Error codes +# Note: The expected priority order of the errors should match the message order +uint16 NONE=0 +uint16 DOCK_NOT_VALID=902 +uint16 FAILED_TO_CONTROL=905 +uint16 UNKNOWN=999 + +bool success True # docking success status +uint16 error_code 0 # Contextual error code, if any + +--- +#feedback definition diff --git a/base/opennav_docking_msgs/package.xml b/base/opennav_docking_msgs/package.xml new file mode 100644 index 0000000..990f359 --- /dev/null +++ b/base/opennav_docking_msgs/package.xml @@ -0,0 +1,28 @@ + + + + opennav_docking_msgs + 0.0.2 + Docking / undocking interfaces of opennav_docking, with the DIT error codes. Lives in the shell repo because navigation serves DockRobot and main calls it. + Steve Macenski + DIT Robotics + Apache-2.0 + + ament_cmake + rosidl_default_generators + + + action_msgs + builtin_interfaces + geometry_msgs + nav_msgs + std_msgs + + rosidl_default_runtime + rosidl_interface_packages + + + ament_cmake + + diff --git a/base/opennav_docking_msgs/srv/ReloadDatabase.srv b/base/opennav_docking_msgs/srv/ReloadDatabase.srv new file mode 100644 index 0000000..fb6f36d --- /dev/null +++ b/base/opennav_docking_msgs/srv/ReloadDatabase.srv @@ -0,0 +1,5 @@ +# Reloads the dock's database with a new filepath + +string filepath +--- +bool success