Академический Документы
Профессиональный Документы
Культура Документы
EV3 Robot
Workshop 2015
Instructor:
Assistants:
• SPbot introduction
2
2015 Robofest competition
• Video overview
http://youtu.be/LJ0afkDSuZA
• Key tasks
– Measure the height of the rectangular shape
– Compute location of pin 3 & 4
– Follow the edge of the table
– Find the bowl zone
– Find a set of pins
– Bowl a tennis ball
– Return home
3
2015 Robofest competition
• Please note that bowling the tennis balls are
outside the scope of this workshop
4
LEGO EV3 robot used – SPbot
Right Motor: C Touch Sensor
EV3 Computer
Sonar Sensor
Left Motor: B
Color Sensor
Remember the connections!
• Left Motor connects to B
• Right Motor connects to C
– If your motors are upside down forward will
be backwards in your program
• Color sensor connects to port no. 1
• Touch sensor connects to port no. 2
• Sonar sensor connects to port no. 4
Please note that the retail version of EV3 uses an infrared sensor, not a sonar sensor.
6
EV3 Versions Used
• Examples use EV3 Educational Version 1.0.1
or EV3 Home Edition 1.1.0
• EV3 Firmware version: V1.06H
• PowerPoint and all example programs are
available at robofest.net under Tech
Resources:
• EV3 RoboFest Workshop Sp2015.pptx
• RoboBowlWorkshop.ev3
7
Free EV3 Software Download
• LEGO offers a home edition of the EV3
software
• It is free to download and use, but has some
limitations
– No experiments
– Limited built-in sensor support
• You can download all sensor blocks
• Main download page:
www.lego.com/en-us/mindstorms/downloads
8
Task 0
9
Task 0: Example Solutions
• Using wait block
10
Task 1
Distance
12
Measure Distances
• Use the wheel geometry
PI = 3.14
Radius
13
Measure Distances
• For each rotation of the wheel, the robot will
travel (Wheel Diameter) x (PI)
• Distance = (Wheel Diameter) x (PI) x (# Rotations)
• Distance = (55 mm) x (PI) x (# Rotations)
• Distance = 172.8 x (# Rotations)
Program: MeasureDistance.ev3
14
Measure The Rectangle Height
• One method could be:
– Go forward until the black rectangle is found
– Reset motor rotation sensor
– Go until the end of the rectangle is found
– Read the motor rotations
– Compute the distance traveled
15
Measure The Rectangle Height
• Example of measuring the rectangle height
Program: MeasureRectangle.ev3
16
Task 2
17
EV3 Mathematical Operations
• We can use math blocks to compute the
location of pins 3 & 4
• For example, assume
mm
18
EV3 Mathematical Operations
• We can use simple math blocks
– Assumes that x = 200mm
Program: SampleMath1.ev3
19
EV3 Mathematical Operations
• Here is another approach using advanced
blocks
Program: SampleMath2.ev3
20
Task 3
21
Follow The Edge Of The Table
• Use the zig-zag method
to follow the edge of the
table
• Edge following is also
Right Edge
Left Edge
referred to as line
following
• We need to determine
when the robot is on or
off the table
Table
22
Follow The Edge Of The Table
• Get color sensor values to determine when the robot
is on or off the table. We will use the color sensor in
Reflective Light Intensity mode.
– Off table = ______
– On table = ______
– On foil = ______
Color
Sensor
Reading
23
Follow The Edge Of The Table
• Light sensor settings example
– Off table = 10
– On table = 40
– Median threshold = (10+40)/2 = 25
• Two cases
– Light sensor reading > 25. On table.
– Light sensor reading < 25. Off table.
24
Simple Line Following Algorithm
Program: LineFollowZZ.ev3
25
How to improve our line following
algorithm
• Zig-zag method can cause a bumpy response
• To improve the response, you can use a 3-level
line follower (concept shown below)
26
Task 4
27
Find The Bowl Zone
• Assuming that the robot is in the no-bowl
zone, we must enter the bowl zone in order to
bowl a tennis ball to knock down pins
Program: LineCrossing.ev3
30
Task 5
32
Line Follow For A Given Distance
• First, we need to know how far to go
– Let’s assume that the robot must travel 30 cm
– How many wheel rotations is 30 cm?
• Distance = (Wheel Diameter) x (PI) x (# Rotations)
33
Follow A Line A Given Distance
• Example solution
Program: TravelDistance.ev3
34
Spin And Search
• Here we are going to have the robot spin until
it “sees” the pins with the sonar sensor
Program: SpinSearch.ev3
35
Task 6
36
Bowl A Tennis Ball
• Again, this task is outside the scope of this
workshop
37
Task 7
Return home
38
Return Home
• One method to have the robot return home is
to line follow until home base is detected
• Using the same principal as line detection, we
can determine the threshold for detecting
home base
– On table / off home base = 40
– On home base = 60
– Median threshold = (40+60)/2 = 50
39
Return Home
• Two cases
– Light sensor reading > 50. On home base.
– Light sensor reading < 50. Off home base.
Program: FindHome.ev3
40
Putting It All Together
• In this course we learned how to
– Measure the height of the rectangular shape
– Compute location of pin 3 & 4
– Follow the edge of the table
– Find the bowl zone
– Find a set of pins
– Return home
41
Little Robots, Big Missions
Questions?
robofest@LTU.edu
42