Loading…
Loading…
This lesson introduces the computer vision interface and is intended for beginners in this specific area.

Level : Beginner
(Note : this lesson introduces the computer vision interface and is intended for beginners in this specific area. It does, however, assume prior experience with FTC Sim. Students and teaching staff should have already completed the standard introductory lessons and be familiar with using the platform and programming robot movements.)
In this lesson, students will discover how robots use cameras and AI to understand their environment through the computer vision interface. They will learn to recognise special markers called AprilTags, which provide key information to the robot. Through machine learning, the robot has been trained to identify these tags and respond intelligently. Students will program their robot to make decisions based on what it sees, bringing computer vision and autonomous behaviour to life in a fun and hands-on way.
This lesson plan is structured according to the 5E Instructional Framework, a widely recognised teaching model that includes five phases: engage, explore, explain, elaborate, and evaluate. The 5E Instructional Framework systematically engages students in inquiry-based learning, encouraging active exploration and understanding of complex topics.
During the lesson, students will:
learn to control a robot equipped with four omnidirectional wheels for increased mobility;
use AI and machine learning to detect and respond to AprilTags;
implement conditional logic to guide the robot's behaviour based on visual data.
sticky notes or a collaborative brainstorming app such as Microsoft Whiteboard, FigJam, 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)
a "student" account created for each of your students
projector or interactive whiteboard
To capture your students' attention and spark their curiosity about how robots use cameras and AI to make decisions, begin your class by showing an engaging video on your projector or interactive whiteboard. We particularly recommend the video "Tesla Vision: How Tesla Cars See the World", available at: https://youtu.be/DQpeteeEuHM. This video offers a fascinating look at how Tesla vehicles use camera vision and AI to navigate roads and recognise objects. It provides a concrete example of autonomous technology that sets the stage for learning about robotic vision, decision-making, and conditional programming.
After the video presentation, distribute sticky notes to your students and encourage them to participate in a brainstorming session on potential future applications of robots that use camera vision and AI to recognize objects and make decisions. Ask them to write only one idea per 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 in the sharing space to post their 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 has not yet been posted, they should find an available spot to display it.
Here are some ideas they might come up with:
Robots that deliver packages by recognizing house numbers and obstacles.
Autonomous agricultural robots that detect crop health using a camera.
AI-powered robots that assist visually impaired individuals by identifying objects.
Autonomous school robots that recognize student badges to retrieve them safely.
Warehouse robots that use AprilTags to sort and manage inventory.
Autonomous robots that guide visitors in museums or science centres.
Disaster rescue robots that locate survivors using visual markers.
Mobile vendor robots that navigate through crowds and respond to visual signals.
Street-cleaning robots that detect and avoid pedestrians.
Robots that monitor wildlife using a camera and AI.
Autonomous recycling robots that sort materials using visual recognition.
Delivery drones that land precisely using AprilTag markers.
Robots that assist in space exploration by identifying terrain features.
Facilitate a discussion by asking thought-provoking questions:
What advantages do you see in robots that use cameras and AI to recognize objects and make decisions? (e.g., they can perform tasks with greater precision, adapt to changing environments, and reduce the need for constant human supervision.)
What potential disadvantages do you associate with AI robots equipped with cameras? (e.g., they may misidentify objects, encounter difficulties in poor lighting conditions, or raise concerns related to data privacy and surveillance.)
What impact could the use of computer vision interfaces and object recognition have on sectors such as manufacturing, healthcare, or education? (e.g., robots could help sort items, identify patients or supplies, or even guide students in learning environments.)
Can you think of any ethical or safety concerns related to robots making decisions based on visual information? (e.g., if a robot misinterprets a visual cue, it could make a wrong decision, and there is also a risk of bias in AI training data.)
In which fields or applications do you think robots with vision could be most useful? (e.g., search and rescue missions, autonomous delivery, assisting people with disabilities, or monitoring environments.)
What potential social and economic implications could arise from integrating AI vision-based robots into our communities? (e.g., some jobs could be replaced, but new opportunities could emerge in the fields of robotics, AI development, and maintenance).
Can you imagine innovative or unexpected uses for robots that use computer vision interfaces and AI, beyond those we have discussed? (e.g., robots that help track endangered species, participate in archaeological digs, or assist astronauts on space missions.)
Encourage students to begin their hands-on learning experience with the FTC Sim platform by visiting the provided link, https://ftcsim.org/. Ask them to log in using their unique username and password. Once logged in, they will need to use the following link to load the workspace they will need for the lesson: https://ftcsim.org/puzzle/navbwgswudo/

In this FTC Sim world, zoom in on the robot to clearly show students the installed camera and the omnidirectional wheels.

