# bridge.yaml — the machine boundary of the lite_offload_global split stack
# (a split stack carries one launch entry point per host role
# plus THIS explicit list of every topic/service/action crossing the
# boundary — the bridge list feeds DDS-router config generation and *is* the
# split, readable in source; explicit beats derived).
#
# Names are RELATIVE to the robot namespace: tools/gen_dds_router.py prefixes
# rt/$(env ROBOT_NAME)/ (topics), rq/rr/$(env ROBOT_NAME)/ (services), and
# expands actions into their five DDS sub-endpoints. Regenerate the router
# config after every edit:
#
#     python3 tools/gen_dds_router.py stacks/lite_offload_global/bridge.yaml
#
# Entry fields:
#   topic|service|action : exactly one — the relative name
#   type                 : ROS interface type (pkg/msg|srv|action/Name)
#   direction            : onboard_to_offboard | offboard_to_onboard
#                          (data flow for topics; request/goal flow for
#                          services and actions). The DDS router itself
#                          bridges bidirectionally; direction documents intent
#                          and drives the wiring.md boundary rendering.
#   qos                  : reliable | best_effort (topics; QoS verified
#                          against full_default's observed wiring.md).
#
# HARD GATE: control_setpoint and trajectory-group
# names (trajectory_override, trajectory_segment_to_add, set_trajectory_mode,
# tracking_point, look_ahead — the trajectory_controller/* group) must NEVER
# appear here. Command authority stays onboard; link loss must leave the
# vehicle able to failsafe. `gen_dds_router.py --check` (run by
# `airstack doctor`) exits 1 naming any violation.
#
# Seeded from the legacy onboard_local_offboard_global dds_router.yaml
# allowlist (its extension + the onboard_all base it extended). Both legacy
# role folders are REMOVED — the base allowlist now lives at
# autonomy_bringup/config/dds_router.yaml, and THIS file (via
# tools/gen_dds_router.py) fully replaces the legacy split's router config.
# Deliberately NOT carried over from that allowlist:
#   - trajectory_controller/set_trajectory_mode (service) — trajectory group:
#     the hard gate above. Mode changes are owned by the onboard task servers.
#   - trajectory_controller/trajectory_vis — the trajectory_controller/* group
#     stays off the bridge wholesale.
#   - vdb_mapping/vdb_map_visualization — vdb_mapping runs OFFBOARD in this
#     split; its viz is already on the ground host, nothing onboard consumes it.
#   - bag_record/* — lite stacks run no logging layer.
#   - behavior/global_plan_toggle (service) — no node serves it in the current
#     graph (vestigial remap in the deleted legacy global.launch.xml).
#   - sensors/front_stereo/right/depth_ground_truth — sim-only ground truth.

version: 1
stack: lite_offload_global

bridge:
  # ── onboard → offboard: what the global layer (and the operator) needs ──

  - topic: sensors/ouster/point_cloud
    type: sensor_msgs/msg/PointCloud2
    direction: onboard_to_offboard
    qos: reliable        # filtered lidar cloud → vdb_mapping (offboard)

  - topic: odometry_conversion/odometry
    type: nav_msgs/msg/Odometry
    direction: onboard_to_offboard
    qos: reliable        # v1 canonical odometry → random_walk + ground state

  - topic: sensors/front_stereo/left/image_rect
    type: sensor_msgs/msg/Image
    direction: onboard_to_offboard
    qos: best_effort     # operator video (legacy onboard allowlist)

  - topic: sensors/front_stereo/left/camera_info
    type: sensor_msgs/msg/CameraInfo
    direction: onboard_to_offboard
    qos: best_effort

  - topic: sensors/front_stereo/right/image_rect
    type: sensor_msgs/msg/Image
    direction: onboard_to_offboard
    qos: best_effort

  - topic: sensors/front_stereo/right/camera_info
    type: sensor_msgs/msg/CameraInfo
    direction: onboard_to_offboard
    qos: best_effort

  - topic: perception/stereo_image_proc/point_cloud
    type: sensor_msgs/msg/PointCloud2
    direction: onboard_to_offboard
    qos: reliable        # ground visualization (legacy base allowlist)

  - topic: interface/mavros/global_position/global
    type: sensor_msgs/msg/NavSatFix
    direction: onboard_to_offboard
    qos: best_effort     # ground map view / GPS-frame task goals

  # ── offboard → onboard: the split's outputs ─────────────────────────────
  # global_plan crosses; trajectory commands DON'T (hard gate above).

  - topic: global_plan
    type: nav_msgs/msg/Path
    direction: offboard_to_onboard
    qos: reliable        # random_walk (offboard) → droan_gl (onboard)

  # ── services: ground/offboard requests into the vehicle ─────────────────

  - service: interface/robot_command
    type: airstack_msgs/srv/RobotCommand
    direction: offboard_to_onboard   # arm/takeoff-authority requests

  - service: takeoff_landing_planner/set_takeoff_landing_command
    type: airstack_msgs/srv/TakeoffLandingCommand
    direction: offboard_to_onboard   # operator takeoff/land commands

  # ── actions: task goals across the boundary ─────────────────────────────

  - action: tasks/navigate
    type: task_msgs/action/NavigateTask
    direction: offboard_to_onboard   # offboard random_walk → onboard droan_gl

  - action: tasks/exploration
    type: task_msgs/action/ExplorationTask
    direction: onboard_to_offboard   # server moves offboard with random_walk;
                                     # onboard/ground clients reach it here
