Generation of movement trajectories in primates and robots