4 update INS and attitude
6 void Tracker::update_ahrs()
12 read and update compass
14 void Tracker::update_compass(void)
19 // Save compass offsets
20 void Tracker::compass_save() {
21 if (AP::compass().available() &&
22 compass
.get_learn_type() >= Compass::LEARN_INTERNAL
&&
23 !hal
.util
->get_soft_armed()) {
24 compass
.save_offsets();
31 void Tracker::update_GPS(void)
35 static uint32_t last_gps_msg_ms
;
36 static uint8_t ground_start_count
= 5;
37 if (gps
.last_message_time_ms() != last_gps_msg_ms
&&
38 gps
.status() >= AP_GPS::GPS_OK_FIX_3D
) {
39 last_gps_msg_ms
= gps
.last_message_time_ms();
41 if (ground_start_count
> 1) {
43 } else if (ground_start_count
== 1) {
44 // We countdown N number of good GPS fixes
45 // so that the altitude is more accurate
46 // -------------------------------------
47 if (current_loc
.lat
== 0 && current_loc
.lng
== 0) {
48 ground_start_count
= 5;
51 // Now have an initial GPS position
52 // use it as the HOME position in future startups
53 current_loc
= gps
.location();
54 IGNORE_RETURN(set_home(current_loc
, false));
55 ground_start_count
= 0;
61 void Tracker::handle_battery_failsafe(const char* type_str
, const int8_t action
)
64 // useful failsafes in the future would include actually recalling the vehicle
65 // that is tracked before the tracker loses power to continue tracking it