ardupilot/ArduSub/inertia.cpp

26 lines
645 B
C++
Raw Normal View History

2016-01-14 15:30:56 -04:00
#include "Sub.h"
// read_inertia - read inertia in from accelerometers
2016-01-14 15:30:56 -04:00
void Sub::read_inertia()
{
// inertial altitude estimates
2019-06-28 10:55:49 -03:00
inertial_nav.update();
2019-06-28 10:55:49 -03:00
// pull position from ahrs
Location loc;
ahrs.get_position(loc);
current_loc.lat = loc.lat;
current_loc.lng = loc.lng;
2016-05-03 01:45:37 -03:00
// exit immediately if we do not have an altitude estimate
if (!inertial_nav.get_filter_status().flags.vert_pos) {
return;
}
current_loc.alt = inertial_nav.get_altitude();
// get velocity, altitude is always absolute frame, referenced from
// water's surface
climb_rate = inertial_nav.get_velocity_z();
}