On singularities of real algebraic sets and applications to kinematics