Start the discussion with students by asking: "Where do you see the camera on the robot?" (e.g., the robot's camera is mounted at the top of a vertical mast that extends from the base of the robot. It is attached to a small bracket and is facing forward, which allows it to film the robot's environment from an elevated position.)
Continue the discussion by asking: "What differences do you notice between the wheels on this robot and the ones we used in previous lessons?" (e.g., in previous lessons, the robot had smooth, solid wheels. Only the rear wheels were connected to motors to move the robot, while the front wheels were designed to slide and support the robot. In the current lesson, the robot's wheels look different. They have small rollers or segments along the edges, and all four wheels appear identical. These new wheels seem more complex and could allow the robot to move in different ways.)
Explain that these new wheels are called "omnidirectional wheels" and that each one is connected to its own motor. These special wheels are equipped with small rollers along their edges, which allow the robot to move not only forward and backward, but also sideways and diagonally. This gives the robot much more flexibility and control in its movements. Show the four motors on the robot. Use this video to show how much easier it would be for a car to park if it were equipped with omnidirectional wheels. (https://www.youtube.com/watch?v=J-TOV-NBD70&t=15s)

In previous lessons, we used dual-motor coding blocks to control the robot's movements, since it only had two motors. Now that we are working with omnidirectional wheels, the robot needs four motors to move effectively: front left, front right, rear left, and rear right. This means the code will need to be updated to include all four motors.

Make sure students notice that the motors on the left side require negative values in the code. This is because they are installed in reverse, which causes them to spin in the opposite direction by default. Instead of having to manually enter negative values each time, they can simplify the process by adding two blocks in the initialization section that automatically adjust the motor's direction of rotation. This way, the motors will behave consistently and your movement code will be easier to write and understand.

Ask students to try this code. It should allow the robot to move forward in a straight line (and it will hit the large tower in front of it!). Then, ask them to practise moving the robot in different ways: turning right, turning left, moving forward, moving backward, sliding left, and sliding right. They should arrive at the following conclusion:

Now that students know how to manoeuvre the robot, it is time for them to begin exploring AprilTag. At this point, the teacher should zoom in on the large tower located directly in front of the robot on the FTC Sim playing field, where three AprilTags are installed.
Next, show students one of the AprilTags and ask them: "What do these AprilTags remind you of?" (e.g., they look like QR codes.) Explain that AprilTags are visual markers that the robot can detect using its camera. Each AprilTag has a unique identifier that allows the robot to recognise and distinguish between the different AprilTags present in its environment. AprilTags are often used in robotics for navigation, object recognition, and triggering specific actions.
Draw students' attention to the fact that each of the three AprilTag markers placed on the tower has a unique identifier: 21, 22, and 23. Explain that each time the program runs, only one of these markers appears at the front of the tower, directly in front of the robot. This means the robot will need to detect which marker is currently visible and respond accordingly. This introduces the concept of conditional logic based on the marker's identifier, which is essential for autonomous decision-making.

To activate the Vision Portal and AprilTag recognition, you need to add the following blocks to the initialization section of the code, before the call to Simulator.waitForStart(). These blocks are found in the "Vision" section.

Depending on the grade level and coding experience of your students, you may choose to explain the role of each line of code. If this seems too advanced for your group, you can simply provide the complete initialization sequence and focus the lesson on how the robot recognises AprilTags in the next step. This allows students to become familiar with the basic concept without being overwhelmed by configuration details.
Here is a summary:

Students should now test the code by pressing "Run". At first, it may seem like nothing is happening, as the code only configures the robot and does not include any movement commands. Ask students to click the small arrow in the bottom left corner of the screen. This opens the robot's camera view. They should be able to see the yellow cube and the AprilTag directly in front of the robot. Encourage them to run and reset the simulation several times. They will notice that the AprilTag on the tower changes each time, cycling through ID 21, ID 22, and ID 23. This shows how the simulation randomly selects one of the three markers with each run.

Students should now create a variable that will store a list of all the AprilTag markers the robot can see through its camera. In this simulation, the robot should only detect one marker at a time, as the other markers are positioned behind the tower and out of view. The variable will be named AllDetections and will help the robot keep track of the AprilTag markers currently visible.

Students should now assign a value to the allDetections variable by using AprilTagProcessor to retrieve the list of detected markers. To do this, they need to add blocks that call AprilTagProcessor and retrieve the current detections. The blocks they add to their code should look like the example below.

Students can now add a conditional structure to check how many AprilTags the robot can see by looking at the length of the AllDetections variable. If the length is greater than zero, it means at least one AprilTag has been detected. Students should then use the Telemetry display to show a message confirming that an AprilTag has been detected, as in the example below. Students may need to click "Show Telemetry" to see the data displayed by the robot.

Challenge: Encourage students to add code that makes the robot turn before checking the AprilTag ID. This helps them observe how movement affects what the robot can see. If the robot turns away from the tower, it may not detect any markers, as they are no longer in its field of view. In that case, the AllDetections list will be empty and the Telemetry display will show no markers detected. This is an excellent opportunity for students to understand how camera orientation and robot positioning affect marker detection.
The next step is for students to indicate which AprilTag identifier the robot is detecting. To do this, they need to create a new variable called firstDetection. Since the robot can only see one marker at a time, this variable will store the first item in the AllDetections list. Students will then use Telemetry to display the ID of the detected marker. To do this, they will use AprilTagDetection.id from the firstDetection variable. Finally, they will need to place this part of the code inside a loop (repeat while...) so that the robot continues searching for markers and updating the display while it is running. Here is what the code should look like at this stage.

Invite students to add comments to their code to explain the different coding blocks they used. Comment blocks are blue and available in the "Miscellaneous" section. Explain that computer engineers work in teams and must document their code with comments to ensure their colleagues can understand the meaning of their code. Here is an example of the second version of the code for the second challenge with comments added.

Ask students to communicate their solutions to the challenges by posing reflection questions, for example:
How do omnidirectional wheels differ from traditional wheels? How does this affect the robot's movements?
What happens when all four motors are set to power 1? And to -1?
What is the Vision portal and why is it important for this lesson?
What does AprilTagProcessor do in your code?
Why do we need to configure the camera before starting the robot?
What are AprilTags and how are they used in robotics?
What does the variable (list) AllDetections store?
How can you tell if the robot has detected an AprilTag using telemetry?
What happens if the robot turns around and moves away from the tower? What does this tell you about how the camera works?
Why do we check the length of the AllDetections list before trying to read the tag's ID?
How could you use conditional logic to make the robot behave differently depending on which tag it sees?
Encourage students to write code that includes three conditional branches: one for when the detected AprilTag ID is 21, one for when the detected ID is 22, and one for when the detected ID is 23.
In this challenge, students will use the robot's arm and claw to pick up the yellow cube. Depending on the detected ID:
· If the ID is 21, the robot must place the cube on the left pad.
· If the ID is 22, it must place it on the right pad.
· If the ID is 23, it must move the cube to the pad located behind the robot.
Remind students that, to control the arm and claw, they must use the actuator motors. In the drop-down list, they will find two motor names: armTilt and claw.
· To tilt the arm backward, use a value of -1.
· To tilt the arm forward, use a value of 1.
· To open the claw, use a value of 1.
· To close the claw, use a value of -1.

Below is a basic version of the code to help students begin building their own solution. The code is not complete, so students will need to fill in the actions for each part of the condition based on the detected AprilTag ID.

Assessment for the lesson should happen through observations and conversations with students as they code. To evaluate how effective the lesson is, observe how students interact with the FTC simulator, how they apply the Vision Portal and AprilTag recognition concepts, and how they use conditional logic to guide the robot's behaviour.
Engage students in meaningful dialogue about their thought processes, challenges and strategies. This will help you better understand how they perceive the influence of camera vision and AI on robot decision-making. These interactions will also allow you to give targeted feedback and adapt your teaching to support learning.
Here is a list of "look-fors" to guide your observations and assessment:
Engagement and curiosity: Are students actively exploring the robot's camera view, experimenting with movements and showing interest in how AprilTags influence the robot's behaviour?
Understanding of the Vision Portal setup: Are students able to explain the purpose of the Vision Portal and how it connects the camera to the AprilTagProcessor?
AprilTag detection and logic: Are students able to detect AprilTags, store them in variables and use conditional logic to respond to different tag IDs?
Problem solving and debugging: Do students identify problems in their code, troubleshoot detection issues and adjust the robot's movements or camera angles to improve results?
Use of telemetry: Do students use the telemetry display effectively to monitor tag detection and the robot's responses?
Motor and actuator control: Are students able to correctly use the armTilt and claw motors to manipulate the yellow cube based on the tag ID?
Response to failure and iteration: How do students react when the robot fails to detect a tag or behaves unexpectedly? Are they persistent, thoughtful and willing to revise their code?
Code documentation: Do students use comment blocks to explain their code and make it easier for others to understand?
This approach ensures that assessment focuses not only on the final result, but also on the learning process, experimentation and the thoughtful application of new concepts.
C3.1 solve problems and create representations of mathematical situations computationally by writing and executing code, including code that includes conditional statements and other control structures.
C3.2 read and modify given code, including code that includes conditional statements and other control structures, and describe the impact of these changes on the results.
C2.1 use coding to demonstrate understanding of algebraic concepts, including variables, parameters, equations, and inequalities.
C2.2 create code to decompose situations into computational steps to represent mathematical concepts and relationships, and to solve problems.
C2.3 read code to predict its outcome, and modify the code to adjust constraints, parameters, and outcomes for a similar situation or for a new situation.
C2.1 use variables, constants, expressions, and assignment statements to store and manipulate numbers and text in a program.
C2.3 develop programs that include simple and nested conditional statements.
C2.4 develop programs that include sequential, selected, and repetitive events effectively.
C2.5 develop programs that include the use of Boolean operators, comparison operators, string operators and arithmetic operators.
C2.6 interpret programming errors, and implement strategies to correct them.
C2.7 write clear internal documentation and use coding standards to improve the readability of code.