ev3 software ev3 robot workshop 2015 lawrence technological university instructor: assistants:

42
EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

Upload: julia-lawrence

Post on 21-Dec-2015

236 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

EV3 SoftwareEV3 Robot

Workshop 2015

Lawrence Technological University

Instructor:Assistants:

Page 2: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 2015 Robofest competition Robobowl

• SPbot introduction

• Using the SPbot to solve the Robobowl challenge

Course Overview

2

Page 3: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Video overviewhttp://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

2015 Robofest competition

3

Page 4: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Please note that bowling the tennis balls are outside the scope of this workshop

2015 Robofest competition

4

Page 5: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

LEGO EV3 robot used – SPbot

Color Sensor

EV3 Computer

Left Motor: B

Right Motor: C Touch Sensor

Sonar Sensor

Page 6: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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

Remember the connections!

6

Please note that the retail version of EV3 uses an infrared sensor, not a sonar sensor.

Page 7: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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

EV3 Versions Used

7

Page 8: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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:

Free EV3 Software Download

8

www.lego.com/en-us/mindstorms/downloads

Page 9: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

9

Task 0

Move forward and stop when the rectangular shape is reached

Page 10: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Using wait block

• Using loop block

Task 0: Example Solutions

10

Page 11: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

11

Task 1

Measure the height of the rectangle

Watch the YouTube videos at:http://youtu.be/iDSttcFmYqI (MeasureDistance)

http://youtu.be/4e8T0bbh7bM (MeasureRectangle)

Page 12: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Determine how far the robot travels while moving forward

Measure Distances

12

Distance

Compute distance traveled by measuring the number of rotations of the wheel

Page 13: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Use the wheel geometry

Measure Distances

13

PI = 3.14

Circ

umfe

renc

e =

Dia

× P

I

Radius

Dia

met

er =

2 ×

Rad

ius

How can use this information?

Page 14: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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)

Measure Distances

14Program: MeasureDistance.ev3

Page 15: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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

Measure The Rectangle Height

15

Page 16: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Example of measuring the rectangle height

Measure The Rectangle Height

16Program: MeasureRectangle.ev3

Page 17: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

17

Task 2

Compute the location of pin 3 & 4

Page 18: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• We can use math blocks to compute the location of pins 3 & 4

• For example, assume

• How can we compute this using our robot?

EV3 Mathematical Operations

18

 mm

Page 19: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• We can use simple math blocks– Assumes that x = 200mm

EV3 Mathematical Operations

19Program: SampleMath1.ev3

Page 20: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Here is another approach using advanced blocks

EV3 Mathematical Operations

20Program: SampleMath2.ev3

Page 21: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

21

Task 3

Follow the edge of the table

Watch the YouTube videos at:http://youtu.be/3pRbiHxd-Gc (LineFollowZZ)

Page 22: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

Follow The Edge Of The Table

22

• Use the zig-zag method to follow the edge of the table

• Edge following is also referred to as line following

• We need to determine when the robot is on or off the table

Rig

ht

Ed

ge

Le

ft E

dg

e

Table

Page 23: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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 = ______

Follow The Edge Of The Table

23

ColorSensorReading

Page 24: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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.

Follow The Edge Of The Table

24

Page 25: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

Simple Line Following Algorithm

25Program: LineFollowZZ.ev3

Page 26: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Zig-zag method can cause a bumpy response• To improve the response, you can use a 3-level

line follower (concept shown below)

How to improve our line following algorithm

26

Off Table Off TableOn Table On Table

Page 27: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

27

Task 4

Find the bowl zone

Watch the YouTube videos at:http://youtu.be/zUnIvl3klLA (LineCrossing)

Page 28: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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

• One method for finding the bowl zone is reach and cross the black line that separates the bowl zone and no bowl zone

• This concept is called line crossing

Find The Bowl Zone

28

Page 29: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• How can we use our robot to detect lines?– Travel straight and look….

• Off Line = waiting to cross line

• On Line = reached line

• Off Line = crossed line

Line Crossing

29

CrossingLines

Page 30: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Sample approach

Line Crossing

30Program: LineCrossing.ev3

Page 31: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

31

Task 5

Find a set of pins

Watch the YouTube videos at:http://youtu.be/SAI0tS1K4_s (TravelDistance)http://youtu.be/bABKx8o9QJQ (SpinSearch)

Page 32: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Couple methods– Line follow for a given distance– Spin until the pins are detected with the sonar

sensor

Find A Set Of Pins

32

Page 33: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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)

• Solve for # Rotations….• # Rotations = Distance / [ (Wheel Diameter) x (PI) ]

• For our robot…• # Rotations = 30 cm / [ (5.5 cm) x (PI) ] = 1.74 rotations

Line Follow For A Given Distance

33

Page 34: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Example solution

Follow A Line A Given Distance

34Program: TravelDistance.ev3

Page 35: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Here we are going to have the robot spin until it “sees” the pins with the sonar sensor

Spin And Search

35Program: SpinSearch.ev3

Page 36: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

36

Task 6

Bowl a tennis ball

Page 37: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Again, this task is outside the scope of this workshop

• However, your robot should be in position to deliver a tennis ball if the previous tasks were completed successfully

Bowl A Tennis Ball

37

Page 38: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

38

Task 7

Return home

Watch the YouTube videos at:http://youtu.be/dEioHkb4Y98 (FindHome)

Page 39: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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

Return Home

39

Page 40: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• Two cases– Light sensor reading > 50. On home base.– Light sensor reading < 50. Off home base.

Return Home

40Program: FindHome.ev3

Page 41: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

• 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

Putting It All Together

41

Page 42: EV3 Software EV3 Robot Workshop 2015 Lawrence Technological University Instructor: Assistants:

[email protected]

Questions?

Little Robots, Big Missions

42