- 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
2.0 KiB
Plaintext
82 lines
2.0 KiB
Plaintext
---
|
||
title: "Activity: Survey Bot"
|
||
date: "2021-06-03"
|
||
categories: ["Activities", "All"]
|
||
tags: ["Iteration", "IR", "Motors", "Maths", "Advanced", "Colour Sensors"]
|
||
excerpt: "Learn iteration while using the IR sensors."
|
||
featuredImage: "/images/resources/survey-bot.png"
|
||
---
|
||
|
||
|
||
Program the rover to perform a distance survey of the area around it. Have the rover turn on the spot and print out the value of one of the IR distance sensors at intervals around the circle.
|
||
|
||
####
|
||
Relevant Coding Skills
|
||
|
||
Branching
|
||
|
||
-->
|
||
|
||
Iteration
|
||
|
||
Functions
|
||
|
||
Variables
|
||
|
||
-->
|
||
|
||
Algorithm Design
|
||
|
||
-->
|
||
|
||
Maths
|
||
|
||
####
|
||
Relevant Rover Concepts
|
||
|
||
Ultrasonic
|
||
|
||
-->
|
||
|
||
IR
|
||
|
||
Colour
|
||
|
||
Gyroscope
|
||
|
||
Accelerometer
|
||
|
||
Motors
|
||
|
||
LEDs
|
||
|
||
-->
|
||
|
||
Buzzer
|
||
|
||
-->
|
||
|
||
Activity Demonstration
|
||
|
||
### Setup
|
||
|
||
The IR distance sensors have a maximum range of approximately 125cm. If nothing is detected an IR sensor it will read 255.0cm. Place the rover amongst a collection of objects, run the code, and see if a partner can say where the objects were by only reading the distances the robot prints out. This can be done faster by using both IR sensors and only turning 180 degrees.
|
||
|
||
### Here’s Our Approach
|
||
|
||
#### **Stage 1**
|
||
|
||
In our approach, our objective is to get 15 readings from the environment around us. You might use a different number of readings. We will start with a loop block that repeats 15 times. If you’re missing obstacles, try a higher number to collect more readings.
|
||
|
||
**Stage 2**
|
||
|
||
We will need a motor turn by degrees block inside our loop. If we want our robot to have turned a full 360 degree circle once the code has finished running, this block will need to turn one fifteenth of a circle each iteration. After it has run 15 times our rover will have turned a full 360 degrees. We can use a math operation block to divide 360 by 15.
|
||
|
||
#### **Stage 3**
|
||
|
||
Finally we need the rover to print out the IR distance values. The print block will print that IR value to the console.
|
||
|
||

|
||
|
||
Example Code
|