Skip to content

Commit

Permalink
Copter: constrain land ramp output between min and max landing speeds
Browse files Browse the repository at this point in the history
  • Loading branch information
wsilva32 committed Oct 3, 2016
1 parent ddbfc3c commit 0820b17
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ArduCopter/control_land.pde
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ static float get_land_descent_speed()
if (pos_control.get_pos_target().z >= pv_alt_above_origin(LAND_START_ALT) && !(sonar_ok && sonar_alt_health >= SONAR_ALT_HEALTH_MAX)) {
// if we are within the land ramp profile
if (land_ramp && pos_control.get_pos_target().z <= land_ramp_xi){
return -fabsf(land_ramp_vi + (land_ramp_vf-land_ramp_vi)*(pos_control.get_pos_target().z-land_ramp_xi)/(land_ramp_xf-land_ramp_xi));
return -constrain_float(fabsf(land_ramp_vi + (land_ramp_vf-land_ramp_vi)*(pos_control.get_pos_target().z-land_ramp_xi)/(land_ramp_xf-land_ramp_xi)), land_ramp_vf, land_ramp_vi);
}else{
// note: returns a negative value
return pos_control.get_speed_down();
}
// if we're below LAND_START_ALT, use land_speed
Expand Down

0 comments on commit 0820b17

Please sign in to comment.