Professional Documents
Culture Documents
SGV CUE 2017 Auto Robots
SGV CUE 2017 Auto Robots
SGV CUE 2017 Auto Robots
https://www.kokoteach.com/sgv-cue-2017/
About Your Presenters
Two objects: GoPiGo and Finch robot (or same robot programmed differently)
Problem: autonomously solve a maze
Data: Time it took to solve each maze. Did it solve every maze? Are specific
obstacles difficult for the robot?
Design Problem: Our robots solving the maze but, we must define our problem in
more details before we can design the solution
Success: Did our robot solve the maze? Set a time constraint.
Constraints: What does our robot need? How can we build our maze? How much
does it all cost?
3-5 Engineering Design
3-5-ETS1-2. Generate and compare multiple possible solutions to a problem
based on how well each is likely to meet the criteria and constraints of the
problem.
Problem: Program robot to autonomously solve a maze. Why? See previous slides
Multiple Solutions: Two robots OR one robot and modify the code OR one robot
running very different programs
Problem Constraints:
Robot solves maze by executing a program (NO CONTROLLING THE ROBOT MANUALLY)
Maze is simply connected (like house)
Start and End of the maze are on outer boundaries
Maze is made from NON-REFLECTIVE material (for sensors sake), light colors best
Maze is sturdy enough
Maze is wide enough
Optional: time constraint
Start Start Finish
Finish
NO Yes
Our Tools
Our Tools
GoPiGo 3
Our Tools
https://www.finchrobot.com/
$99 (10% educational discount available)
Finch Robot Loan Program:
https://www.finchrobot.com/finch-robot-loan-program
Features:
Motors (forward, backward, left, right)
obstacle sensor
Multicolor LED on the front beak
Accelerometers
x, y, z
Buzzer
Light, temperature
Plugs in via USB, no batteries needed
Finch Robot – Hardware
https://www.finchrobot.com/finch-hardware
For our purposes, we’ll focus on the obstacle sensors and motors
Obstacle Sensor
Return TRUE or FALSE if something is detected, does NOT return a distance
Has two, where the “eyes” are, each sensors returns TRUE or FALSE
Range is 3 to 12 inches
“Due to the limitations of this type of sensor very narrow objects or objects made
of certain black plastics may not register as obstacles.”
Finch Robot – Hardware
https://www.finchrobot.com/finch-hardware
Motors
Two gear motors (turn 360 degrees clock wise or counter clock wise)
“The Finch's top speed is roughly 15 inches per second.”
Finch Robot – Setting Up
+ =
GoPiGo
https://www.dexterindustries.com/gopigo3/
A moving robot with sensors
Cost: $200 for starter kit
Starter kit comes with everything you need including a RaspberryPi
Classroom kit $990 (5 starter kits)
Educational discount and trail kit (45)
https://www.dexterindustries.com/dextered/
Assembly Instructions
https://www.dexterindustries.com/gopigo3-tutorials-documentation/
Requires 8 AA batteries
https://www.dexterindustries.com/GoPiGo/learning/hardware-port-description/
Connecting Sensors and LEDs
Connecting wires is straight
forward using connectors
They can only go in one way
There are two types of sensors
ports:
I2C Port:
Analog / Digital Ports:
Distance Sensor (laser, more
Ultrasonic sensor (distance, cm in)
precise, cm in)
Connecting Sensors and LEDs
LEDs will blink, wait for a solid green LED in the back to light up
Then search for the WiFi Signal:
Connect to it.
When the solid green LED turns solid blue, that means you are connected
Your browser should automatically open up to bloxter.com
Our Tools
Finch GoPiGo
Think Like a Robot
Obstacle sensors are more similar to you holding out your arms
And in the case of the Finch, your hands are only out in front of you
And in the case of the GoPiGo, one hand is in front and the other is to your side
Finch GoPiGo
Let’s Break It Down…
Remember, we can move in any direction and we can use our hands/arms to sense
obstacles
Let’s discuss how we would solve the following cases
Finch GoPiGo
Simple Maze 1
Start
Finch GoPiGo
Finish
Simple Maze 2
Start
Start
Finch GoPiGo
Finish
Finish
Simple Maze 3
Start
Finish
Finch GoPiGo
Simple Maze 4
Start
Finish
Complex Maze
Start Finish
Approaches
We can walk forward until we hit something, then always
turn left (or always turn right)
Will solve some mazes but can get stuck in a loop
Follow the maze always touching the wall to your left or right
Well, since all the walls are simply connected, you can imagine
they’re made all with one single line, which means if we follow
that line we will eventually reach the end
No randomness, no back tracking, will always find the end
Finish
Finish
Finish
Complex Maze
Start Finish
Breaking Down the
Algorithm
States, Events, and State Diagram
Breaking Down the Problem
GoPiGo
Finch
Finish
State & Events
Let’s break it down using States & Events
State
A snapshot
A stage in the behavior / pattern of an object (our robot)
In our case: what is our robot doing?
Going forward, backward, left, right?
Event
External trigger
In our case: obstacle sensors returning TRUE / FALSE
State Diagrams
Diagram describe the behavior of systems
Composed of finite number of states
Great exercise for your students to help break down the problem, to find and
define behaviors / patterns, and to organize the steps of their algorithm to solve
the problem
You can draw these by hand, we’ll use https://www.draw.io it’s free and online
Final State
And numerous external triggers (aka Events) that can move us between States
State Diagrams – Example
And numerous external triggers (aka Events) that can move us between States
State Diagram – Example
Our robot has two sensors, Left Sensor and Right Sensor
GoPiGo Finch
LEFT
GPG F
RIGHT LEFT
RIGHT
Possible Maze Scenarios - GPG
GoPiGo Algorithm Break
GoPiGo Down
LEFT
GPG
RIGHT
Case 0 – Read Sensor
Trigger:
Sensor Left: TRUE
Sensor Right: FALSE
State:
Move Forward
Case 2 – Corner Right Turn
Left Wall Follower
Trigger:
Sensor Left: TRUE
Sensor Right: TRUE
State:
Turn Right
Case 1 then Case 2
Case 3 – Corner Left Turn
Left Wall Follower
Trigger:
Sensor Left: FALSE
Sensor Right: TRUE or FALSE
State:
Turn Left
Case 1 and Case 3
GoPiGo - Case 0, 1, 2, 3
GoPiGo
LEFT
GPG
RIGHT
Finch Algorithm Break
Finch Down
F
LEFT
RIGHT
Case 0 – Read Sensor
F
Before we do anything, we need to know what is around us
F
Nothing both sensors
Nothing in front
Trigger:
Sensor Left: FALSE
Sensor Right: FALSE
State:
Move Forward and Turn Left
Trigger:
Sensor Left: TRUE
OR
Sensor Right: TRUE
State:
Back Up and Reposition
Finch Case 0, 1, 2
Finch
F
LEFT
RIGHT
Case 1 then 2 then 1 then 2 then 1 …
F
Case 1 then 2 then 1 then 2 then 1 …
F
Alternatively – No Reading Sensor State
The sensors are constantly being read
They’re independent of our code, they’re part of the hardware
We can treat sensors as Events / Triggers
F GPG
GPG
F
So Far…
3-5-ETS1-2. Generate and compare multiple possible solutions to a problem based on how
well each is likely to meet the criteria and constraints of the problem.
3-5-ETS1-3. Plan and carry out fair tests in which variables are controlled and failure points
are considered to identify aspects of a model or prototype that can be improved.
MS-ETS1-2. Evaluate competing design solutions using a systematic process to determine how
well they meet the criteria and constraints of the problem.
MS-ETS1-3. Analyze data from tests to determine similarities and differences among several
design solutions to identify the best characteristics of each that can be combined into a new
solution to better meet the criteria for success.
MS-ETS1-4. Develop a model to generate data for iterative testing and modification of a
proposed object, tool, or process such that an optimal design can be achieved.
How much should we move forward? How much should we move forward?
What should the turning radius be? How far should the wall be from our
left sensor before we turn?
How much should we back up?
What if we get TOO close to the wall?
How should we reposition?
How should we turn left?
Should we pause for sensor readings?
Should we pause for sensor readings?
These are all things you can compare with tests, data results, and data analysis
Robot Simulation
Block Coding Part 1
Robot Simulation
Ideal Situation
One robot and computer per 2 to 3 students (paired programming)
Enough space for everyone to test their robots
There is enough time for students to finish programming
Reality
Robots and computers are not cheap
You may have 1 robot and computer for every 5 or more students
Space is limited
Time with the robots is limited
Solution
Robot Simulation
Robot Simulation
We go inside
AND OR
if Homework Turned In AND Complete AND 80% Correct, THEN mark complete
if hungry AND have spending money AND favorite place open, THEN eat out
if being loud OR making annoying sound OR doing something dumb, THEN dope slap
AND OR
In either case, we go
inside ONLY if the
condition is TRUE
We go in here ONLY
when our conditional
is FALSE
IF vs IF ELSE
This is useful if we
want to do something
when our condition is
FALSE
Repeat Until
If this is TRUE
Code:
https://www.kokoteach.com/sgv-cue-2017/
http://sched.co/C5Lv