2014-01-03 07:57:50 -04:00
|
|
|
/*
|
|
|
|
A wrapper around the AP_InertialNav class which uses the NavEKF
|
|
|
|
filter if available, and falls back to the AP_InertialNav filter
|
|
|
|
when EKF is not available
|
|
|
|
*/
|
2016-02-17 21:25:30 -04:00
|
|
|
#pragma once
|
2014-01-03 07:57:50 -04:00
|
|
|
|
2015-08-11 03:28:43 -03:00
|
|
|
#include <AP_NavEKF/AP_Nav_Common.h> // definitions shared by inertial and ekf nav filters
|
2015-01-02 04:06:22 -04:00
|
|
|
|
2014-01-03 07:57:50 -04:00
|
|
|
class AP_InertialNav_NavEKF : public AP_InertialNav
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor
|
2015-03-12 23:02:01 -03:00
|
|
|
AP_InertialNav_NavEKF(AP_AHRS_NavEKF &ahrs) :
|
|
|
|
AP_InertialNav(),
|
2014-10-09 04:30:20 -03:00
|
|
|
_ahrs_ekf(ahrs)
|
2015-03-12 10:22:54 -03:00
|
|
|
{}
|
2014-01-03 07:57:50 -04:00
|
|
|
|
2014-01-03 20:16:07 -04:00
|
|
|
/**
|
|
|
|
update internal state
|
|
|
|
*/
|
2019-04-01 03:55:58 -03:00
|
|
|
void update(bool high_vibes = false) override;
|
2014-01-03 20:16:07 -04:00
|
|
|
|
2014-01-03 07:57:50 -04:00
|
|
|
/**
|
2015-01-02 04:06:22 -04:00
|
|
|
* get_filter_status - returns filter status as a series of flags
|
2014-01-03 07:57:50 -04:00
|
|
|
*/
|
2018-11-07 07:26:21 -04:00
|
|
|
nav_filter_status get_filter_status() const override;
|
2014-01-03 07:57:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get_position - returns the current position relative to the home location in cm.
|
|
|
|
*
|
|
|
|
* the home location was set with AP_InertialNav::set_home_position(int32_t, int32_t)
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
2018-11-07 07:26:21 -04:00
|
|
|
const Vector3f& get_position() const override;
|
2014-01-03 07:57:50 -04: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
|
|
|
|
*/
|
2018-11-07 07:26:21 -04:00
|
|
|
const Vector3f& get_velocity() const override;
|
2014-01-03 07:57:50 -04:00
|
|
|
|
|
|
|
/**
|
2017-10-13 00:42:49 -03:00
|
|
|
* get_speed_xy - returns the current horizontal speed in cm/s
|
2014-01-03 07:57:50 -04:00
|
|
|
*
|
2017-10-13 00:42:49 -03:00
|
|
|
* @returns the current horizontal speed in cm/s
|
2014-01-03 07:57:50 -04:00
|
|
|
*/
|
2017-10-13 00:42:49 -03:00
|
|
|
float get_speed_xy() const override;
|
2014-01-03 07:57:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get_altitude - get latest altitude estimate in cm
|
|
|
|
* @return
|
|
|
|
*/
|
2018-11-07 07:26:21 -04:00
|
|
|
float get_altitude() const override;
|
2014-01-03 07:57:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get_velocity_z - returns the current climbrate.
|
|
|
|
*
|
|
|
|
* @see get_velocity().z
|
|
|
|
*
|
|
|
|
* @return climbrate in cm/s
|
|
|
|
*/
|
2018-11-07 07:26:21 -04:00
|
|
|
float get_velocity_z() const override;
|
2014-01-03 20:16:07 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Vector3f _relpos_cm; // NEU
|
|
|
|
Vector3f _velocity_cm; // NEU
|
2014-10-09 04:30:20 -03:00
|
|
|
AP_AHRS_NavEKF &_ahrs_ekf;
|
2014-01-03 07:57:50 -04:00
|
|
|
};
|