Robust Modular Inverse Kinematics for Gesture Imitation in an Upper-Body Humanoid Robot