Robots are getting smarter all the time. Many of them are capable of detecting and avoiding collisions. This video from Robotic Systems Lab shows a MPC that discovers collision-free locomotion for robots while taking into account constraints and limitations. As the researches explain, this approach:
enables legged robots to find whole-body motions in the presence of static and dynamic obstacles. We use a dynamically generated euclidean signed distance field for static collision checking. Collision checking for dynamic obstacles is modeled with moving cylinders, increasing the responsiveness to fast-moving agents. Furthermore, we include a Kalman filter motion prediction for moving obstacles into our receding horizon planning, enabling the robot to anticipate possible future collisions.