4. Alignment

You must first complete 3. Ramping up Speed before viewing this Lesson

Review: Motor Movements

In FIRST LEGO League, teams need to figure out where to start in base:
Jigs: a LEGO ruler/wall that your robot can align against them in base
Inch marks: Use the inch marks to pick a starting spot for each run
Words: Base has words. If you aren’t near an inch mark, pick a word or letter to start on
Same start each time: pick one spot and start there no matter what the mission for easy starts

Errors Accumulate Over Time
By the time you get to the far side of the table, you are no longer in the right position
Solution: Repeat alignment techniques multiple times in a run for better reliability=

Where Are You on the FLL table?

Consider these alignment strategies that are commonly used:
Align on walls – deliberately back into a wall to straighten out (note: You may stall doing this. See the Advanced: Stall Detection Lesson)

Square/Align on lines –If you are moving angled, you can straighten out whenever you see a line. (See Advanced: Squaring Lesson)

Move until a line – travel until you find a line so you know where you are on the mat (See Beginner: Color Sensor)

Align on a mission model – Mission models that are stuck in one place can be used to align against

2.1. Why Align on a Line?
Aligning on a line helps the robot navigate
Robots get angled as they travel farther or turn (the error accumulates)
Aligning on a line can straighten out a robot.
Aligning can tell a robot where it is when it has to travel far
Example Goal: Your robot must deliver an object only inside a small END area. The distance between start and end is 8 feet
Do you think your robot can travel 8 feet and continue to be straight?

2.2. Three Easy Steps to Align
Challenge: Make the robot straighten out
(align/square up)
STEP 1: Start both motors
STEP 2: Stop one motor when the sensor on the corresponding side sees the line
STEP 3: Stop moving the second motor when the sensor on that side sees the line
Hints: Use a Large Motor Block, Use Parallel Beams, Use the Large Motor Block

Notes About Our Solution
Our solution uses 2 Color Sensors (connected in Ports 1 and 4).
Our solution assumes that the color sensor on port 1 is next to the wheel on motor port B and color sensor on port 4 is next to the wheel on motor port C.
You should adjust the ports as needed
Your color sensors should NOT be placed right next to each other (See red boxes below in robot image. These are the color sensors.)

Basic Solution: Moving Until Line

Note: Synchronization & Parallel Beams

When you have two or more beams you do not know when each beam will finish.
If you wanted to move after the align finishes you might try to add a move block at the end of one of the beams.
Note: This will not work because EV3 code will play your move block without waiting for the other beam to finish.

Solution: You need to synchronize your beams. To learn more about synchronization and solutions go to the Advanced EV3Lessons.com Lesson on Sync Beams
The problem of synchronization can also be solved by making a My Block out of the align code (refer to My Block lesson in Intermediate)

My Blocks always wait for both beams to finish before exiting

Improving Your Align Code
What do you notice about the solution we just presented?
The robot isn’t quite straight (aligned) at the end of it.
Both color sensors are on the line, but the robot stops at an angle.
Challenge Continued: Think about how you can improve this code so that the robot ends straighter
Tips for Success
You will get better results

if your color sensors are about 4mm-12mm from the ground (see Color Sensor Placement Lesson in Robot Design Lessons)
if you don’t come at the line at steep angles
if you keep your color sensors spread apart

Back to: Module 4. Robotics Coding and Driving