mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 04:46:51 +08:00
rotorcraft vertical guidance: set altitude setpoint on hover mode entry, also set vert speed setpoint to zero when entering climb mode
This commit is contained in:
@@ -122,10 +122,15 @@ void guidance_v_mode_changed(uint8_t new_mode) {
|
||||
return;
|
||||
|
||||
switch (new_mode) {
|
||||
case GUIDANCE_V_MODE_HOVER:
|
||||
guidance_v_z_sp = ins_ltp_pos.z; // set current altitude as setpoint
|
||||
guidance_v_z_sum_err = 0;
|
||||
GuidanceVSetRef(ins_ltp_pos.z, 0, 0);
|
||||
break;
|
||||
|
||||
case GUIDANCE_V_MODE_RC_CLIMB:
|
||||
case GUIDANCE_V_MODE_CLIMB:
|
||||
case GUIDANCE_V_MODE_HOVER:
|
||||
guidance_v_zd_sp = 0;
|
||||
case GUIDANCE_V_MODE_NAV:
|
||||
guidance_v_z_sum_err = 0;
|
||||
GuidanceVSetRef(ins_ltp_pos.z, ins_ltp_speed.z, 0);
|
||||
@@ -158,8 +163,7 @@ void guidance_v_run(bool_t in_flight) {
|
||||
switch (guidance_v_mode) {
|
||||
|
||||
case GUIDANCE_V_MODE_RC_DIRECT:
|
||||
guidance_v_z_sp = ins_ltp_pos.z; // not sure why we do that
|
||||
GuidanceVSetRef(ins_ltp_pos.z, 0, 0); // or that - mode enter should take care of it ?
|
||||
guidance_v_z_sp = ins_ltp_pos.z; // for display only
|
||||
stabilization_cmd[COMMAND_THRUST] = guidance_v_rc_delta_t;
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user