An adaptive learning mechanism for teaching a robotic hand to grasp