State Vector
\[\begin{align} \vect{X} &= \transp{\begin{pmatrix} x & y & z & \dot{x} & \dot{y} & \dot{z} & qi & qx & qy & qz & p & q & r \end{pmatrix}} \\ \vect{X} &= \transp{\begin{pmatrix} \vect{P} & \vect{V} & \vect{Q} & \vect{\Omega} \end{pmatrix}} \end{align}\]where:
Input Vector
\[\vect{U} = \transp{\begin{pmatrix} \vect{F}_b & \vect{M}_b \end{pmatrix}}\]where:
\(\dot{\vect{P}}\) is simply contained in \(\vect{X}\)
\[\dot{\vect{P}} = \vect{V}\]\(\dot{\vect{Q}}\) is computed from \(\vect{Q}\) and \(\vect{\Omega}\) as:
\[\dot{\vect{Q}} = -\frac{1}{2} \text{skewsym}(\vect{\Omega}) \vect{Q}\]def solid_cont_dyn(X, F_b, M_b, P):
Xd = np.zeros(sv_size)
p_w, v_w, q_w2b, om_b = X[sv_slice_pos], X[sv_slice_vel], X[sv_slice_quat], X[sv_slice_rvel]
# Translational kinematics
Xd[sv_slice_pos] = v_w
# Newton for forces
R_w2b = pal.rmat_of_quat(q_w2b)
Xd[sv_slice_vel] = 1./P.m*(np.dot(R_w2b.T, F_b) + [0, 0, P.m*P.g])
# Rotational kinematics
Xd[sv_slice_quat] = pal.quat_derivative(q_w2b, om_b)
# Newton for moments
Xd[sv_slice_rvel] = np.dot(P.invJ, M_b - np.cross(om_b, np.dot(P.J, om_b)))
return Xd