#include "Copter.h"
void Copter::read_inertia()
{
pos_control->update_estimates(vibration_check.high_vibes);
#if MODE_FOLLOW_ENABLED
g2.follow.update_estimates();
#endif
Location loc;
ahrs.get_location(loc);
current_loc.lat = loc.lat;
current_loc.lng = loc.lng;
float pos_d_m;
if (!AP::ahrs().get_relative_position_D_origin_float(pos_d_m)) {
return;
}
const float alt_above_origin_m = -pos_d_m;
current_loc.set_alt_m(alt_above_origin_m, Location::AltFrame::ABOVE_ORIGIN);
if (!ahrs.home_is_set() || !current_loc.change_alt_frame(Location::AltFrame::ABOVE_HOME)) {
current_loc.set_alt_m(alt_above_origin_m, Location::AltFrame::ABOVE_HOME);
}
}