Making a Self Driving Car – Overview
It’s time to write the code for our self-driving car. The car should recognize the signs and landmarks in its path and perform the action accordingly.
Completing the script
Now let’s complete the script to transform Quarky into a self-driving car!
- We will start from the script that we have made in the previous topic.
- Replace the say () block with the if-else block.
- Place is signal () detected? block from the Autonomous Driving palette. And select GO from the drop-down.
- Place a go () at () % speed for () seconds block under the if arm. Forward, 100%, and 1 are set as the default direction, speed, and time.
- Place another if-else block under the else arm.
- Add another is () signal () detected ? block inside the diamond-shaped space of the second if-else block. Select Turn Left from the drop-down.
- Add another go () at () % speed for () seconds block below the if arm of the second if-else block. Set the direction to Left.
- Add another if-else below the else arm of the second if-else block.
- Repeat steps 6 and 7. Select Turn Right from the drop-down of the is () signal () detected? block and set the direction of the go () at () % speed for () seconds block as Right.
- Click the green flag to run the script.
Make your own city by placing the signs and landmarks and then make the car drive on its own.
Now that you know how self-driving car works and the line-following robot works. It’s time to show your skill. We challenge you to make a self-driving car that detects the signs and landmarks and takes actions but also, should follow the line. To make one such arena, place the arena which you’ve got in your innovator kit on the flat surface and put the signs and landmarks across the path.
Before you move on to the next lesson, a small assignment awaits you!
Make a video of the project(challenge) 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:
- First, you need to choose the video file, thus click on Browse.
- Select your video file.
- And click the Upload button.