fix setting ref speed if not using ref model

This commit is contained in:
Ewoud Smeur
2023-08-22 14:48:26 +02:00
parent 7954fa63df
commit 44e57c6be9
@@ -360,9 +360,18 @@ static void guidance_h_update_reference(void)
guidance_h.ref.accel.x = ACCEL_BFP_OF_REAL(gh_ref.accel.x);
guidance_h.ref.accel.y = ACCEL_BFP_OF_REAL(gh_ref.accel.y);
} else {
VECT2_COPY(guidance_h.ref.pos, guidance_h.sp.pos);
INT_VECT2_ZERO(guidance_h.ref.speed);
INT_VECT2_ZERO(guidance_h.ref.accel);
if (nav.setpoint_mode == NAV_SETPOINT_MODE_POS) {
VECT2_COPY(guidance_h.ref.pos, guidance_h.sp.pos);
INT_VECT2_ZERO(guidance_h.ref.speed);
INT_VECT2_ZERO(guidance_h.ref.accel);
} else { //(nav.setpoint_mode == NAV_SETPOINT_MODE_SPEED)
guidance_h.ref.pos.x = stateGetPositionNed_i()->x;
guidance_h.ref.pos.y = stateGetPositionNed_i()->y;
guidance_h.ref.speed.x = guidance_h.sp.speed.x;
guidance_h.ref.speed.y = guidance_h.sp.speed.y;
guidance_h.ref.accel.x = 0;
guidance_h.ref.accel.y = 0;
} // TODO: make accel ref set
}
#if GUIDANCE_H_USE_SPEED_REF