mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-08 17:03:57 -04:00
Copter: landing gear deployment height calc uses lidar status
This commit is contained in:
parent
2f79932611
commit
d6dca1f6a1
@ -29,12 +29,26 @@ void Copter::landinggear_update()
|
|||||||
|
|
||||||
last_deploy_status = landinggear.deployed();
|
last_deploy_status = landinggear.deployed();
|
||||||
|
|
||||||
// support height based triggering
|
// support height based triggering using rangefinder or altitude above home
|
||||||
float height;
|
float height = current_loc.alt * 0.01;
|
||||||
if (rangefinder_alt_ok()) {
|
|
||||||
|
// use rangefinder if available
|
||||||
|
switch (rangefinder.status_orient(ROTATION_PITCH_270)) {
|
||||||
|
case RangeFinder::RangeFinder_NotConnected:
|
||||||
|
case RangeFinder::RangeFinder_NoData:
|
||||||
|
// use altitude above home for non-functioning rangefinder
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RangeFinder::RangeFinder_OutOfRangeLow:
|
||||||
|
// altitude is close to zero (gear should deploy)
|
||||||
|
height = 0.0f;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RangeFinder::RangeFinder_OutOfRangeHigh:
|
||||||
|
case RangeFinder::RangeFinder_Good:
|
||||||
|
// use last good reading
|
||||||
height = rangefinder_state.alt_cm_filt.get() * 0.01;
|
height = rangefinder_state.alt_cm_filt.get() * 0.01;
|
||||||
} else {
|
break;
|
||||||
height = current_loc.alt * 0.01;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
landinggear.update(height);
|
landinggear.update(height);
|
||||||
|
Loading…
Reference in New Issue
Block a user