Programming the true case

What happens if the US sensor does detect an obstacle within 20 centimeters? This means that a collision is imminent and the EV3 must make a decision: attempt to climb over the obstacle or steer to avoid it.

The autonomous program decides which action to take based off of the reading on the IR sensor, which is in the high position. If the IR sensor also detects the obstacle, the robot knows the obstacle is too high to climb, and it must steer to avoid it. However, if the upper sensor does not see the obstacle, the robot knows that the obstacle is low enough and it will attempt to climb it:

We program this decision ...

Get Building Smart LEGO MINDSTORMS EV3 Robots now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.