Skip to content

fix(Vehicle): clear communicationLost as soon as any link regains comms#14667

Merged
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:fix-comm-lost-recovery
Jul 21, 2026
Merged

fix(Vehicle): clear communicationLost as soon as any link regains comms#14667
DonLakeFlyer merged 1 commit into
mavlink:masterfrom
DonLakeFlyer:fix-comm-lost-recovery

Conversation

@DonLakeFlyer

Copy link
Copy Markdown
Contributor

Fixes #14666

Problem

When a vehicle has multiple links and all of them lose communication, VehicleLinkManager sets communicationLost. However, recovery required all links to regain comms before communicationLost was cleared. This is asymmetric with how the state is set (total loss requires all links lost), so the vehicle stayed reported as comm lost even though a working link was available and in use.

Fix

_commRegainedOnLink() now clears communicationLost as soon as any link is healthy again.

Testing

New test _multiLinkTotalCommLossRecoveryTest (written first, verified failing against the old code):

  • Connects two links to a single vehicle
  • Drops both links and verifies communicationLostChanged(true)
  • Restores only one link and verifies communicationLostChanged(false) while the other link remains comm lost

Previously recovery from total communication loss required all links to
regain comms before communicationLost was cleared. This is asymmetric
with how the state is set (all links must be lost) and left the vehicle
reported as comm lost even though a working link was available.

Fixes mavlink#14666
Copilot AI review requested due to automatic review settings July 21, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an asymmetry in VehicleLinkManager’s total communication-loss state: the vehicle now exits communicationLost as soon as any single link becomes healthy again, matching the “total loss requires all links lost” behavior. This improves correctness for multi-link vehicles where one link recovers earlier than others.

Changes:

  • Update _commRegainedOnLink() to clear communicationLost when any link has regained comms.
  • Add a new integration test covering multi-link total comm loss recovery when only one link returns.
  • Harden existing tests by asserting MockLink* casts succeed before use.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Vehicle/VehicleLinkManager.cc Clears total communication-loss state as soon as any link is healthy again.
test/Vehicle/VehicleLinkManagerTest.h Registers the new multi-link recovery test slot.
test/Vehicle/VehicleLinkManagerTest.cc Adds _multiLinkTotalCommLossRecoveryTest and adds QVERIFY guards for MockLink casts.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

⚠️ Build results unavailable — artifact download from one or more platform workflows failed (likely artifact retention expiry or transient API error). The combined report cannot be generated for this run.

See the Build Results workflow run for details.

@DonLakeFlyer
DonLakeFlyer merged commit a89def2 into mavlink:master Jul 21, 2026
44 of 48 checks passed
@DonLakeFlyer
DonLakeFlyer deleted the fix-comm-lost-recovery branch July 21, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why is it necessary to check here that all connections are connected?

2 participants