2019-01-15 13:46:13 -04:00
|
|
|
#include "mode.h"
|
|
|
|
#include "Plane.h"
|
|
|
|
|
2021-09-10 03:28:21 -03:00
|
|
|
#if HAL_QUADPLANE_ENABLED
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
bool ModeQLand::_enter()
|
|
|
|
{
|
2021-09-04 16:20:55 -03:00
|
|
|
plane.mode_qloiter._enter();
|
2021-08-14 15:55:03 -03:00
|
|
|
quadplane.throttle_wait = false;
|
|
|
|
quadplane.setup_target_position();
|
|
|
|
poscontrol.set_state(QuadPlane::QPOS_LAND_DESCEND);
|
|
|
|
poscontrol.pilot_correction_done = false;
|
|
|
|
quadplane.last_land_final_agl = plane.relative_ground_altitude(plane.g.rangefinder_landing);
|
|
|
|
quadplane.landing_detect.lower_limit_start_ms = 0;
|
|
|
|
quadplane.landing_detect.land_start_ms = 0;
|
2022-10-01 07:21:38 -03:00
|
|
|
#if AP_LANDINGGEAR_ENABLED
|
2021-08-14 15:55:03 -03:00
|
|
|
plane.g2.landing_gear.deploy_for_landing();
|
|
|
|
#endif
|
2022-07-19 08:33:13 -03:00
|
|
|
#if AP_FENCE_ENABLED
|
2021-08-14 15:55:03 -03:00
|
|
|
plane.fence.auto_disable_fence_for_landing();
|
|
|
|
#endif
|
2021-09-04 16:20:55 -03:00
|
|
|
return true;
|
2021-08-14 15:55:03 -03:00
|
|
|
}
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
void ModeQLand::update()
|
|
|
|
{
|
|
|
|
plane.mode_qstabilize.update();
|
|
|
|
}
|
|
|
|
|
2021-08-14 15:55:03 -03:00
|
|
|
void ModeQLand::run()
|
|
|
|
{
|
|
|
|
plane.mode_qloiter.run();
|
|
|
|
}
|
2021-09-10 03:28:21 -03:00
|
|
|
|
|
|
|
#endif
|