AHRS/VisualOdom/Copter: allow visual odometry to align yaw to GPS-for-yaw #18380
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.
This PR (in a roundabout way) allows AP_VisualOdom (aka ExternalNav) to align its yaw to the AHRS's yaw even if the yaw source is GSF or GPS-for-yaw. This resolves the 2nd item in issue #15859
To provide some background, in AP_VisualOdom_IntelT265::align_sensor_to_vehicle() we have the check shown below to protect against re-aligning the external nav system's yaw (e.g. T265) to the AHRS's yaw if the AHRS is using the camera as its source (aka "drinking our own bathwater"). This is important to avoid a slight random shift on each alignment.
The problem is that the AP_AHRS::is_ext_nav_used_for_yaw() returns true (if EKF3 is active) if the yaw source is ExtNav, GSF or GPS-for-yaw meaning AP_VisualOdom can't align to any of these sources.. but it should be able to align to GSF or GPS-for-yaw. This badly named method is renamed to "using_noncompass_for_yaw" and a new "using_extnav_for_yaw" method is added.
This has been tested in SITL using gps-for-yaw and vicon together and below are screenshots showing BEFORE (where the visual odom could not be re-aligned to match gps-for-yaw) and AFTER where it was re-aligned.
![sitl-before](https://user-images.githubusercontent.com/1498098/130190099-72ee60cc-dbc6-4e1a-aac7-36b1a94d5b94.png)
![sitl-test-aligned-yaw-to-gps-for-yaw](https://user-images.githubusercontent.com/1498098/130190110-627b9556-9b3b-4ab4-89c0-dfa62489c933.png)