An inverse kinematics scheme for a flexible arm in contact with a compliant surface