- Redesign /resources as sectioned hub with category pages - Migrate 645 Squarespace CDN images to local /images/content/ - Create 9 new news/blog posts with event photos - Fix blog post slugs (rename gibberish filenames) - Rename Design Blog to Design Blogs across site - Remove education page, replace with Platform in nav - Redesign rover repair request form with dynamic rover entries - Add school search combobox to contact, store, and repair forms - Extract shared KNOWN_SCHOOLS data - Make /rover-expansion-3d-printing dynamically pull from MDX - Add related resources sections to product pages - Fix homepage broken /quote links to /store - Store page: sample kit cards, inline quote builder, mailing list opt-in
82 lines
1.6 KiB
Plaintext
82 lines
1.6 KiB
Plaintext
---
|
||
title: "Activity: Roaming Rover"
|
||
date: "2021-06-03"
|
||
categories: ["Activities", "All"]
|
||
tags: ["Iteration", "Ultrasonic", "Motors", "Beginner"]
|
||
excerpt: "Learn to avoid obstacles with the ultrasonic sensor."
|
||
featuredImage: "/images/resources/roaming-rover.png"
|
||
---
|
||
|
||
|
||
Program the rover to move around the room using the ultrasonic sensor to avoid running into obstacles. If the rover detects an object, turn away from the object and keep moving forward.
|
||
|
||
####
|
||
Relevant Coding Skills
|
||
|
||
Branching
|
||
|
||
-->
|
||
|
||
Iteration
|
||
|
||
Functions
|
||
|
||
Variables
|
||
|
||
-->
|
||
|
||
Algorithm Design
|
||
|
||
-->
|
||
|
||
Maths
|
||
|
||
####
|
||
Relevant Rover Concepts
|
||
|
||
Ultrasonic
|
||
|
||
IR
|
||
|
||
-->
|
||
|
||
Colour
|
||
|
||
Gyroscope
|
||
|
||
Accelerometer
|
||
|
||
Motors
|
||
|
||
LEDs
|
||
|
||
-->
|
||
|
||
Buzzer
|
||
|
||
-->
|
||
|
||
Activity Demonstration
|
||
|
||
### Setup
|
||
|
||
When running the exercise, it can often work well to have a small obstacle course setup with flat surfaces like boxes and books for the rover to detect. The ultrasonic sensor works best against flat hard surfaces as it is detecting reflected sound waves. Angled or soft surfaces are harder to detect.
|
||
|
||
### Here’s Our Approach
|
||
|
||
#### **Stage 1**
|
||
|
||
Use an IF statement block with a logic comparison block to check if the ultrasonic sensor detects an obstacle in front of the rover.
|
||
|
||
**Stage 2**
|
||
|
||
Use the IF ELSE block to turn when an obstacle is detected and drive forward when it is not detected using motor blocks.
|
||
|
||
#### **Stage 3**
|
||
|
||
Repeat this behaviour by wrapping everything in a while loop. While true will repeat forever.
|
||
|
||

|
||
|
||
Example Code
|