An Analytic and Optimal Inverse Kinematic Solution for a 7-DOF Space Manipulator