fix(Vehicle): clear communicationLost as soon as any link regains comms#14667
Merged
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
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 clearcommunicationLostwhen 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. |
Contributor
|
See the Build Results workflow run for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14666
Problem
When a vehicle has multiple links and all of them lose communication,
VehicleLinkManagersetscommunicationLost. However, recovery required all links to regain comms beforecommunicationLostwas 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 clearscommunicationLostas soon as any link is healthy again.Testing
New test
_multiLinkTotalCommLossRecoveryTest(written first, verified failing against the old code):communicationLostChanged(true)communicationLostChanged(false)while the other link remains comm lost