Function rc_quaternion_from_tb#

Function Documentation#

int rc_quaternion_from_tb(rc_vector_t tb, rc_vector_t *q)#

Calculates quaternion vector q from tait-bryan angles tb.

If q is already of length 4 then old contents are simply overwritten. Otherwise q’d existing memory is freed and new memory is allocated to aint memory leaks. tb angles are 321 Tait Bryan angles in array order XYZ with operation order 321(yaw-Z, pitch-Y, roll-x).

Parameters:
  • tb[in] input tait-bryan angles

  • q[out] output quaternion

Returns:

Returns 0 on success or -1 on failure