liyue
(liyue)
May 18, 2022, 12:04pm
1
I recently read at the source code of Ardupilot.
I dont understand the meaning of onGround as defined in
EKF_obs_buffer_t<range_elements> storedRange; // Range finder data buffer
EKF_IMU_buffer_t<output_elements> storedOutput;// output state buffer
Matrix3F prevTnb; // previous nav to body transformation used for INS earth rotation compensation
ftype accNavMag; // magnitude of navigation accel - used to adjust GPS obs variance (m/s^2)
ftype accNavMagHoriz; // magnitude of navigation accel in horizontal plane (m/s^2)
Vector3F earthRateNED; // earths angular rate vector in NED (rad/s)
ftype dtIMUavg; // expected time between IMU measurements (sec)
ftype dtEkfAvg; // expected time between EKF updates (sec)
ftype dt; // time lapsed since the last covariance prediction (sec)
ftype hgtRate; // state for rate of change of height filter
bool onGround; // true when the flight vehicle is definitely on the ground
bool prevOnGround; // value of onGround from previous frame - used to detect transition
bool inFlight; // true when the vehicle is definitely flying
bool prevInFlight; // value inFlight from previous frame - used to detect transition
bool manoeuvring; // boolean true when the flight vehicle is performing horizontal changes in velocity
Vector6 innovVelPos; // innovation output for a group of measurements
Vector6 varInnovVelPos; // innovation variance output for a group of measurements
Vector6 velPosObs; // observations for combined velocity and positon group of measurements (3x1 m , 3x1 m/s)
bool fuseVelData; // this boolean causes the velNED measurements to be fused
bool fusePosData; // this boolean causes the posNE measurements to be fused
bool fuseHgtData; // this boolean causes the hgtMea measurements to be fused
If the
fly_forward = b;
}
bool get_fly_forward(void) const {
return fly_forward;
}
/* we modify our behaviour based on what sort of vehicle the
* vehicle code tells us we are. This information is also pulled
* from AP_AHRS by other libraries
*/
enum class VehicleClass : uint8_t {
UNKNOWN,
GROUND,
COPTER,
FIXED_WING,
SUBMARINE,
};
VehicleClass get_vehicle_class(void) const {
return _vehicle_class;
}
void set_vehicle_class(VehicleClass vclass) {
VehicleClass is GROUND .
Should onGround always be true?
But in function detectFlight running in every loop,
onGround will be set false when motorsArmed.
So if the vehicle class is ROVER, onGround will always be true, or will be set to false?
rmackay9
(rmackay9)
May 19, 2022, 2:47am
2
I think onGround is probably misnamed. It should probably be renamed to “not moving”. The EKF was originally designed for flying vehicles which probably explains the imprecise naming of this variable.
liyue
(liyue)
May 19, 2022, 3:05am
3
Tanks a lot.
I think “not moving” is a good explanation.
1 Like