Skip to content

Commit fa66805

Browse files
committed
AP_GPS: support EAHRS heading as a GPS heading source
Signed-off-by: Ryan Friedman <25047695+Ryanf55@users.noreply.github.com>
1 parent 374bf29 commit fa66805

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

libraries/AP_GPS/AP_GPS.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ const AP_Param::GroupInfo AP_GPS::var_info[] = {
231231
// @Param: _DRV_OPTIONS
232232
// @DisplayName: driver options
233233
// @Description: Additional backend specific options
234-
// @Bitmask: 0:Use UART2 for moving baseline on ublox,1:Use base station for GPS yaw on SBF,2:Use baudrate 115200 on ublox,3:Use dedicated CAN port b/w GPSes for moving baseline,4:Use ellipsoid height instead of AMSL, 5:Override GPS satellite health of L5 band from L1 health, 6:Enable RTCM full parse even for a single channel, 7:Disable automatic full RTCM parsing when RTCM seen on more than one channel, 8:Force UBlox Config Get/Set for configuration then automatic configuration for Serial GPSes only
234+
// @Bitmask: 0:Use UART2 for moving baseline on ublox,1:Use base station for GPS yaw on SBF,2:Use baudrate 115200 on ublox,3:Use dedicated CAN port b/w GPSes for moving baseline,4:Use ellipsoid height instead of AMSL, 5:Override GPS satellite health of L5 band from L1 health, 6:Enable RTCM full parse even for a single channel, 7:Disable automatic full RTCM parsing when RTCM seen on more than one channel, 8:Force UBlox Config Get/Set for configuration then automatic configuration for Serial GPSes only, 9:Fuse heading from EAHRS GPS when available
235235
// @User: Advanced
236236
AP_GROUPINFO("_DRV_OPTIONS", 22, AP_GPS, _driver_options, 0),
237237

libraries/AP_GPS/AP_GPS.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ class AP_GPS
630630
GPSL5HealthOverride = (1U << 5),
631631
AlwaysRTCMDecode = (1U << 6),
632632
DisableRTCMDecode = (1U << 7),
633-
ForceUBXConfigV2 = (1U << 8U)
633+
ForceUBXConfigV2 = (1U << 8U),
634+
FuseEARHSHeading = (1U << 9U)
634635
};
635636

636637
// check if an option is set

libraries/AP_GPS/AP_GPS_ExternalAHRS.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,22 @@ void AP_GPS_ExternalAHRS::handle_external(const AP_ExternalAHRS::gps_data_messag
8282

8383
state.last_gps_time_ms = AP_HAL::millis();
8484

85+
if (option_set(AP_GPS::DriverOptions::FuseEARHSHeading) && pkt.have_heading) {
86+
87+
state.gps_yaw_configured = true;
88+
state.gps_yaw = pkt.heading;
89+
state.gps_yaw_time_ms = state.last_gps_time_ms;
90+
if (pkt.have_heading_acc) {
91+
state.have_gps_yaw_accuracy = true;
92+
state.gps_yaw_accuracy = pkt.heading_accuracy;
93+
} else {
94+
state.have_gps_yaw_accuracy = false;
95+
}
96+
} else {
97+
state.gps_yaw_configured = false;
98+
state.have_gps_yaw_accuracy = false;
99+
}
100+
85101
new_data = true;
86102
}
87103

0 commit comments

Comments
 (0)