Loading…
Loading…
Embark on a puzzle-solving adventure in the FTC simulator, where coding meets strategic thinking and custom functions.

Level: Advanced
Embark on a problem-solving adventure in FTC Sim, where coding meets strategic thinking and custom functions. This lesson introduces students to the challenge of navigating precisely through obstacles and using functions to streamline their code to improve its efficiency and adaptability. Through hands-on exercises, they will learn to implement these functions to solve challenges, strengthening their problem-solving skills and deepening their understanding of advanced programming concepts. This approach fosters creativity and equips students with the tools needed for sophisticated robotics programming, combining logical reasoning with the practical application of robotics principles.
This lesson plan is structured according to the 5E instructional model, a widely recognized teaching model that includes five phases: Engage, Explore, Explain, Elaborate and Evaluate. The 5E model systematically engages students in inquiry-based learning, encouraging active exploration and understanding of complex topics.
During the lesson, students will:
Understand the concept of using custom functions in programming to simplify complex tasks and improve code reusability.
Apply these functions in FTC Sim to navigate and solve challenges, demonstrating strategic thinking and precision.
Develop advanced problem-solving strategies by using functions to efficiently overcome obstacles and challenges in virtual robotics environments.
removable sticky notes or a collaborative brainstorming app such as Microsoft Whiteboard, Google Jamboard or Apple Freeform.
devices for your students (Windows computers, Mac computers, Chromebooks)
Google Chrome or Microsoft Edge (Chromium version) web browser
access to the FTC simulator website (https://ftcsim.org)
student account created for each of your students
projector or interactive whiteboard
To capture your students' attention and spark their curiosity about robots that overcome obstacles, use your projector or interactive whiteboard to share a captivating video featuring a robot inspired by the ancient self-devouring Ouroboros serpent that can overcome any obstacle, which you can find at this link: https://youtu.be/TNSo14slkbs?si=5iu256VwTdKQVVgV. Thanks to its advanced sensors and agile mobility, this robot effortlessly crosses varied terrain, autonomously detecting and manoeuvring around obstacles in its path.
After showing the video, hand out removable sticky notes to your students and encourage them to brainstorm the different obstacles robots may have to overcome and the ways they can overcome them. Their ideas may include physical obstacles in different settings and sensors designed to detect them. Ask them to write only one idea per removable sticky note. Assign them a designated area on the classroom wall where they can post their ideas. Once they have come up with several ideas, ask them to gather at the sharing space to post their removable sticky notes. If an idea has already been posted on the wall, they can place theirs on top of the existing one, whereas if the concept is not yet posted, they must find an available spot to display it.
Here are some of the ideas they may have:
Obstacles:
Rough terrain: In outdoor environments such as forests or rocky landscapes.
Steps or stairs: Commonly found in buildings, homes or urban environments.
Narrow passages: Encountered in tight spaces such as hallways, lobbies or between pieces of furniture.
Doors: In indoor environments, robots may need to open closed doors or get through them.
Obstacles of different heights: Ramps, curbs or platforms, for example, often found in urban landscapes or on construction sites.
Cluttered environments: Including objects such as debris, furniture or misplaced items, common in cluttered homes or workspaces.
Water or puddles: Found in outdoor spaces, parks or wet environments.
Low branches or overhead obstacles: In outdoor spaces such as parks, forests or even indoor spaces with low ceilings.
Moving obstacles: Such as people, animals or vehicles, encountered in dynamic environments such as streets or crowded areas.
Gates or fences: Generally found in residential areas, farms or industrial sites.
Ways to overcome obstacles:
Specialized wheels or tracks to cross rough terrain.
Use of extendable arms or lifting mechanisms to get over steps or stairs.
Sensors to detect and get around narrow passages or obstacles.
Robotic arms equipped with grippers to open doors or handle objects blocking the path.
Adjustable suspension systems to get over obstacles of different heights.
Cameras and computer vision algorithms to detect and avoid cluttered environments.
Waterproof seals or coatings to protect against water damage
Lidar sensors to detect and avoid overhead obstacles.
Lead a discussion by asking thought-provoking questions:
What do robots do if they can't get past an obstacle? (e.g., if a robot can't get past an obstacle, it can back up and try another solution or ask another robot or a human for help. It's like when you're doing a challenge and can't figure out where a piece goes: you can try another piece or ask someone for a hint).
Why is it helpful for robots to remember the obstacles they have encountered? (e.g., remembering obstacles lets robots be smarter and know where they're going. It's like when you remember there's a hole in the ground on the way to school and you go around it the next day. Robots can also learn from their experiences).
How can robots use tools to overcome obstacles? (e.g., robots may have special tools, like a shovel or a hook, to push objects out of their way or to grab onto something to pull themselves up. It's a bit like using a shovel to dig a hole or a ladder to climb a fence).
Why do robots need sensors to move around? (e.g., sensors let robots see where they're going and avoid bumping into things, a bit like how we use our eyes to look around and avoid bumping into walls).
How can robots work together to get past an obstacle? (e.g., robots can talk to each other using signals, so one robot can tell another robot about an obstacle, and then they can figure out together how to get around it, like if you and your friend came across a big puddle and had to find a way to step over it or go around it).
Explain that robots and autonomous vehicles often have to overcome obstacles when navigating complicated terrain. Mention that the next lesson will focus on coding robots in FTC Sim, using various methods to get past obstacles and successfully reach their final destinations.
Encourage students to begin their hands-on learning experience with the FTC Sim platform by navigating to the link provided, https://ftcsim.org/. Have them log in using their username and password. Once logged in, direct them to the "Courses" section and guide them to select the course titled "FTC Puzzles." Explain to students that this course will help them gain the skills needed to code and effectively control autonomous robots, with a focus on getting past obstacles.


In the "FTC Puzzles" section, guide students to the challenge titled "1- Road Block."


Invite students to start coding the road block challenge. Explain that the robot must knock the block into the pit to activate the bridge. Add that the robot must push the block and wait for the bridge to close before moving forward.
To access the coding panel, click the green computer icon on the left side of the screen. You will notice that some sample code is already there. It is essential to tell your students that this code is divided into three main sections, each marked by blue comment blocks:
Initialization blocks: This section contains the information the robot needs before it begins its tasks.
Execution blocks: Most of the code you write will go in this section, where the robot's main actions are defined.
Loop blocks: These blocks are used for tasks that need to be repeated many times. However, for this lesson, we will only work with the initialization and execution blocks. The loop section can be deleted to keep the code structure cleaner.


Explain that in the first part of the puzzle, the robot must travel the exact distance to push the block into the pit without falling in. Encoders will be used to ensure precise movement. A distance of 4500 ticks should be enough.


The bridge should close automatically, removing the obstacle.

Now it is time to move toward the last square to raise the flag.


Encourage students to adjust the pause between the two movements so the bridge has time to close completely before the robot drives over it.
Encourage your students to move on to the next challenge in the "Puzzles: 2— Bridge" section.

Explain to them that in this challenge, they will need to move the robot to reach the first yellow block and push it into the first pit. Then, the robot must manoeuvre to grab the second block and drop it into the second pit. Finally, the robot must drive to the last pad to raise the flag.

Ask students to think about the pseudocode for getting the robot into this position. Explain that pseudocode is a simplified, informal way of programming that describes an algorithm without using the syntax of a specific coding language.
Move in a straight line
Turn left 90°
Move in a straight line
Turn left 90°
Move in a straight line, pushing the first block into the first pit
Move backward in a straight line
Turn right 90°
Move in a straight line
Turn left 90°
Move in a straight line, pushing the second block
Turn left 90°
Move in a straight line while pushing the second block
Turn right 90°
Move in a straight line while pushing the second block into the second pit
Move in a straight line to the pad
Ask students to recognize the patterns. They should realize that turning left 90° and turning right 90° are used more than once. Instead of solving the challenge right away, students should create functions for these turns.



Now that the robot has functions to turn left and right 90 degrees, students need to work on two functions for moving forward and backward. Because the robot will not always travel the same distance, students need to learn how to create a function that includes an input. An input can be added by clicking the gear icon. In this case, the input added will be "ticks."

When using this function in the main code, a value can be added as an input:

The code for moving forward can now be added to the function. Students must use the "ticks" variable from the "Variables" menu to set the position. The pause will vary depending on the speed and distance. In this example, the robot moves at 10% speed, and the pause is estimated to be about 1.5 times the number of ticks. Students will need to adjust this value if they use a different speed.

Similar code can be created for moving backward.

With the "move forward" and "move backward" functions created, the following code should make the robot move forward and then return to its starting position.

Students should now have all the functions they need to complete the challenge. Their main code should be a simple sequence of calls to these functions. This sample code is a good starting point. It should slide the first block into the pit, then bring the robot into position to grab the second block. Students should see how easy it is to code once all the functions are created. The code should match the student's pseudocode.


Invite students to add comments to their code to explain the different coding blocks they used. Comment blocks are blue and are found in the "Miscellaneous" section. Explain that computer engineers work in teams and must document their code with comments to make sure their colleagues can follow what the code means. Here is an example of the functions created in the code for the second challenge (Challenge 2— Bridge) with comments added.

Have students share the solutions they found for the first two challenges by asking them reflection questions, for example:
How did you use the "move forward" and "move backward" functions to make the robot navigate through the challenge? (e.g., We used the functions by calling them in the main code and providing the appropriate inputs, namely the distance in ticks that we wanted the robot to travel).
Can you explain why you use functions in your code? How did they help you solve the challenge? (e.g., Functions helped us organize our code and avoid repetition. By creating functions for common actions such as turning and moving, we can call these functions whenever needed, which makes our main code cleaner and easier to understand).
Describe how you adjusted the pause time in your code. Why is it important to adjust the pause time when using encoders? (e.g., We adjusted the pause time based on the speed and the distance the robot had to travel. It is important to adjust the pause time to make sure the robot has enough time to finish its movement, especially when using encoders to get precise control of distance).
How did you make sure the robot pushed the block into the pit without falling in itself? (e.g., We carefully calculated the distance the robot had to travel using encoders to make sure it reached the block without falling into the pit. We also adjusted the speed and the pause time to control the movement).
Explain the process of creating and using functions with inputs in your code. How did this help you solve the challenge? (e.g., We created functions with inputs by adding a variable (ticks) to represent the distance the robot has to travel. This allowed us to reuse the same function for different distances, making our code more flexible and adaptable to the different situations in the challenge).
Encourage students to put the skills they have just learned into practice to solve FTC Puzzles Challenges #3 and #4. In these challenges, they must create functions to find a solution so they can solve each challenge quickly. Challenge #3 is very similar to Challenge #2, but there are 3 yellow blocks instead of 2 to move into the pits in order to reach the last block and raise the flag. Challenge #4 combines the skills learned in the second lesson (Sensing the Path: Using Sensors to Guide Robot Decisions) with the skills learned in this lesson. Students must use the colour sensor to decide which side to use to reach the flag.

The lesson should be assessed through observations and conversations with students as they code. Assessing the effectiveness of the lesson should include observing students as they code and engaging in constructive dialogue with them about their thought processes, challenges and strategies. This approach provides a better understanding of how well they grasp and apply the concepts taught, including how they solve problems and refine their code to achieve the desired movement and navigation with the virtual robot. Through these interactions, educators can assess each student's understanding of the concepts, provide targeted feedback and adjust instruction as needed to support learning outcomes.
Here is a list of "look-fors" to guide your observations and assessment:
Engagement and participation: Observe whether students are actively engaged in the task, experimenting with the code, taking part in discussions or asking questions.
Problem-solving skills: Note students' ability to identify problems in their code, debug errors and apply logical reasoning to overcome difficulties.
Application of instructions: Check whether students correctly apply the instructions and guidelines provided for the lesson, for example by using the right blocks or the right code syntax for movement and navigation.
Creativity and innovation: Look for creative approaches or innovative solutions that students might apply in their coding strategies, beyond the basic requirements of the lesson.
Understanding of motor commands: Observe students' understanding of how motor commands affect the robot's movement, including speed, direction and the execution of specific turns or manoeuvres.
Use of rotary encoders: Assess students' proficiency in using rotary encoders for precise movement control, including setting target positions, adjusting speed and resetting the encoders for subsequent movements.
Use of functions: Assess students' ability to effectively implement functions to segment code, promote code reuse and improve code readability, demonstrating an understanding of the principles of modular programming.
Input handling: Monitor how students handle inputs in their code, making sure they correctly use variables or parameters to adapt their code to different scenarios and setups.
Response to failure: Pay attention to how students respond to failure or unexpected results, looking for resilience, persistence and a willingness to experiment and learn from mistakes.