mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-24 16:53:57 -04:00
Copter: soften loiter target when maybe landed
Applies to auto's land, land, loiter, pos hold and rtl flight modes
This commit is contained in:
parent
ab4b545bb5
commit
7f9709300c
@ -462,6 +462,9 @@
|
|||||||
#ifndef LAND_DETECTOR_TRIGGER
|
#ifndef LAND_DETECTOR_TRIGGER
|
||||||
# define LAND_DETECTOR_TRIGGER 50 // number of 50hz iterations with near zero climb rate and low throttle that triggers landing complete.
|
# define LAND_DETECTOR_TRIGGER 50 // number of 50hz iterations with near zero climb rate and low throttle that triggers landing complete.
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef LAND_DETECTOR_MAYBE_TRIGGER
|
||||||
|
# define LAND_DETECTOR_MAYBE_TRIGGER 10 // number of 50hz iterations with near zero climb rate and low throttle that means we might be landed (used to reset horizontal position targets to prevent tipping over)
|
||||||
|
#endif
|
||||||
#ifndef LAND_DETECTOR_CLIMBRATE_MAX
|
#ifndef LAND_DETECTOR_CLIMBRATE_MAX
|
||||||
# define LAND_DETECTOR_CLIMBRATE_MAX 30 // vehicle climb rate must be between -30 and +30 cm/s
|
# define LAND_DETECTOR_CLIMBRATE_MAX 30 // vehicle climb rate must be between -30 and +30 cm/s
|
||||||
#endif
|
#endif
|
||||||
|
@ -287,6 +287,11 @@ static void auto_land_run()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// init loiter targets when maybe landed
|
||||||
|
if(land_maybe_complete()) {
|
||||||
|
wp_nav.loiter_soften_for_landing();
|
||||||
|
}
|
||||||
|
|
||||||
// process pilot's input
|
// process pilot's input
|
||||||
if (!failsafe.radio) {
|
if (!failsafe.radio) {
|
||||||
if (g.land_repositioning) {
|
if (g.land_repositioning) {
|
||||||
|
@ -73,6 +73,11 @@ static void land_gps_run()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// relax loiter target if we might be landed
|
||||||
|
if(land_maybe_complete()) {
|
||||||
|
wp_nav.loiter_soften_for_landing();
|
||||||
|
}
|
||||||
|
|
||||||
// process pilot inputs
|
// process pilot inputs
|
||||||
if (!failsafe.radio) {
|
if (!failsafe.radio) {
|
||||||
if (g.land_repositioning) {
|
if (g.land_repositioning) {
|
||||||
@ -187,6 +192,11 @@ static float get_throttle_land()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool land_maybe_complete()
|
||||||
|
{
|
||||||
|
return (ap.land_complete || land_detector > LAND_DETECTOR_MAYBE_TRIGGER);
|
||||||
|
}
|
||||||
|
|
||||||
// update_land_detector - checks if we have landed and updates the ap.land_complete flag
|
// update_land_detector - checks if we have landed and updates the ap.land_complete flag
|
||||||
// called at 50hz
|
// called at 50hz
|
||||||
static void update_land_detector()
|
static void update_land_detector()
|
||||||
|
@ -68,6 +68,11 @@ static void loiter_run()
|
|||||||
wp_nav.clear_pilot_desired_acceleration();
|
wp_nav.clear_pilot_desired_acceleration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// relax loiter target if we might be landed
|
||||||
|
if (land_maybe_complete()) {
|
||||||
|
wp_nav.loiter_soften_for_landing();
|
||||||
|
}
|
||||||
|
|
||||||
// when landed reset targets and output zero throttle
|
// when landed reset targets and output zero throttle
|
||||||
if (ap.land_complete) {
|
if (ap.land_complete) {
|
||||||
wp_nav.init_loiter_target();
|
wp_nav.init_loiter_target();
|
||||||
|
@ -183,6 +183,11 @@ static void poshold_run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// relax loiter target if we might be landed
|
||||||
|
if(land_maybe_complete()) {
|
||||||
|
wp_nav.loiter_soften_for_landing();
|
||||||
|
}
|
||||||
|
|
||||||
// if landed initialise loiter targets, set throttle to zero and exit
|
// if landed initialise loiter targets, set throttle to zero and exit
|
||||||
if (ap.land_complete) {
|
if (ap.land_complete) {
|
||||||
wp_nav.init_loiter_target();
|
wp_nav.init_loiter_target();
|
||||||
|
@ -349,6 +349,11 @@ static void rtl_land_run()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// relax loiter target if we might be landed
|
||||||
|
if(land_maybe_complete()) {
|
||||||
|
wp_nav.loiter_soften_for_landing();
|
||||||
|
}
|
||||||
|
|
||||||
// process pilot's input
|
// process pilot's input
|
||||||
if (!failsafe.radio) {
|
if (!failsafe.radio) {
|
||||||
if (g.land_repositioning) {
|
if (g.land_repositioning) {
|
||||||
|
Loading…
Reference in New Issue
Block a user