SPIKE™ Prime with Python

Parking Lot

Investigate programming a vehicle to park autonomously

90-120 min.
Avançado
6º ao 8º Ano do Ensino Fundamental

Questions to investigate

• How can math functions support creating autonomous vehicles?

Prepare

• Ensure SPIKE Prime hubs are charged, especially if connecting through Bluetooth.
• Ensure students have the driving base model built previously used in the Make It Move Lesson.

Engage

(Group Discussion, 10 minutes)

Engage students in a discussion about autonomous vehicles focusing on self-parking.

Show videos or images of vehicles that are autonomous parking. Then ignite a discussion with the students about how these vehicles work and how they are currently being used.

Focus in on the example of cars that can park themselves. There are several models of cars that can parallel park themselves. Discuss how sensors play a role in how these vehicles work.

Explore

(Small Groups, 45 minutes)

Students will plan and program their driving base to park without assistance.

Provide each team with an assigned parking space (1-12) and an assigned street to enter the parking lot from.

Show students a picture of the parking lot. You may use this example or use the one on taped on the floor. All students will need to see the parking for class discussion, so it may be easier to show a picture on an overhead projector.

Unit_9_Lesson_5_Parking_Lot.jpg

Review the rules with students:
• Both cars must enter at the same time into the parking lot
• Neither car can stop except in a parking space
• No one can touch the vehicle once it enters the parking lot.
• Cars can only back up when they are backing out of a space
• No part of the car can move over any of the lines

Discuss as a class how both cars be parked safely. Consider what happens if the vehicles need to move past each other. Go through each pair of cars entering at the same time.

Parking Challenge
Students will program their vehicles to autonomous park in their assigned space without colliding into another vehicle.

Direct students to add a distance sensor to their driving base in a position that the sensor is pointing down. Students can use the build section of the app for inspiration if needed.

Direct students to open a new project in the Python programming canvas. Ask students to erase any code that is already in the programming area. Students should connect their hub.

Allow students time to program their vehicles to park. Provide students with the following elements that must be included in their program:
• The distance of the entire parking lot must be used
• More than one math function must be used
• The distance sensor must be used

Ask students to program their robots and work together as two teams to perfect the parking of the autonomous vehicles.

Explain

(Whole Group, 15 minutes)

Discuss with students how the program worked. Ask students questions like:
• Ask students to explain how they determined how to handle the movement into the correct parking spaces. Was it easier to park in an empty parking lot or a full one? Did it matter?
• What issues were the most difficult to overcome?
• What was easy about the challenge?

Elaborate

(Small Groups, 15 minutes)

Now that all the robots are in the parking lot, it’s time for them all to leave. The class has a choice to make, they can choose one of the following scenarios to empty the parking lot:
A. All robots exit to the street from which they entered in the order they entered.
B. All robots exit to the street opposite from where they entered in the opposite order in which the entered.
C. All robots exit at the same time to Main Street in a synchronous movement.
D. All robots in odd numbered spaced exit to Main Street in a synchronous movement followed by all robots in even numbered spaces exiting to A Street in a synchronous movement.

Have the class discuss and choose a scenario. Then, write pseudocode and program the robot. When everyone is ready. Set up the parking lot and have all robots exit the parking lot.

Evaluate

(Group Exercise, 15 minutes)

Teacher Observation:
Discuss the program with students.
Ask students questions like:
• How were you able to come up with multiple ways to solve a problem?
• How were you able to use a sensor as part of your autonomous vehicle?
• How were you able to incorporate math functions in your program?

Self-Assessment:
Have students answer the following in their journals:
• What did you learn today about using multiple math functions in one program?
• What characteristics of a good teammate did I display today?
• Ask students to rate themselves on a scale of 1-3, on their time management today.
• Ask student to rate themselves on a scale of 1-3, on their materials (parts) management today.

Suporte ao Professor

Students will:
• Use conditional statements in a program using sensors and motors.
• Apply sensors to real-life problems.

• SPIKE Prime sets ready for student use
• Devices with the SPIKE App installed
• Parking lot – printed or taped on floor
• Student journals

CSTA
2-AP-18 Distribute tasks and maintain a project timeline when collaboratively developing computational artifacts.
2-AP-12 Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.
2-CS-02 Design projects that combine hardware and software components to collect and exchange data.
2-AP-10 Use flowcharts and/or pseudocode to address complex problems as algorithms.
2-AP-13 Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.

Legal NoticePrivacy PolicyCookies

LEGO, the LEGO logo, the Minifigure, DUPLO, the SPIKE logo, MINDSTORMS and the MINDSTORMS logo are trademarks and/or copyrights of the LEGO Group. ©2022 The LEGO Group. All rights reserved. Use of this site signifies your agreement to the terms of use.