Rover: compass set-initial-location uses ahrs location
Previously it could attempt to use a gps location even if gps was not being used Also compass-accumulate moved to sensors.cpp
This commit is contained in:
parent
584974fd74
commit
eb2aa80fca
@ -235,16 +235,6 @@ void Rover::gcs_failsafe_check(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if the compass is enabled then try to accumulate a reading
|
||||
*/
|
||||
void Rover::compass_accumulate(void)
|
||||
{
|
||||
if (g.compass_enabled) {
|
||||
compass.accumulate();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
check for new compass data - 10Hz
|
||||
*/
|
||||
|
@ -334,6 +334,9 @@ private:
|
||||
// true if the system time has been set from the GPS
|
||||
bool system_time_set;
|
||||
|
||||
// true if the compass's initial location has been set
|
||||
bool compass_init_location;
|
||||
|
||||
// The location of the previous waypoint. Used for track following and altitude ramp calculations
|
||||
struct Location prev_WP;
|
||||
// The location of the current/active waypoint. Used for track following
|
||||
|
@ -106,10 +106,6 @@ bool Rover::set_home(const Location& loc, bool lock)
|
||||
|
||||
// init compass declination
|
||||
if (home_is_set == HOME_UNSET) {
|
||||
// Set compass declination automatically
|
||||
if (g.compass_enabled) {
|
||||
compass.set_initial_location(loc.lat, loc.lng);
|
||||
}
|
||||
// record home is set
|
||||
home_is_set = HOME_SET_NOT_LOCKED;
|
||||
|
||||
|
@ -1,5 +1,27 @@
|
||||
#include "Rover.h"
|
||||
|
||||
/*
|
||||
if the compass is enabled then try to accumulate a reading
|
||||
also update initial location used for declination
|
||||
*/
|
||||
void Rover::compass_accumulate(void)
|
||||
{
|
||||
if (!g.compass_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
compass.accumulate();
|
||||
|
||||
// update initial location used for declination
|
||||
if (!compass_init_location) {
|
||||
Location loc;
|
||||
if (ahrs.get_position(loc)) {
|
||||
compass.set_initial_location(loc.lat, loc.lng);
|
||||
compass_init_location = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Rover::init_barometer(bool full_calibration)
|
||||
{
|
||||
gcs_send_text(MAV_SEVERITY_INFO, "Calibrating barometer");
|
||||
|
Loading…
Reference in New Issue
Block a user