mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 02:53:34 +08:00
AttPosEKF: Move documentation to header file
This commit is contained in:
@@ -332,13 +332,13 @@ private:
|
|||||||
namespace estimator
|
namespace estimator
|
||||||
{
|
{
|
||||||
|
|
||||||
/* oddly, ERROR is not defined for c++ */
|
/* oddly, ERROR is not defined for c++ */
|
||||||
#ifdef ERROR
|
#ifdef ERROR
|
||||||
# undef ERROR
|
# undef ERROR
|
||||||
#endif
|
#endif
|
||||||
static const int ERROR = -1;
|
static const int ERROR = -1;
|
||||||
|
|
||||||
AttitudePositionEstimatorEKF *g_estimator = nullptr;
|
AttitudePositionEstimatorEKF *g_estimator = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() :
|
AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() :
|
||||||
@@ -525,16 +525,14 @@ AttitudePositionEstimatorEKF::~AttitudePositionEstimatorEKF()
|
|||||||
estimator::g_estimator = nullptr;
|
estimator::g_estimator = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int AttitudePositionEstimatorEKF::enable_logging(bool logging)
|
||||||
AttitudePositionEstimatorEKF::enable_logging(bool logging)
|
|
||||||
{
|
{
|
||||||
_ekf_logging = logging;
|
_ekf_logging = logging;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int AttitudePositionEstimatorEKF::parameters_update()
|
||||||
AttitudePositionEstimatorEKF::parameters_update()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
param_get(_parameter_handles.vel_delay_ms, &(_parameters.vel_delay_ms));
|
param_get(_parameter_handles.vel_delay_ms, &(_parameters.vel_delay_ms));
|
||||||
@@ -578,8 +576,7 @@ AttitudePositionEstimatorEKF::parameters_update()
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void AttitudePositionEstimatorEKF::vehicle_status_poll()
|
||||||
AttitudePositionEstimatorEKF::vehicle_status_poll()
|
|
||||||
{
|
{
|
||||||
bool vstatus_updated;
|
bool vstatus_updated;
|
||||||
|
|
||||||
@@ -592,8 +589,7 @@ AttitudePositionEstimatorEKF::vehicle_status_poll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int AttitudePositionEstimatorEKF::check_filter_state()
|
||||||
AttitudePositionEstimatorEKF::check_filter_state()
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* CHECK IF THE INPUT DATA IS SANE
|
* CHECK IF THE INPUT DATA IS SANE
|
||||||
@@ -709,14 +705,12 @@ AttitudePositionEstimatorEKF::check_filter_state()
|
|||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void AttitudePositionEstimatorEKF::task_main_trampoline(int argc, char *argv[])
|
||||||
AttitudePositionEstimatorEKF::task_main_trampoline(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
estimator::g_estimator->task_main();
|
estimator::g_estimator->task_main();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void AttitudePositionEstimatorEKF::task_main()
|
||||||
AttitudePositionEstimatorEKF::task_main()
|
|
||||||
{
|
{
|
||||||
_mavlink_fd = open(MAVLINK_LOG_DEVICE, 0);
|
_mavlink_fd = open(MAVLINK_LOG_DEVICE, 0);
|
||||||
|
|
||||||
@@ -1637,8 +1631,7 @@ AttitudePositionEstimatorEKF::task_main()
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int AttitudePositionEstimatorEKF::start()
|
||||||
AttitudePositionEstimatorEKF::start()
|
|
||||||
{
|
{
|
||||||
ASSERT(_estimator_task == -1);
|
ASSERT(_estimator_task == -1);
|
||||||
|
|
||||||
@@ -1658,8 +1651,7 @@ AttitudePositionEstimatorEKF::start()
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void AttitudePositionEstimatorEKF::print_status()
|
||||||
AttitudePositionEstimatorEKF::print_status()
|
|
||||||
{
|
{
|
||||||
math::Quaternion q(_ekf->states[0], _ekf->states[1], _ekf->states[2], _ekf->states[3]);
|
math::Quaternion q(_ekf->states[0], _ekf->states[1], _ekf->states[2], _ekf->states[3]);
|
||||||
math::Matrix<3, 3> R = q.to_dcm();
|
math::Matrix<3, 3> R = q.to_dcm();
|
||||||
|
|||||||
@@ -2049,11 +2049,6 @@ void AttPosEKF::FuseOptFlow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Estimation of optical flow sensor focal length scale factor and terrain height using a two state EKF
|
|
||||||
This fiter requires optical flow rates that are not motion compensated
|
|
||||||
Range to ground measurement is assumed to be via a narrow beam type sensor - eg laser
|
|
||||||
*/
|
|
||||||
void AttPosEKF::OpticalFlowEKF()
|
void AttPosEKF::OpticalFlowEKF()
|
||||||
{
|
{
|
||||||
// propagate ground position state noise each time this is called using the difference in position since the last observations and an RMS gradient assumption
|
// propagate ground position state noise each time this is called using the difference in position since the last observations and an RMS gradient assumption
|
||||||
@@ -2806,12 +2801,6 @@ bool AttPosEKF::FilterHealthy()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the filter position states
|
|
||||||
*
|
|
||||||
* This resets the position to the last GPS measurement
|
|
||||||
* or to zero in case of static position.
|
|
||||||
*/
|
|
||||||
void AttPosEKF::ResetPosition(void)
|
void AttPosEKF::ResetPosition(void)
|
||||||
{
|
{
|
||||||
if (staticMode) {
|
if (staticMode) {
|
||||||
@@ -2825,20 +2814,12 @@ void AttPosEKF::ResetPosition(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the height state.
|
|
||||||
*
|
|
||||||
* This resets the height state with the last altitude measurements
|
|
||||||
*/
|
|
||||||
void AttPosEKF::ResetHeight(void)
|
void AttPosEKF::ResetHeight(void)
|
||||||
{
|
{
|
||||||
// write to the state vector
|
// write to the state vector
|
||||||
states[9] = -hgtMea;
|
states[9] = -hgtMea;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the velocity state.
|
|
||||||
*/
|
|
||||||
void AttPosEKF::ResetVelocity(void)
|
void AttPosEKF::ResetVelocity(void)
|
||||||
{
|
{
|
||||||
if (staticMode) {
|
if (staticMode) {
|
||||||
@@ -2931,15 +2912,6 @@ out:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check the filter inputs and bound its operational state
|
|
||||||
*
|
|
||||||
* This check will reset the filter states if required
|
|
||||||
* due to a failure of consistency or timeout checks.
|
|
||||||
* it should be run after the measurement data has been
|
|
||||||
* updated, but before any of the fusion steps are
|
|
||||||
* executed.
|
|
||||||
*/
|
|
||||||
int AttPosEKF::CheckAndBound(struct ekf_status_report *last_error)
|
int AttPosEKF::CheckAndBound(struct ekf_status_report *last_error)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,12 @@ public:
|
|||||||
|
|
||||||
void FuseOptFlow();
|
void FuseOptFlow();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Estimation of optical flow sensor focal length scale factor and terrain height using a two state EKF
|
||||||
|
* This fiter requires optical flow rates that are not motion compensated
|
||||||
|
* Range to ground measurement is assumed to be via a narrow beam type sensor - eg laser
|
||||||
|
**/
|
||||||
void OpticalFlowEKF();
|
void OpticalFlowEKF();
|
||||||
|
|
||||||
void zeroRows(float (&covMat)[EKF_STATE_ESTIMATES][EKF_STATE_ESTIMATES], uint8_t first, uint8_t last);
|
void zeroRows(float (&covMat)[EKF_STATE_ESTIMATES][EKF_STATE_ESTIMATES], uint8_t first, uint8_t last);
|
||||||
@@ -290,10 +296,31 @@ public:
|
|||||||
|
|
||||||
void ForceSymmetry();
|
void ForceSymmetry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Check the filter inputs and bound its operational state
|
||||||
|
*
|
||||||
|
* This check will reset the filter states if required
|
||||||
|
* due to a failure of consistency or timeout checks.
|
||||||
|
* it should be run after the measurement data has been
|
||||||
|
* updated, but before any of the fusion steps are
|
||||||
|
* executed.
|
||||||
|
*/
|
||||||
int CheckAndBound(struct ekf_status_report *last_error);
|
int CheckAndBound(struct ekf_status_report *last_error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Reset the filter position states
|
||||||
|
*
|
||||||
|
* This resets the position to the last GPS measurement
|
||||||
|
* or to zero in case of static position.
|
||||||
|
*/
|
||||||
void ResetPosition();
|
void ResetPosition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Reset the velocity state.
|
||||||
|
*/
|
||||||
void ResetVelocity();
|
void ResetVelocity();
|
||||||
|
|
||||||
void ZeroVariables();
|
void ZeroVariables();
|
||||||
@@ -309,7 +336,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes algorithm parameters to safe default values
|
* @brief
|
||||||
|
* Initializes algorithm parameters to safe default values
|
||||||
**/
|
**/
|
||||||
void InitialiseParameters();
|
void InitialiseParameters();
|
||||||
|
|
||||||
@@ -321,7 +349,13 @@ protected:
|
|||||||
|
|
||||||
bool VelNEDDiverged();
|
bool VelNEDDiverged();
|
||||||
|
|
||||||
void ResetHeight(void);
|
/**
|
||||||
|
* @brief
|
||||||
|
* Reset the height state.
|
||||||
|
*
|
||||||
|
* This resets the height state with the last altitude measurements
|
||||||
|
*/
|
||||||
|
void ResetHeight();
|
||||||
|
|
||||||
void AttitudeInit(float ax, float ay, float az, float mx, float my, float mz, float declination, float *initQuat);
|
void AttitudeInit(float ax, float ay, float az, float mx, float my, float mz, float declination, float *initQuat);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user