Hi,
Sorry for late feedback about that, but I don't quite understand the purpose of this commit:
https://github.com/paparazzi/paparazzi/commit/370100b83ea4d29a1c06b1964a56520d500511d4
Yesterday I tested to switch from attittude to hover mode. Since the horizontal reference generator is now activated by default in hover mode, the quad goes to the previous setpoint instead of holding position. (Then it comes back to the setpoint)
I have seen that it's possible to disactivate reference generator via GCS settings, but why do we want it to be activated by default in hover mode?
If that's because it is then easier to keep the reference generator activated in all modes, then the hover mode should be initialized the same way as nav mode:
in guidance_h.c,
static void guidance_h_hover_enter(void) {
VECT2_COPY(guidance_h_pos_sp, *stateGetPositionNed_i());
guidance_h_rc_sp.psi = stateGetNedToBodyEulers_i()->psi;
reset_psi_ref_from_body();
INT_VECT2_ZERO(guidance_h_pos_err_sum);
}
should be:
static void guidance_h_hover_enter(void) {
VECT2_COPY(guidance_h_pos_sp, *stateGetPositionNed_i());
struct Int32Vect2 pos,speed,zero;
INT_VECT2_ZERO(zero);
VECT2_COPY(pos, *stateGetPositionNed_i());
VECT2_COPY(speed, *stateGetSpeedNed_i());
GuidanceHSetRef(pos, speed, zero);
guidance_h_rc_sp.psi = stateGetNedToBodyEulers_i()->psi;
reset_psi_ref_from_body();
INT_VECT2_ZERO(guidance_h_pos_err_sum);
}
Regards
Loïc