A solution to the singularity problem for six-joint manipulators