-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix: Ghosting effect on the flight path when dragging the takeoff point. #13810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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 a ghosting effect when dragging the takeoff (home) point in the mission planner by refactoring how coordinate changes are handled.
Key Changes:
- Replaces automatic full mission recalculation with targeted coordinate updates when dragging the takeoff point
- Implements a lambda connection to synchronize the takeoff item coordinate with the launch coordinate and emit the appropriate signal
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/MissionManager/TakeoffMissionItem.cc | Adds a lambda to handle coordinate synchronization between settings item and takeoff item when the launch coordinate changes |
| src/MissionManager/MissionController.cc | Comments out the broad _recalcAll connection to prevent redundant full mission recalculations during coordinate updates |
| _editorQml = QStringLiteral("qrc:/qml/QGroundControl/Controls/SimpleItemEditor.qml"); | ||
|
|
||
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &TakeoffMissionItem::launchCoordinateChanged); | ||
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, [=](const QGeoCoordinate& coordinate) { |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda capture [=] is deprecated in C++20 when capturing this implicitly. Use [this] instead to be explicit about capturing the object pointer. This matches the pattern used elsewhere in the codebase (see GeoFenceController.cc:108 and RallyPointController.cc:69 for examples).
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, [=](const QGeoCoordinate& coordinate) { | |
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, [this](const QGeoCoordinate& coordinate) { |
| } | ||
|
|
||
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::_recalcAll); | ||
| //connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::_recalcAll); |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commented-out code should be removed entirely rather than left as a comment. The disconnect for this connection in _deinitAllVisualItems (line 1916) should also be removed to maintain consistency.
| //connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &MissionController::_recalcAll); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this can be disconnected. I need to dig into the recalc code a bunch more. But the location of the home position drives things like mission status lengths/times and so forth. By disconnecting there is some info down deep in the bowels of MissionController that will be wrong now I believe. Gonna take a pile more review on my part to verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting a bit closer to re-educating myself on all of this. I think the coordinateChanged signal needs to be connected to the signal which recalcs just mission flight status instead. Not 100% sure yet. After being away from MissionController it's so dense to get back into! Could use a full re-write to make it more understandable.
|
|
||
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &TakeoffMissionItem::launchCoordinateChanged); | ||
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, [=](const QGeoCoordinate& coordinate) { | ||
| SimpleMissionItem::setCoordinate(coordinate); |
Copilot
AI
Dec 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lambda unconditionally updates the SimpleMissionItem coordinate when the settings item coordinate changes, without checking the _launchTakeoffAtSameLocation flag. This may cause the takeoff point to follow the launch point even when the user has configured them to be at different locations. Consider checking _launchTakeoffAtSameLocation before calling SimpleMissionItem::setCoordinate(coordinate), similar to the logic in TakeoffMissionItem::setCoordinate at lines 113-114.
| SimpleMissionItem::setCoordinate(coordinate); | |
| if (_launchTakeoffAtSameLocation) { | |
| SimpleMissionItem::setCoordinate(coordinate); | |
| } |
|
|
||
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, &TakeoffMissionItem::launchCoordinateChanged); | ||
| connect(_settingsItem, &MissionSettingsItem::coordinateChanged, this, [=](const QGeoCoordinate& coordinate) { | ||
| SimpleMissionItem::setCoordinate(coordinate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't correct either. In the fly view the home position which is kept in the settings items can differ from the takeoff coordinate. In the plan view it's the takeoff item job to drag the launch position along with it. So the user doesn't have the ability to move the home position if they are using a takeoff item. It's all ridiculously complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then for a fixed wing on PX4 it's all different!
Description
Problem: While dragging the takeoff (Home) point, the flight path displayed a "ghosting" or overlapping effect. This was caused by redundant or improperly sequenced calls to
_recalcAllduring the coordinate update process, which failed to clear the old route buffer correctly while the user was actively moving the point.Changes:
_recalcAllcall oncoordinateChangedfor the settings item.SimpleMissionItemcoordinate and emitslaunchCoordinateChangeddirectly.Type of Change
Testing
Platforms Tested
Flight Stacks Tested
Checklist