Skip to content
Open
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
8 changes: 5 additions & 3 deletions base/eurobot_common/contract.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ topics:

LOCALIZATION_POSE:
name: /robot/localization/pose
type: geometry_msgs/msg/PoseWithCovarianceStamped
qos: sensor
type: nav_msgs/msg/Odometry
qos: stream
publisher: localization
subscribers: [navigation, main]
rate_hz: 50
doc: Fused robot pose in the map frame. header.stamp = time of the newest fused measurement.
doc: >-
Fused robot pose in the map frame (the 2026 final_pose; child_frame_id = robot frame,
pose.covariance from the EKF). header.stamp = time of the newest fused measurement.

VISION_RIVAL_POSES:
name: /robot/vision/rival_poses
Expand Down
11 changes: 10 additions & 1 deletion base/eurobot_common/test/test_contract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@

#include "eurobot_common/contract.hpp"

using eurobot_common::contract::HEARTBEAT;
using eurobot_common::contract::LOCALIZATION_POSE;
using eurobot_common::contract::STARTUP_STATUS;

TEST(Contract, SensorTopicsAreBestEffortKeepLast1) {
auto qos = LOCALIZATION_POSE.qos().get_rmw_qos_profile();
auto qos = HEARTBEAT.qos().get_rmw_qos_profile();
EXPECT_EQ(qos.reliability, RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT);
EXPECT_EQ(qos.depth, 1u);
}

// Nav2 subscribes to odometry as reliable; a best_effort publisher would never match.
TEST(Contract, StreamTopicsAreReliableKeepLast10) {
auto qos = LOCALIZATION_POSE.qos().get_rmw_qos_profile();
EXPECT_EQ(qos.reliability, RMW_QOS_POLICY_RELIABILITY_RELIABLE);
EXPECT_EQ(qos.durability, RMW_QOS_POLICY_DURABILITY_VOLATILE);
EXPECT_EQ(qos.depth, 10u);
}

TEST(Contract, StateTopicsLatch) {
auto qos = STARTUP_STATUS.qos().get_rmw_qos_profile();
EXPECT_EQ(qos.durability, RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL);
Expand Down
2 changes: 1 addition & 1 deletion docs/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
|---|---|---|---|---|---|---|
| `/robot/startup/status` | `eurobot_interfaces/msg/StartupStatus` | state | main | * | | Which domains have reported ready; all_ready gates the match start. |
| `/robot/system/heartbeat` | `eurobot_interfaces/msg/ModuleHeartbeat` | sensor | * | main | 1 | One message per module per second; missing heartbeats mean a dead module. |
| `/robot/localization/pose` | `geometry_msgs/msg/PoseWithCovarianceStamped` | sensor | localization | navigation, main | 50 | Fused robot pose in the map frame. header.stamp = time of the newest fused measurement. |
| `/robot/localization/pose` | `nav_msgs/msg/Odometry` | stream | localization | navigation, main | 50 | Fused robot pose in the map frame (the 2026 final_pose; child_frame_id = robot frame, pose.covariance from the EKF). header.stamp = time of the newest fused measurement. |
| `/robot/vision/rival_poses` | `geometry_msgs/msg/PoseArray` | sensor | vision | localization, navigation, main | 15 | Detected opponent robots in the map frame. |
| `/robot/navigation/goal` | `geometry_msgs/msg/PoseStamped` | command | main | navigation | | Where main wants the robot to go next. |
| `/robot/navigation/status` | `std_msgs/msg/String` | state | navigation | main | | One of: idle, moving, arrived, blocked. |
Expand Down
7 changes: 4 additions & 3 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ qos:
sensor: {reliability: best_effort, durability: volatile, history: keep_last, depth: 1}
state: {reliability: reliable, durability: transient_local, history: keep_last, depth: 1}
command: {reliability: reliable, durability: volatile, history: keep_last, depth: 10}
stream: {reliability: reliable, durability: volatile, history: keep_last, depth: 10}

topics:
LOCALIZATION_POSE:
name: /robot/localization/pose
type: geometry_msgs/msg/PoseWithCovarianceStamped
qos: sensor
type: nav_msgs/msg/Odometry
qos: stream
publisher: localization
subscribers: [navigation, main]
rate_hz: 50
Expand All @@ -133,7 +134,7 @@ topics:
| 欄位 | 說明 |
|---|---|
| `domains` | 系統可識別的 domain;啟動交握會拒絕不在此清單中的 domain |
| `qos` | 三種 QoS profile;每個 topic 必須從中選用一種,請勿自行定義 |
| `qos` | 四種 QoS profile;每個 topic 必須從中選用一種,請勿自行定義 |
| `topics.<KEY>` | KEY 會成為程式中的常數:`contract.LOCALIZATION_POSE` / `eurobot_common::contract::LOCALIZATION_POSE` |
| `name` | 格式為 `/robot/<區域>/<東西>`,使用 snake_case;區域為擁有該 topic 的 domain,或 `startup` / `system` |
| `type` | message 型別,請盡量使用標準型別 |
Expand Down
Loading