Skip to content

Conversation

Copy link

Copilot AI commented Aug 22, 2025

This PR adds the necessary topic bridging configuration to enable the latency checker nodes to communicate across ROS 2 domains in the swarm system.

Problem

The latency checker nodes publish and subscribe to heartbeat topics to measure network latency between peers (host and drones). However, these topics were not configured in the domain bridge configurations, preventing cross-domain communication between:

  • Host latency checker (running in domain 0)
  • Drone latency checkers (each running in their respective domain numbers)

Solution

Added latency checker heartbeat topic bridging to both bridge configuration templates:

Host Bridge Config (host_bridge_config.yaml.j2)

  • Host-to-drones: Bridges host heartbeat topic from domain 0 to all drone domains
  • Drones-to-host: Creates separate bridge configurations for each drone's heartbeat topic from drone domain to host domain 0

Drone Bridge Config (drone_bridge_config.yaml.j2)

  • Drone-to-host: Bridges the drone's own heartbeat topic from drone domain to host domain 0
  • Host/peers-to-drone: Bridges host and other drones' heartbeat topics from domain 0 to the drone's domain

Topic Pattern

The latency checker uses the following topic naming convention:

  • Topic: /{namespace}/latency_checker/heartbeat
  • Message type: latency_checker_ros2/msg/Heartbeat

Where {namespace} is:

  • Host: hostname with .local removed and - replaced with _
  • Drones: nxt{N} where N is the drone number

Bridge Flow

  1. Host publishes heartbeat → bridged to all drone domains
  2. Each drone publishes heartbeat → bridged to domain 0 (host)
  3. Cross-drone communication → routed via domain 0 hub

This enables full peer-to-peer latency monitoring between the host and all drones through the existing domain bridge infrastructure.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
Copilot AI changed the title [WIP] can you add the topics needed by the latency checker to the drone and host bridge configs? Add latency checker heartbeat topics to domain bridge configurations Aug 22, 2025
Copilot AI requested a review from nielmistry August 22, 2025 13:18
Copilot finished work on behalf of nielmistry August 22, 2025 13:18
Copy link
Member

@nielmistry nielmistry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 11 to 27
---
# Bridge topics from host domain 0 to this drone domain
name: host_to_drone_bridge
from_domain: 0
to_domain: {{ drone_num }}
topics:
# Host latency checker heartbeat to drone
/{{ host_hostname | map('regex_replace', '\\.local', '') | map('regex_replace', '-', '_') | join('') }}/latency_checker/heartbeat:
type: latency_checker_ros2/msg/Heartbeat
# Other drones' latency checker heartbeats to this drone
{% for peer in groups['drones'] %}
{% set peer_num = peer | regex_replace('\\.local', '') | regex_search('[0-9]+$') %}
{% if peer_num != drone_num %}
/nxt{{ peer_num }}/latency_checker/heartbeat:
type: latency_checker_ros2/msg/Heartbeat
{% endif %}
{% endfor %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
---
# Bridge topics from host domain 0 to this drone domain
name: host_to_drone_bridge
from_domain: 0
to_domain: {{ drone_num }}
topics:
# Host latency checker heartbeat to drone
/{{ host_hostname | map('regex_replace', '\\.local', '') | map('regex_replace', '-', '_') | join('') }}/latency_checker/heartbeat:
type: latency_checker_ros2/msg/Heartbeat
# Other drones' latency checker heartbeats to this drone
{% for peer in groups['drones'] %}
{% set peer_num = peer | regex_replace('\\.local', '') | regex_search('[0-9]+$') %}
{% if peer_num != drone_num %}
/nxt{{ peer_num }}/latency_checker/heartbeat:
type: latency_checker_ros2/msg/Heartbeat
{% endif %}
{% endfor %}

no need to have this here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the unnecessary second bridge configuration from drone bridge config. Now only bridges drone's own topics from drone domain to host domain 0. (b8aa47c)

Comment on lines 10 to 16
{% endfor %}
# Latency checker topics: host heartbeat to all drone domains
{% for drone in groups['drones'] %}
{% set num = drone | regex_replace('\\.local', '') | regex_search('[0-9]+$') %}
/{{ host_hostname | map('regex_replace', '\\.local', '') | map('regex_replace', '-', '_') | join('') }}/latency_checker/heartbeat:
type: latency_checker_ros2/msg/Heartbeat
to_domain: {{ num }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have to make a whole new for block. its the same as the above so just roll it in!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consolidated the latency checker topics into the existing for loop alongside the optitrack topics. Now both topics are bridged together for each drone domain. (b8aa47c)

Comment on lines 17 to 30
{% endfor %}

---
# Bridge drone latency checker heartbeats from each drone domain to host domain 0
{% for drone in groups['drones'] %}
{% set num = drone | regex_replace('\\.local', '') | regex_search('[0-9]+$') %}
name: drone{{ num }}_to_host_bridge
from_domain: {{ num }}
to_domain: 0
topics:
/nxt{{ num }}/latency_checker/heartbeat:
type: latency_checker_ros2/msg/Heartbeat

---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the unnecessary additional bridge configurations. The latency checker topics are now handled within the existing single bridge configuration. (b8aa47c)

Co-authored-by: nielmistry <10933146+nielmistry@users.noreply.github.com>
Copilot AI requested a review from nielmistry August 22, 2025 15:13
Copilot finished work on behalf of nielmistry August 22, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants