Programming the obstacle avoidance sequence

If both proximity sensors see the obstacle, the obstacle is too tall to climb and the Omnilander will steer to avoid it and continue on in a new direction.

Add two move tank blocks to the true case of the IR sensor switch. Change the mode of the first block to On for Seconds. Then, set the power levels of each of the drive motors: the left motor should be set to a power of 0 percent, and the right motor should be set to 100 percent. Set the duration of the turn to 1.8 seconds. This makes the robot perform an approximately 90-degree right turn in reverse. Finally, change the mode of the second move tank block to Off. This will momentarily clear the power values assigned to each drive motor:

At this ...

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.