The usual equation for an n-link manipulator is D(q)q_dotdot + C(q,q_dot)q_dot + G(q) = u. Including the motor model, the equation becomes M(q)q_dotdot + C(q,q_dot)q_dot + G(q) = tau, where M denotes the inertia matrix; C represents the coriolis and centripetal effects and G is the gravity loading.
In general the M-matrix is positive definite => always non-singular. However, for the system that I am working on atm, a triple inverted pendulum system, the inertia matrix becomes near singular with the determinant det(M) < 0.000014. This leads to huge problems with simulation in matlab (getting inf/nan-values for states) and also problems for the control-algorithm which uses the inverse inv(M) in its calculations.
Has anyone encountered this before, and if so how did you solve it?
Some has suggested a quaternion representation of the rotations/translations (based on unit dual quaternions), but I don't want to do a lot of work deriving the model based on quaternions only to still have a near singular M-matrix.
I will transfer all my karma to anyone that can help.