|
|
|
@ -70,10 +70,38 @@ void ModeRTL::run(bool disarm_on_land)
@@ -70,10 +70,38 @@ void ModeRTL::run(bool disarm_on_land)
|
|
|
|
|
if (copter.updownStatus < UpDown_RequestDescent) |
|
|
|
|
{ |
|
|
|
|
copter.updownStatus = UpDown_RequestDescent; |
|
|
|
|
gcs().update_zr_fly_status(copter.updownStatus);
|
|
|
|
|
mavlink_zr_flying_status_t zr_flying_status_t; |
|
|
|
|
zr_flying_status_t.updown_status = copter.updownStatus; |
|
|
|
|
countdown = g.zr_rtl_delay;
|
|
|
|
|
zr_flying_status_t.countdown = countdown;
|
|
|
|
|
gcs().update_zr_fly_status(&zr_flying_status_t); |
|
|
|
|
last_decent_time = AP_HAL::millis();
|
|
|
|
|
if(g.zr_rtl_delay>0){ |
|
|
|
|
is_rtl_delay_enable = true; |
|
|
|
|
}else{ |
|
|
|
|
is_rtl_delay_enable = false; |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (copter.updownStatus == UpDown_ContinueDescent) |
|
|
|
|
else if(copter.updownStatus ==UpDown_RequestDescent&&is_rtl_delay_enable) |
|
|
|
|
{ |
|
|
|
|
if((AP_HAL::millis()- last_decent_time)>=1000){ |
|
|
|
|
last_decent_time = AP_HAL::millis();
|
|
|
|
|
// mavlink_zr_flying_status_t zr_flying_status_t;
|
|
|
|
|
// zr_flying_status_t.updown_status = copter.updownStatus;
|
|
|
|
|
// zr_flying_status_t.countdown = countdown;
|
|
|
|
|
// gcs().update_zr_fly_status(&zr_flying_status_t);
|
|
|
|
|
if(countdown>0){ |
|
|
|
|
gcs().send_text(MAV_SEVERITY_INFO,"着陆倒计时(秒): %d",countdown); |
|
|
|
|
} |
|
|
|
|
else if(countdown<=0){ |
|
|
|
|
gcs().send_text(MAV_SEVERITY_INFO,"开始着陆"); |
|
|
|
|
copter.updownStatus = UpDown_ContinueDescent; |
|
|
|
|
_state = RTL_Land; |
|
|
|
|
} |
|
|
|
|
countdown --; //TODO shiji countdown+1 s
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if (copter.updownStatus == UpDown_ContinueDescent) |
|
|
|
|
{
|
|
|
|
|
_state = RTL_Land; |
|
|
|
|
} |
|
|
|
@ -267,7 +295,10 @@ void ModeRTL::loiterathome_run()
@@ -267,7 +295,10 @@ void ModeRTL::loiterathome_run()
|
|
|
|
|
void ModeRTL::descent_start() |
|
|
|
|
{ |
|
|
|
|
copter.updownStatus = UpDown_RTLDescent; |
|
|
|
|
gcs().update_zr_fly_status(copter.updownStatus); |
|
|
|
|
mavlink_zr_flying_status_t zr_flying_status_t; |
|
|
|
|
zr_flying_status_t.updown_status = copter.updownStatus; |
|
|
|
|
zr_flying_status_t.countdown = 255; |
|
|
|
|
gcs().update_zr_fly_status(&zr_flying_status_t); |
|
|
|
|
_state = RTL_FinalDescent; |
|
|
|
|
_state_complete = false; |
|
|
|
|
|
|
|
|
@ -409,7 +440,10 @@ void ModeRTL::land_run(bool disarm_on_land)
@@ -409,7 +440,10 @@ void ModeRTL::land_run(bool disarm_on_land)
|
|
|
|
|
land_run_vertical_control();
|
|
|
|
|
|
|
|
|
|
if(AP_HAL::millis()-last_send_time>=500){ |
|
|
|
|
gcs().update_zr_fly_status(copter.updownStatus); |
|
|
|
|
mavlink_zr_flying_status_t zr_flying_status_t; |
|
|
|
|
zr_flying_status_t.updown_status = copter.updownStatus; |
|
|
|
|
zr_flying_status_t.countdown = 255; |
|
|
|
|
gcs().update_zr_fly_status(&zr_flying_status_t); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|