Kinematics analysis and optimization of 6R manipulator