ardupilot/libraries/AP_InertialNav/AP_InertialNav.h

119 lines
3.5 KiB
C
Raw Normal View History

/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#ifndef __AP_INERTIALNAV_H__
#define __AP_INERTIALNAV_H__
#include <AP_AHRS.h>
#include <AP_InertialSensor.h> // ArduPilot Mega IMU Library
#include <AP_Baro.h> // ArduPilot Mega Barometer Library
#include <AP_Buffer.h> // FIFO buffer library
2015-02-08 22:09:02 -04:00
#include "../AP_NavEKF/AP_Nav_Common.h" // definitions shared by inertial and ekf nav filters
/*
* 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
*
* Special thanks to Tony Lambregts (FAA) for advice which contributed to the development of this filter.
*
*/
class AP_InertialNav
{
public:
// Constructor
AP_InertialNav() {}
/**
* update - updates velocity and position estimates using latest info from accelerometers
* augmented with gps and baro readings
*
* @param dt : time since last update in seconds
*/
2015-03-12 10:21:08 -03:00
virtual void update(float dt) = 0;
/**
* 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;
/**
* get_origin - returns the inertial navigation origin in lat/lon/alt
*
* @return origin Location
*/
2015-03-12 10:21:08 -03:00
virtual struct Location get_origin() const = 0;
//
// XY Axis specific methods
//
/**
* 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;
/**
* get_latitude - returns the latitude of the current position estimation in 100 nano degrees (i.e. degree value multiplied by 10,000,000)
* @return
*/
2015-03-12 10:21:08 -03:00
virtual int32_t get_latitude() const = 0;
/**
* get_longitude - returns the longitude of the current position estimation in 100 nano degrees (i.e. degree value multiplied by 10,000,000)
* @return
*/
2015-03-12 10:21:08 -03:00
virtual int32_t get_longitude() const = 0;
2013-03-27 02:09:04 -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-29 01:25:14 -03:00
/**
* get_velocity_xy - returns the current horizontal velocity in cm/s
*
* @returns the current horizontal velocity in cm/s
*/
2015-03-12 10:21:08 -03:00
virtual float get_velocity_xy() const = 0;
2014-01-03 07:41:03 -04:00
//
// Z Axis methods
//
/**
* get_altitude - get latest altitude estimate in cm above the
* reference position
* @return
*/
2015-03-12 10:21:08 -03:00
virtual float get_altitude() const = 0;
/**
* get_velocity_z - returns the current climbrate.
*
* @see get_velocity().z
*
* @return climbrate in cm/s (positive up)
*/
2015-03-12 10:21:08 -03:00
virtual float get_velocity_z() const = 0;
};
#if AP_AHRS_NAVEKF_AVAILABLE
#include "AP_InertialNav_NavEKF.h"
#endif
#endif // __AP_INERTIALNAV_H__