Kinematic analysis and singularity avoidance for a seven-joint manipulator