mirror of https://github.com/ArduPilot/ardupilot
Copter : Add range finder measurements to EKF optical flow data
This commit is contained in:
parent
988de2a898
commit
27f9289391
|
@ -1188,7 +1188,7 @@ static void one_hz_loop()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// called at 100hz but data from sensor only arrives at 20 Hz
|
// called at 100hz but data from sensor only arrives at 10 Hz
|
||||||
#if OPTFLOW == ENABLED
|
#if OPTFLOW == ENABLED
|
||||||
static void update_optical_flow(void)
|
static void update_optical_flow(void)
|
||||||
{
|
{
|
||||||
|
@ -1205,14 +1205,15 @@ static void update_optical_flow(void)
|
||||||
// write to log and send to EKF if new data has arrived
|
// write to log and send to EKF if new data has arrived
|
||||||
if (optflow.last_update() != last_of_update) {
|
if (optflow.last_update() != last_of_update) {
|
||||||
last_of_update = optflow.last_update();
|
last_of_update = optflow.last_update();
|
||||||
uint8_t quality = optflow.quality();
|
uint8_t flowQuality = optflow.quality();
|
||||||
Vector2f rawFlowRates = optflow.velocity();
|
Vector2f rawFlowRates = optflow.velocity();
|
||||||
Vector2i temp = optflow.raw();
|
Vector2i temp = optflow.raw();
|
||||||
Vector2f rawGyroRates;
|
Vector2f rawGyroRates;
|
||||||
rawGyroRates.x = 0.001f * float(temp.x);
|
rawGyroRates.x = 0.001f * float(temp.x);
|
||||||
rawGyroRates.y = 0.001f * float(temp.y);
|
rawGyroRates.y = 0.001f * float(temp.y);
|
||||||
float ground_distance_m = optflow.ground_distance_m();
|
// Use range from a separate range finder if available, not the PX4Flows built in sensor which is ineffective
|
||||||
ahrs.writeOptFlowMeas(quality, rawFlowRates, rawGyroRates, ground_distance_m, last_of_update);
|
float ground_distance_m = 0.01f*float(sonar_alt);
|
||||||
|
ahrs.writeOptFlowMeas(flowQuality, rawFlowRates, rawGyroRates, last_of_update, sonar_alt_health, ground_distance_m);
|
||||||
if (g.log_bitmask & MASK_LOG_OPTFLOW) {
|
if (g.log_bitmask & MASK_LOG_OPTFLOW) {
|
||||||
Log_Write_Optflow();
|
Log_Write_Optflow();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue