I am Evan. I am coding a determination system in C++ for a cube satellite that uses the PX4 Matrix library for matrix and quaternion manipulation.
I am working on cleaning up the determination code. In the matlab version there is a part of code that goes like
dq = 0.5.*(B * q_prev)’; % [1x4] vector
where dq and q_prev are quaternions and B is the 4x4 gyro matrix. Should I declare dq and q_prev as quaternions in the C code or matrices whereas multiplication would be easier and I wouldn’t be multiplying variables of different types. Is there an easy way to do this?
I have it implemented as matrices in C right now as follows.
dq = .5*(B*q_prev).transpose();