mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
Copter: use height-above-ground for landing gear deployment
This commit is contained in:
parent
078eef91cb
commit
8e1b48ef1e
@ -29,8 +29,8 @@ void Copter::landinggear_update()
|
||||
|
||||
last_deploy_status = landinggear.deployed();
|
||||
|
||||
// support height based triggering using rangefinder or altitude above home
|
||||
float height = current_loc.alt * 0.01;
|
||||
// support height based triggering using rangefinder or altitude above ground
|
||||
int32_t height_cm = flightmode->get_alt_above_ground();
|
||||
|
||||
// use rangefinder if available
|
||||
switch (rangefinder.status_orient(ROTATION_PITCH_270)) {
|
||||
@ -41,15 +41,15 @@ void Copter::landinggear_update()
|
||||
|
||||
case RangeFinder::RangeFinder_OutOfRangeLow:
|
||||
// altitude is close to zero (gear should deploy)
|
||||
height = 0.0f;
|
||||
height_cm = 0;
|
||||
break;
|
||||
|
||||
case RangeFinder::RangeFinder_OutOfRangeHigh:
|
||||
case RangeFinder::RangeFinder_Good:
|
||||
// use last good reading
|
||||
height = rangefinder_state.alt_cm_filt.get() * 0.01;
|
||||
height_cm = rangefinder_state.alt_cm_filt.get();
|
||||
break;
|
||||
}
|
||||
|
||||
landinggear.update(height);
|
||||
landinggear.update(height_cm * 0.01f); // convert cm->m for update call
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user