diff --git a/sw/airborne/math/pprz_algebra_int.h b/sw/airborne/math/pprz_algebra_int.h index 6188a8d2ce..05809c8b18 100644 --- a/sw/airborne/math/pprz_algebra_int.h +++ b/sw/airborne/math/pprz_algebra_int.h @@ -101,10 +101,10 @@ struct Int32Quat { struct Int64Quat { - int32_t qi; - int32_t qx; - int32_t qy; - int32_t qz; + int64_t qi; + int64_t qx; + int64_t qy; + int64_t qz; }; @@ -605,25 +605,25 @@ struct Int64Vect3 { /** in place quaternion first order integration with constant rotational velocity. */ #define INT32_QUAT_INTEGRATE_FI(_q, _hr, _omega, _f) { \ - _hr.qi += -_omega.p*_q.qx - _omega.q*_q.qy - _omega.r*_q.qz; \ - _hr.qx += _omega.p*_q.qi + _omega.r*_q.qy - _omega.q*_q.qz; \ - _hr.qy += _omega.q*_q.qi - _omega.r*_q.qx + _omega.p*_q.qz; \ - _hr.qz += _omega.r*_q.qi + _omega.q*_q.qx - _omega.p*_q.qy; \ + _hr.qi += - ((int64_t) _omega.p)*_q.qx - ((int64_t) _omega.q)*_q.qy - ((int64_t) _omega.r)*_q.qz; \ + _hr.qx += ((int64_t) _omega.p)*_q.qi + ((int64_t) _omega.r)*_q.qy - ((int64_t) _omega.q)*_q.qz; \ + _hr.qy += ((int64_t) _omega.q)*_q.qi - ((int64_t) _omega.r)*_q.qx + ((int64_t) _omega.p)*_q.qz; \ + _hr.qz += ((int64_t) _omega.r)*_q.qi + ((int64_t) _omega.q)*_q.qx - ((int64_t) _omega.p)*_q.qy; \ \ - ldiv_t _div = ldiv(_hr.qi, ((1<