GETTING STARTED
ROBOTICS
TAKING LEARNING TO THE REAL WORLD
CAPSTONE PROJECT

ACTIVITY: Making an AI Delivery Bot

Making an AI Delivery Bot – Overview

Now it’s time to make our AI delivery bot! The delivery robot should follow the path, check whether it has reached the correct destination or not without any crashes, and deliver the parcel.

In our case, the objective of our robot will be following the line to move forward, stopping at the checkpoints and detecting the number cards to check whether it has reached the correct destination or not and update the status of the delivery by turning the LEDs on it to Green.

Let’s set up your arena like this and place your recognition/number cards at the following places.

The robot will start from just ahead of checkpoint 3, and then it will do line following until it reaches the following checkpoints:

  1. Number 1: 
  2. Number 2:
  3. Number 3:

As you have noticed we have to create 3 different scripts for each case. Let’s begin. 

Going to Checkpoint 1

Understanding the Logic

We’re going to use our line-following robot as an AI delivery bot. Here’s how it will work.

We have to do the following in order to successfully reach the number 1 checkpoint:

  1. Initialize the robot with its IR sensor threshold values and speed parameter so that we have our line follower ready.
  2. Then do line following and continuously check if both the sensors are active. If both the sensors are active we know that we have reached a checkpoint and we have to stop. 
  3. Then we have to analyze the camera feed for the numbers and detect numbers.
    1. If number 1 is detected, then we know that we have reached the destination.
    2. If number 1 is not detected, then we have to move the robot forward and skip the current checkpoint and again do step 2.

Let’s Code!

We will use the previous script as the starting point of the current script.
  1. From the Sensors palette, add two sets () IR sensor threshold to () blocks above the turn () video on stage with () % transparency block. Set the threshold values of the two IR sensors that we obtained in the previous lesson.
  2. Add set parameter F (), T1 (), T2 () block as well to set up the speed parameters of the robot. Put the values from the previous activity. 
  3. Now, add a do line following block from the Robot palette into the forever block.
  4. Inside the do line following block, add a stop robot block. Add the other code below the stop robot block.
  5. Now add stop all from Control palette inside the if branch to stop the robot when number 1 is detected. 
  6. And add go () at speed () % block inside the else branch to move ahead and skip the current checkpoint. 

With this, our script is complete. Run it by clicking the green flag and enjoy!

Going to Checkpoint 2

Understanding the Logic

Here’s how it will work.

 

All the things would be the same, but there would be one major difference. As you can notice, number 2 is detected on checkpoint 1 and checkpoint 2, but when the robot is at checkpoint 2, number 1 is not visible. And this is what we will use. Checkpoint 2 is detected only when number 2 is visible and number 1 is not visible. 

Script

The script will be pretty much the same and we only have to change the conditions when numbers are detected according to the logic. Following is the final script:

Click on the green flag and test your script.

Going to Checkpoint 3

Understanding the Logic

Here’s how it will work.

 

All the things would be the same as number 1, just the number will change to 3. 

Script

The script will be pretty much the same and we only have to change the conditions when numbers are detected according to the logic. Following is the final script:

 

Click on the green flag and test your script.

Assignment

Before you move on to the next lesson, a small assignment awaits you!

Make a video of the project you made in this activity and upload it to the website.

Submitting the assignment is a must in order to receive the certificate after completing the course.

Follow the steps below to upload your assignment:

  1. First, you need to choose the video file, thus click on Browse.
  2. Select your video file.
  3. And click the Upload button.

Good luck!

×
×

Cart