Skip to content

Commit

Permalink
add extnav delay parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
chobitsfan committed Oct 11, 2018
1 parent a1a8b55 commit 1c26eaf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions libraries/AP_NavEKF2/AP_NavEKF2.cpp
Expand Up @@ -544,6 +544,16 @@ const AP_Param::GroupInfo NavEKF2::var_info[] = {
// @RebootRequired: True
AP_GROUPINFO("OGN_HGT_MASK", 49, NavEKF2, _originHgtMode, 0),

// @Param: EXTNAV_DELAY
// @DisplayName: external navigation system measurement delay (msec)
// @Description: external navigation system measurement delay (msec)
// @Range: 0 127
// @Increment: 1
// @User: Advanced
// @Units: ms
// @RebootRequired: True
AP_GROUPINFO("EXTNAV_DELAY", 50, NavEKF2, _extnavDelay_ms, 10),

AP_GROUPEND
};

Expand Down
1 change: 1 addition & 0 deletions libraries/AP_NavEKF2/AP_NavEKF2.h
Expand Up @@ -396,6 +396,7 @@ class NavEKF2 {
AP_Float _useRngSwSpd; // Maximum horizontal ground speed to use range finder as the primary height source (m/s)
AP_Int8 _magMask; // Bitmask forcng specific EKF core instances to use simple heading magnetometer fusion.
AP_Int8 _originHgtMode; // Bitmask controlling post alignment correction and reporting of the EKF origin height.
AP_Int8 _extnavDelay_ms;

// Tuning parameters
const float gpsNEVelVarAccScale = 0.05f; // Scale factor applied to NE velocity measurement variance due to manoeuvre acceleration
Expand Down
4 changes: 2 additions & 2 deletions libraries/AP_NavEKF2/AP_NavEKF2_Measurements.cpp
Expand Up @@ -832,7 +832,7 @@ void NavEKF2_core::writeExtNavData(const Vector3f &sensOffset, const Vector3f &p
extNavDataNew.angErr = angErr;
extNavDataNew.body_offset = &sensOffset;

timeStamp_ms = timeStamp_ms - 10;
timeStamp_ms = timeStamp_ms - frontend->_extnavDelay_ms;
// Correct for the average intersampling delay due to the filter updaterate
timeStamp_ms -= localFilterTimeStep_ms/2;
// Prevent time delay exceeding age of oldest IMU data in the buffer
Expand All @@ -852,7 +852,7 @@ void NavEKF2_core::writeVisionSpeed(const Vector3f &vel, uint32_t timeStamp_ms)
}
useGpsVertVel = true;
visionSpeedNew.vel = vel;
timeStamp_ms = timeStamp_ms - 10;
timeStamp_ms = timeStamp_ms - frontend->_extnavDelay_ms;
// Correct for the average intersampling delay due to the filter updaterate
timeStamp_ms -= localFilterTimeStep_ms/2;
// Prevent time delay exceeding age of oldest IMU data in the buffer
Expand Down

0 comments on commit 1c26eaf

Please sign in to comment.