Get in shape
LEGO Robotics - Lesson 3
Objectives
- Write algorithms to control the movements of a robot
- Change variables to make things happen
- Use a loop to repeat sections of an algorithm
Lesson Resources
- 1 EV3 Education Core set per group of 3 children (Spike Prime also works great!)
- 1 computer, laptop or tablet with EV3 classroom installed per group
- 1 USB cable per group (not needed if you are using a Bluetooth connection)
- Metre sticks or measuring tapes (1 per group)
- Calculators or a calculator app for their iPad/laptop
- Masking tape
- Lesson slides
- EV3 LEGO Education User Guide
Lesson 1 - Measure and move
Lesson 2 - Time to turn
Lesson 3 - Get in shape
Lesson 4 - Lifting and moving
Lesson 5 - Sensors
Lesson 6 - Sensors and Robot challenges
Introduction
Briefly recap the last lesson and the two types of turn we learned about: pivot and spin turns. How were they different? When might you use each one?
In today's lesson the teams will be taking on some more shape-based programming challenges with their robot. In each case, they will need to consider if pivot or spin turns will be useful... or not!
There are times when further mastery of the steering setting is also needed. These challenges will test those skills and also their ability to problem solve and debug their code as a team.
Movement mission 1
Make the robot to move in a perfect circle, with a diameter of approx 1 metre, ensuring that the robot starts and stops in exactly the same place (having only travelled around the circle once).
Ask them to consider how many blocks they need to use to achieve this and the settings that they might need to change, but don’t give any answers away at this point.
Explain that it is unlikely they will get it right on their first attempt, but that it is about trial and error and learning from each attempt what needs to be adjusted until it is perfect. Then give them approximately 10 minutes to experiment and work out the best solution they can. It's important that they mark where the robot starts each time by putting something in line with (but not touching) it's wheels. That way the wheels should stop at the exact same point at the end of the program.
Gather the class back together after this time and ask some groups to show what they have done. Ask the group to judge against the criteria set out at the beginning (size of the circle and starting/stopping in the same place).
Ask the class:
- How many movement blocks did you need? One!
- Which were the most important settings to alter? steering and rotations
- What went well in each group?
- What could have been improved?
- Did they discuss things and work together?
There is more than one set of variables that will produce the correct circle, but this is one way to do it (depending on your flooring):
Movement mission 2
Get the robot to move in a ‘S’ shape, approx 1 metres in height (a nice curly ‘S’ is preferable!)
Again, ask them to begin by considering how many steering blocks they need to use to achieve this and the settings that they will need to change.
Ask the class, what can you learn from their last attempt at the circle?
Give them approximately 10 / 15 minutes to experiment and work out the best solution they can.
Gather the class back together after this time and ask some groups to show what they have done. Ask the group to judge against the criteria set out at the beginning (size and shape of the ‘S’, is the ‘S’ the correct way round?).
Again, here’s one way you can do it:
Ask the class:
- How many movement blocks did you use this time?
- What went well in your group?
- What could have been improved?
- Did you discuss things and work together?
- Was it easier or more difficult than the previous challenge? Why?
Movement mission 3
The final challenge today requires them to think back to coding a square in the last lesson. Ask the class, how did we solve that problem in the most efficient way? We used a loop.
Have another look at that code and go through what each block did, reminding them about calculating the length of the shape's side and using spin turns at its corners.
Their final task is to adapt their loop and the code to make the robot move in the shape of another regular polygon, for example:
What will you need to change from the code for a square? The number of times the loop repeats and the rotations in the turning block (to alter the angle of the shape’s corners.) Ask them to choose any of the shapes from the slides and have a go. If they complete one, they can chose a different one to try.
Gather the class back together at the end and ask some groups to present their work and how they programmed it.
Plenary
Finish by reviewing the three challenges from today and ask the class:
- What new things did they learn today?
- When is a loop useful?
- When might it not be appropriate?
- Can you think of a repetitive job that a robot might do in real life where a loop could be used in its code? Production lines in a factory are a good example of this, where the same movement is repeated to place, lift or move objects as they pass through.