2016-02-17 21:25:30 -04:00
|
|
|
#pragma once
|
2012-11-05 00:31:02 -04:00
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include <AP_AHRS/AP_AHRS.h>
|
2015-08-15 19:52:11 -03:00
|
|
|
#include <AP_NavEKF/AP_Nav_Common.h> // definitions shared by inertial and ekf nav filters
|
2012-11-05 00:31:02 -04:00
|
|
|
|
|
|
|
/*
|
2013-10-25 10:55:31 -03:00
|
|
|
* AP_InertialNav blends accelerometer data with gps and barometer data to improve altitude and position hold.
|
|
|
|
*
|
|
|
|
* Most of the functions have to be called at 100Hz. (see defines above)
|
|
|
|
*
|
|
|
|
* The accelerometer values are integrated over time to approximate velocity and position.
|
|
|
|
* The inaccurcy of these estimates grows over time due to noisy sensor data.
|
|
|
|
* To improve the accuracy, baro and gps readings are used:
|
|
|
|
* An error value is calculated as the difference between the sensor's measurement and the last position estimation.
|
|
|
|
* This value is weighted with a gain factor and incorporated into the new estimation
|
2014-08-31 01:23:03 -03:00
|
|
|
*
|
|
|
|
* Special thanks to Tony Lambregts (FAA) for advice which contributed to the development of this filter.
|
|
|
|
*
|
2012-11-05 00:31:02 -04:00
|
|
|
*/
|
2012-11-07 09:24:00 -04:00
|
|
|
class AP_InertialNav
|
2012-11-05 00:31:02 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
// Constructor
|
2015-03-12 23:02:01 -03:00
|
|
|
AP_InertialNav() {}
|
2012-11-05 00:31:02 -04:00
|
|
|
|
2013-10-25 10:55:31 -03:00
|
|
|
/**
|
2019-04-01 03:55:58 -03:00
|
|
|
* updates velocity and position estimates pulling data from EKF
|
|
|
|
* high_vibes should be set to true if high vibration have been detected
|
2013-10-25 10:55:31 -03:00
|
|
|
*/
|
2019-04-01 03:55:58 -03:00
|
|
|
virtual void update(bool high_vibes = false) = 0;
|
2012-11-05 00:31:02 -04:00
|
|
|
|
2015-01-02 04:05:49 -04:00
|
|
|
/**
|
|
|
|
* get_filter_status : returns filter status as a series of flags
|
|
|
|
*/
|
2015-03-12 10:21:08 -03:00
|
|
|
virtual nav_filter_status get_filter_status() const = 0;
|
2015-01-02 04:05:49 -04:00
|
|
|
|
2012-12-09 11:43:11 -04:00
|
|
|
//
|
|
|
|
// XY Axis specific methods
|
|
|
|
//
|
2012-11-05 00:31:02 -04:00
|
|
|
|
2013-10-25 10:55:31 -03:00
|
|
|
/**
|
|
|
|
* get_position - returns the current position relative to the home location in cm.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
2015-03-12 10:21:08 -03:00
|
|
|
virtual const Vector3f& get_position() const = 0;
|
2013-10-25 10:55:31 -03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get_velocity - returns the current velocity in cm/s
|
|
|
|
*
|
|
|
|
* @return velocity vector:
|
|
|
|
* .x : latitude velocity in cm/s
|
|
|
|
* .y : longitude velocity in cm/s
|
|
|
|
* .z : vertical velocity in cm/s
|
|
|
|
*/
|
2015-03-12 10:21:08 -03:00
|
|
|
virtual const Vector3f& get_velocity() const = 0;
|
2013-10-25 10:55:31 -03:00
|
|
|
|
2013-10-29 01:25:14 -03:00
|
|
|
/**
|
2017-10-13 00:42:49 -03:00
|
|
|
* get_speed_xy - returns the current horizontal speed in cm/s
|
2013-10-29 01:25:14 -03:00
|
|
|
*
|
2017-10-13 00:42:49 -03:00
|
|
|
* @returns the current horizontal speed in cm/s
|
2013-10-29 01:25:14 -03:00
|
|
|
*/
|
2017-10-13 00:42:49 -03:00
|
|
|
virtual float get_speed_xy() const = 0;
|
2014-01-03 07:41:03 -04:00
|
|
|
|
2012-12-09 11:43:11 -04:00
|
|
|
//
|
|
|
|
// Z Axis methods
|
|
|
|
//
|
2012-11-05 00:31:02 -04:00
|
|
|
|
2013-10-25 10:55:31 -03:00
|
|
|
/**
|
2014-01-03 20:16:07 -04:00
|
|
|
* get_altitude - get latest altitude estimate in cm above the
|
|
|
|
* reference position
|
2013-10-25 10:55:31 -03:00
|
|
|
* @return
|
|
|
|
*/
|
2015-03-12 10:21:08 -03:00
|
|
|
virtual float get_altitude() const = 0;
|
2012-12-09 11:43:11 -04:00
|
|
|
|
2013-10-25 10:55:31 -03:00
|
|
|
/**
|
|
|
|
* get_velocity_z - returns the current climbrate.
|
|
|
|
*
|
|
|
|
* @see get_velocity().z
|
|
|
|
*
|
2014-01-03 20:16:07 -04:00
|
|
|
* @return climbrate in cm/s (positive up)
|
2013-10-25 10:55:31 -03:00
|
|
|
*/
|
2015-03-12 10:21:08 -03:00
|
|
|
virtual float get_velocity_z() const = 0;
|
2012-11-05 00:31:02 -04:00
|
|
|
};
|