fix(navigator): rtl compute wind angle to select best land approach based on rally point location instead of home location#27004
Conversation
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 528 byte (0.03 %)]px4_fmu-v6x [Total VM Diff: 520 byte (0.03 %)]Updated: 2026-04-11T02:40:23 |
|
Unrelated to your PR, but I just wanted to drop a message to say our CI actions are now able to post comments on fork PRs! |
438485e to
4f722af
Compare
3ddec68 to
35dc7a0
Compare
|
Looks reasonable high level, I would like to get @mbjd 's review on it. |
| if (_vehicle_status_sub.get().is_vtol | ||
| && (_vehicle_status_sub.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) | ||
| && rtl_land_approaches.isAnyApproachValid()) { | ||
| landing_loiter = chooseBestLandingApproach(rtl_land_approaches); |
There was a problem hiding this comment.
Note that this check is now inside of selectLandingApproach to simplify setRtlTypeAndDestination and to avoid checking all approaches if we know we won't use them.
| const float dist{get_distance_to_next_waypoint(_global_pos_sub.get().lat, _global_pos_sub.get().lon, mission_safe_point.lat, mission_safe_point.lon)}; | ||
|
|
||
| PositionYawSetpoint safepoint_position; | ||
| setSafepointAsDestination(safepoint_position, mission_safe_point); |
There was a problem hiding this comment.
Note that setSafepointAsDestination was replaced by extractValidSafePointPosition which returns false if the altitude frame is not valid or if the position is not valid. This change ensures we do not fly to an invalid approach. Especially important if we had other valid approaches.
| PositionYawSetpoint safepoint_position; | ||
| setSafepointAsDestination(safepoint_position, mission_safe_point); | ||
|
|
||
| const bool current_safe_point_has_approaches{hasVtolLandApproach(safepoint_position)}; |
There was a problem hiding this comment.
Note that instead of calling hasVtolLandApproach(safepoint_position) we now call hasVtolLandApproach(current_seq, _home_pos_sub.get().alt). The important change here is the current_seq.
The old code would go through all land approahces starting from index zero (which is not efficient) meaning that if two rally points (A, B) are close enough, we could have ended up with the location from rally point B but the approach from rally point A.
| bool success_mission_item = _dataman_cache_safepoint.loadWait(static_cast<dm_item_t>(_stats.dataman_id), current_seq, | ||
| reinterpret_cast<uint8_t *>(&mission_item), | ||
| sizeof(mission_item_s)); |
There was a problem hiding this comment.
Note that the loadWait call was updated to include the standard 500_ms timeout
| * | ||
| ****************************************************************************/ | ||
|
|
||
| #include <gtest/gtest.h> |
There was a problem hiding this comment.
[error] clang-diagnostic-error [error]
gtest/gtest.h file not found
|
The PR is ready to be reviewed @mbjd (please note that the PR is not very large, 960 lines come from the unit tests) Summary of the main changes:
Tested only using unit tests: |
…llFinite() fails for empty approaches
df38848 to
2df4d55
Compare
Superseded by newer run
… push Branch protection rules block the GITHUB_TOKEN from dismissing reviews (HTTP 403), so every push added another undismissable REQUEST_CHANGES review. PR #27004 accumulated 12 identical blocking reviews. Switch to COMMENT-only reviews. Findings still show inline on the diff but don't create blocking reviews that require manual maintainer dismissal. The CI check status (pass/fail) gates merging, not the review state. Also enable CMAKE_TESTING=ON in the clang-tidy build so test files get proper include paths in compile_commands.json. Without this, clang-tidy-diff runs on test files from the PR diff but can't resolve gtest headers, producing false positives. Fixes #27004 Signed-off-by: Ramon Roche <mrpollo@gmail.com>
… push Branch protection rules block the GITHUB_TOKEN from dismissing reviews (HTTP 403), so every push added another undismissable REQUEST_CHANGES review. PR #27004 accumulated 12 identical blocking reviews. Switch to COMMENT-only reviews. Findings still show inline on the diff but don't create blocking reviews that require manual maintainer dismissal. The CI check status (pass/fail) gates merging, not the review state. Also enable CMAKE_TESTING=ON in the clang-tidy build so test files get proper include paths in compile_commands.json. Without this, clang-tidy-diff runs on test files from the PR diff but can't resolve gtest headers, producing false positives. Fixes #27004 Signed-off-by: Ramon Roche <mrpollo@gmail.com>
… push Branch protection rules block the GITHUB_TOKEN from dismissing reviews (HTTP 403), so every push added another undismissable REQUEST_CHANGES review. PR #27004 accumulated 12 identical blocking reviews. Switch to COMMENT-only reviews. Findings still show inline on the diff but don't create blocking reviews that require manual maintainer dismissal. The CI check status (pass/fail) gates merging, not the review state. Also enable CMAKE_TESTING=ON in the clang-tidy build so test files get proper include paths in compile_commands.json. Without this, clang-tidy-diff runs on test files from the PR diff but can't resolve gtest headers, producing false positives. Fixes #27004 Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
|
Sorry didnt mean to close the PR, I was trying to prevent the damn bot from spamming you. |
As a first step for: #26973 (fyi @mrpollo).
VTOL rally-point land approaches are defined around the rally-point land location, but RTL was choosing between them using the bearing from home. That works only when the landing point is effectively home. For remote safe points it can select the wrong loiter circle even when the available approach data is correct.
Behavior changes:
becomes:
land_approaches_s::num_approaches_maxis reached