forked from ArduPilot/ardupilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinertia.cpp
26 lines (22 loc) · 823 Bytes
/
inertia.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "Copter.h"
// read_inertia - read inertia in from accelerometers
void Copter::read_inertia()
{
// inertial altitude estimates
inertial_nav.update(G_Dt);
// pull position from interial nav library
current_loc.lng = inertial_nav.get_longitude();
current_loc.lat = inertial_nav.get_latitude();
// exit immediately if we do not have an altitude estimate
if (!inertial_nav.get_filter_status().flags.vert_pos) {
return;
}
if (ahrs.home_is_set()) {
current_loc.set_alt_cm(inertial_nav.get_altitude(),
Location::AltFrame::ABOVE_HOME);
} else {
// without home use alt above the EKF origin
current_loc.set_alt_cm(inertial_nav.get_altitude(),
Location::AltFrame::ABOVE_ORIGIN);
}
}