Leg-local neural mechanisms for searching and learning enhance robotic locomotion