The task about aligning the robot is quite important, when it comes to competitons. We will talk more about competition robotics in the next section. Now, we will try to solve the task to align our robots using ultrasonic sensors.

To access the full video please subscribe to FLLCasts.com
- #959
- 04 Jan 2018
The setup
We have a robot with two ultrasonic sensors attached to the front of the robot facing forward. The task is to align the robot perpendicular to a wall at 10 cm distance, no matter of it starting orientation. So the robot may start either facing straight the wall
or tilted to the left
or tilted to the right.
However, no matter how we position it, at the end of the program he must be straight:
The problem
At first the task may seem simple. Just move forward, until the Ultrasonic sensor detects an object less than 10 cm away, then stop the corresponding motor. However, you do not know, which sensor will detect the wall first. Try solving the task using threads and keeping in mind the problem above.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons

Instructors Remote Training
If you are working with students and you want to introduce Robotics to your class or you want to mentor a FLL team, but you are insecure about your technical knowledge in the Robotics field, then this is the right place for you. Having in mind teachers' busy schedule, we have design two different schedules and added an option to design one just for you. FLLCasts's Mindstorms EV3 Robotics Online Training is the perfect match for any teacher.
After the completion of each task the participant has to upload his solution for verification.
- 183
- 280:11
- 156

Threads and Multi-threading
So far we have created programs that execute actions one after another. But sometimes we need to perform two actions at the same time. How do we achieve that?
- 5
- 1
- 9
- 3d_rotation 1