@ -407,10 +407,8 @@ int32_t Copter::Mode::get_alt_above_ground(void)
@@ -407,10 +407,8 @@ int32_t Copter::Mode::get_alt_above_ground(void)
void Copter : : Mode : : land_run_vertical_control ( bool pause_descent )
{
# if PRECISION_LANDING == ENABLED
AC_PrecLand & precland = copter . precland ;
const bool navigating = pos_control - > is_active_xy ( ) ;
bool doing_precision_landing = ! ap . land_repo_active & & precland . target_acquired ( ) & & navigating ;
bool doing_precision_landing = ! ap . land_repo_active & & copter . precland . target_acquired ( ) & & navigating ;
# else
bool doing_precision_landing = false ;
# endif
@ -452,9 +450,6 @@ void Copter::Mode::land_run_vertical_control(bool pause_descent)
@@ -452,9 +450,6 @@ void Copter::Mode::land_run_vertical_control(bool pause_descent)
void Copter : : Mode : : land_run_horizontal_control ( )
{
LowPassFilterFloat & rc_throttle_control_in_filter = copter . rc_throttle_control_in_filter ;
AP_Vehicle : : MultiCopter & aparm = copter . aparm ;
float target_roll = 0.0f ;
float target_pitch = 0.0f ;
float target_yaw_rate = 0 ;
@ -466,7 +461,7 @@ void Copter::Mode::land_run_horizontal_control()
@@ -466,7 +461,7 @@ void Copter::Mode::land_run_horizontal_control()
// process pilot inputs
if ( ! copter . failsafe . radio ) {
if ( ( g . throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND ) ! = 0 & & rc_throttle_control_in_filter . get ( ) > LAND_CANCEL_TRIGGER_THR ) {
if ( ( g . throttle_behavior & THR_BEHAVE_HIGH_THROTTLE_CANCELS_LAND ) ! = 0 & & copter . rc_throttle_control_in_filter . get ( ) > LAND_CANCEL_TRIGGER_THR ) {
copter . Log_Write_Event ( DATA_LAND_CANCELLED_BY_PILOT ) ;
// exit land if throttle is high
if ( ! set_mode ( LOITER , MODE_REASON_THROTTLE_LAND_ESCAPE ) ) {
@ -492,16 +487,15 @@ void Copter::Mode::land_run_horizontal_control()
@@ -492,16 +487,15 @@ void Copter::Mode::land_run_horizontal_control()
}
# if PRECISION_LANDING == ENABLED
AC_PrecLand & precland = copter . precland ;
bool doing_precision_landing = ! ap . land_repo_active & & precland . target_acquired ( ) ;
bool doing_precision_landing = ! ap . land_repo_active & & copter . precland . target_acquired ( ) ;
// run precision landing
if ( doing_precision_landing ) {
Vector2f target_pos , target_vel_rel ;
if ( ! precland . get_target_position_cm ( target_pos ) ) {
if ( ! copter . precland . get_target_position_cm ( target_pos ) ) {
target_pos . x = inertial_nav . get_position ( ) . x ;
target_pos . y = inertial_nav . get_position ( ) . y ;
}
if ( ! precland . get_target_velocity_relative_cms ( target_vel_rel ) ) {
if ( ! copter . precland . get_target_velocity_relative_cms ( target_vel_rel ) ) {
target_vel_rel . x = - inertial_nav . get_velocity ( ) . x ;
target_vel_rel . y = - inertial_nav . get_velocity ( ) . y ;
}
@ -527,7 +521,7 @@ void Copter::Mode::land_run_horizontal_control()
@@ -527,7 +521,7 @@ void Copter::Mode::land_run_horizontal_control()
// limit attitude to 7 degrees below this limit and linearly
// interpolate for 1m above that
const int alt_above_ground = get_alt_above_ground ( ) ;
float attitude_limit_cd = linear_interpolate ( 700 , aparm . angle_max , alt_above_ground ,
float attitude_limit_cd = linear_interpolate ( 700 , copter . aparm . angle_max , alt_above_ground ,
g2 . wp_navalt_min * 100U , ( g2 . wp_navalt_min + 1 ) * 100U ) ;
float total_angle_cd = norm ( nav_roll , nav_pitch ) ;
if ( total_angle_cd > attitude_limit_cd ) {