EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming...

98
EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1

Transcript of EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming...

Page 1: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

EV3 Brick and Beginning Programming

Wizards.exe FTC Team 9794

1

Page 2: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

2

Special Thanks

› UMBC

› Bill Aucoin aka “RobotBill”

› Dana Aucoin, MD Senior FIRST Mentor

› Diwakar Pandey from Fast and Curious, Rockville, MD.

› Oregon Robotics Tournament & Outreach Program (ORTOP)

› Stemcentric

› Mark Vanderlyn from Geared Up (Ashburn Robotics)

› Droid Robotics

› Hundreds of teams we have interacted with and seen videos from.

› All the coaches that have contributed to the Wizards.exe FTC fundraiser.

Page 3: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

3

Trainers/Organizers Contributing to This Presentation

Ishaan Oberoi: Three years on an FLL team and Two years on FTC Team. Mentored

FLL team Organized Kaos in 2015-16.

Nick Aucoin:

Pankaj Oberoi: FLL and FTC coach. 4 Years experience as FLL Coach. Coached

Mindstorm Masterminds to 2015 World Championships, Organized Kaos to Open

European championships in 2016. Maryland State Championships 2013-2016

Contact: [email protected]

Page 4: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

4

Goals for Training

› Build your confidence in the EV3 programming language and Robot design and strategy.

› Introduce programming through the application of robot design, navigation, and strategy.

› Designed to help you coach your team.

– Exercises and Team building activities

– You’ll need a different set of slides.

– Do not just provide them with the solutions.

– ”…Coaches should know enough to not let their teams be absolutely stuck. Everything beyond that should come from experimentation and learning as a team. The most useful takeaway for any coach should be to expect variability and to be prepared to learn to deal with the variability. Some of the coaches are not technically inclined -- that's ok…” D. Pandey

› Gain experience with real world problems. (In a virual world a robot always goes straight).

› Share experiences with other coaches and best practices for leading a team

Page 5: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

5

FLL Core Values

9/18/2016 5

Don’t go out and just give your

students all the tips and trick you

learn here.

You don’t need to be an expert, but we’ll try

to make you more comfortable.

Kids learn from watching coaches,

parents, and mentors.

› We are a team.

› We do the work to find solutions with guidance from our coaches and mentors.

› We know our coaches and mentors don't have all the answers; we learn together.

› We honor the spirit of friendly competition.

› What we discover is more important than what we win.

› We share our experiences with others. We display Gracious Professionalism® and Coopertition® in everything we do.

› We have FUN! –

› http://www.firstlegoleague.org/mission/corevalues

Page 6: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

6

Coaches’ Promise

Make sure parents and mentors know that the

kids make all the decisions.

Inspire your Team

Children do the Work

Encourage

Teach them and provide basic skills

and knowledge

Guide them through asking

questions and exploration

Adults should not be

programming or coding the robot.

Don’t touch anything at the

competition or Qualifier, including

the robot.

Page 7: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

7

Follow the Rubric

› Review the rubrics with the team

› Have the robot lead and the programming lead know what needs to be done.

› 10 minute Judging session will focus on how well the team:

– Planned

– Designed

– Programmed

– Came up with Innovate Strategies

Page 8: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

8

Pseudocode

› Pseudocode is used to describe and document a process or method or program in a way that humans can understand them.

› Pseudocode does not have all the underlying data or information that may be needed to do the lower level tasks like pick up the pencil, holding the pencil.

› Pseudocode is a great way for a programmer to understand what the program has to do.

› If you wrote Pseudocode for your first exercise, then anyone should be able to take that pseudocode and get from the star to the winner location.

Page 9: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

9

Page 10: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

10

EV3 Brick and On-Screen Navigation

•1 – Back Button•2 – Center Button•3 – Left, Right, Up, Down Buttons

USB Connected

Battery Level

Wireless Status

Brick Name

Tabs on Screen•1 – Run Recent•2 – File Navigation•3 – Brick Apps•4 – Settings

• We’ll change your EV3’s

name to something unique

• Brick Apps to show sensor

values are important. Learn

this on the brick.

TURN ON THE BRICK BY PRESSING THE CENTER BUTTON

How do you turn off the brick? Hit

the Back button until you get a

query

Page 11: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

11

Side Views of EV3 Brick

Sensors

Ports are

ports 1-4

Motor Ports

are A-D

USB to Computer

Connection

Rechargeable

Battery Port

Page 12: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

12

LEGO Education EV3 Kit

http://robotsquare.com/2013/11/25/difference-between-ev3-home-edition-and-education-ev3/

Also comes with

rechargeable battery

and charger.

Page 13: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

13

Exercise: Navigating On Screen

› Use the left and right buttons to move back and forth in the main tabs:

1. Plate Recent Programs

2. Files

3. Port View

4. Settings 1 2 3 4

We’ll come back to these views later

Page 14: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

14

Start a New Project by

clicking File New

Page 15: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

15

Definitions

› Project

– Consists of several programs.

– They are all grouped into one file

– When you see a * next to the PROJECT name, it means you have changed at least one program from the last time you saved it.

– A PROJECT will have a .ev3 extension on the file name. The only way you can change the name of the PROJECT is by using Save Project As under the File menu

› Program

– PROGRAMS are individual sequences of events and commands. You will have manyprograms within a PROJECT.

– Each has its own tab under the project.

– You can rename a PROGRAM by double clicking on the program’s tab and typing in the new name.

– The X next to the program closes the program tab, but does not delete the program.

Page 16: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

16

Content Editor

Programming Canvas

Hardware PageProgramming Palettes

Programmer Toolbar

Page 17: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

17

Programming Palettes

Page 18: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

18

Programming PalettesData Blocks

Page 19: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

19

Basic Concept of EV3 Programming Like a Flowchart

StartMove motors

forwardFlash Light

WiresSTART

BLOCKS

Block Output Block Input Clean up wires:

• Click on the BLOCK OUTPUT and the

blocks will snap together with the wires

disappearing.

• When there are no wires, Click on the

BLOCK OUTPUT produces a short wire.

Page 20: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

20

My First Program

› Open a New Project, Call it EV3 Training

› Rename the Program to Example 1

› Click on one of the Action Palette (Green)

› Drag a SOUND BLOCK block on to the Programming Palette (it may be lighter)

› Connect the output of the STARTblock to the input of the Sound block.

› You could also drag the SOUND block directly to the output of the START block.

We need to “DOWNLOAD” The program to the EV3 memory

Page 21: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

21

Connect to a Brick on the Hardware Page

Brick Info When connected to a Brick, you can change

the name of the Brick here.

Bricks

Shows all available Bricks. The one

connected will have the box selected. Try to

connect to your brick through Bluetooth. If

not connect through the wire.

Downloads all programs in the Project

Downloads all programs in the

project and run the selected

program when done downloading.

Downloads the selected part of the

program and then run it.

Page 22: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

22

Motors

EV3 Large Motor EV3 Medium Motor

Item EV3 Large Motor EV3 Medium Motor

Feedback by angle of 1 degree by 1 angle of degree

Number of rotations 160 to 170 RPM 240 to 250 RPM

Weight 76 g 36 g

Auto-IDapplicable for EV3

Software

applicable for EV3

Software

Motor Speed can be positive or

negative.

• Positive: Clockwise rotation of

the motor.

• Negative: Counterclockwise

Be careful of Inverted Motors:

• Sometimes it’s easier to build with motors

up side down

• The direction of the motor will be reversed

relative to the motors

9/17/2016 FLL EV3 Training 22

Page 23: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

23

Robot Design

› Typical robot has 2 drive wheels/motors

– Left Wheel (Motor B)

– Right Wheel (Motor C)

› Should have a caster, sliders, or additions points of contact to balance robot

› How do you make the robot go straight?

– Move both motors at the same time in the same direction.

– EV3 has 2 movement commands to do this:

› Move Tank

› Move Steering

Tips and Advice: Robot Configuration

• Document which motor ports the left and right motors are plugged into

• Does positive power move the robot forward or backwards?

• Document the size of the wheels.

B C

Forward

Left Right

Robot Design is another Session.

Page 24: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

24

Let’s Try Making the Robot Move Forward

› Make a new Program called Example 2

› Click on one of the Action Palette (Green)

› Drag a MOVE STEERING block on to the Programming Palette (it may be lighter)

› Connect the output of the STARTblock to the input of the Move Steering block.

› You could also drag the MOVE STEERING block directly to the output of the START block.

› Add a stop block (from the blue palette)

Page 25: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

25

Parts of a Block PORTS for

this blockBlock ICON

Parameter ICONS

Parameters

Block OUPTUT

Block Modes

Number and types of

parameters can change

depending on sub-function

Block INPUT

Input Parameters

Page 26: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

26

Page 27: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

27

Rookie Teams: Stick with move steering

Page 28: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

28

Motor Rotation Sensor

› Built-in Rotation Sensor tells you how much the motor has rotated

› Motor Rotation: 1 motor rotation is the amount the motor turns all the way around and returns to the same position.

› Motor Degrees: 1 motor rotation is equal to 360 motor degrees. Kids may be confused when talking about robot turns.

Use of Motor Rotation vs. Motor Degrees

• Later when you discuss turning a robot some number of degrees, it gets confusing with turning

a motor that number of degrees.

• Motor degrees may be easier because it is a whole number and port view for rotations is not

accurate because it rounds off to 2 decimal places.

• Use motor rotations, with 3 or 4 decimal places. The resolution on the sensor is 1 degree =

0.002778 motor rotations.

Use orange piece to

track movement

Page 29: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

29

Exercise 1: Move Straight

1. Have the Robot move straight 360 motor degrees with power of 50 with the brake on.

2. How far did the robot move? Try it at least 3 times?

– Distance 1: _________ cm Distance 4: _________ cm

– Distance 2: _________ cm Distance 5: _________ cm

– Distance 3: _________ cm Distance 6: _________ cm

3. What happens when the power is changed to 25 or 100?

– Distance Power 25: _________ cm

– Distance Power 50: _________ cm

– Distance Power 75: _________ cm

– Distance Power 100: _________ cm

4. Did the robot go the same distance?

5. What caused the variability?

6. What did you notice about the movements? Were they straight?

Page 30: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

30

Move Steering With Different powers, With Brake

What are the differences between the

different powers?

• Notice the difference in wobble at the

beginning.

• Overcome friction and stationary forces.

• What could affect the starting wobble?

When using Brake, the EV3 robot tries to

correct for the overshoot.

StartEnd

25

50

75

100

-40

-20

0

20

40

60

80

100

0 1 2 3 4 5

Motor B Current Power

25 50 75 100

Page 31: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

31

End of Program

› When a program ends, the brick stops.

› If you have only the move command in the program, once the program is completed, the internal correction for the overshoot doesn’t occur.

› To see this overshoot, we need to have the program continue to run for a few seconds.

› Use the Wait command after the Move Steering command with a wait for 1 second to allow the robot to continue running.

› Try this with the faster power and you should see the robot recover from the overshoot.

9/17/2016 FLL EV3 Training 31

Page 32: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

32

Any Simple Missions This Year?

Page 33: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

33

Port View on Computer

› Go to the Hardware page

› With the Robot connected through a USB or Bluetooth.

› Turn the motor and see the numbers on the port change.

› Reset the motors by clicking on B and C (the port identifier).

› Move the robot 10 cm.

› What are the values for the motor sensors?

– Why are they not the same?

Page 34: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

34

Port View for EV3 Brick

• Bottom row contains the values from Sensor Ports 1-4

• EV3 Sensors have Auto-ID. Once you plug them in there should be

a symbol and value.

• Several sensors such as light sensor, gyro sensor, have multiple

modes.

• Top row shows the values of the rotation sensor of the motors

plugged into A-D

Exercise: Plug in touch

sensor into port 2 and

see if you get a 0 when

not pressed and 1 when

pressed.

Page 35: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

35

Exercise 2: Move a Certain Distance

› Our mission requires us to move 30 cm.

› How can you figure out how many motor degrees or rotations is 30 cm?

1. Trial and error – change things randomly

2. Exercise: Use port view to move 30 cm.

– Use the Port View when Connected via Bluetooth

– Use the Port View on the EV3 Brick

3. Calculate through experiments

4. Use Math and Geometry

Page 36: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

36

Calculation

› Use the numbers from Exercise 1:

– Divide the number of centimeters by 360 to determine how far the robot moves in 1 degree. (cm per degree) __________

– Divide the distance you want to go by the cm per degree to get the number of centimeters.

› Try it:

Move 30 cm. What is the number of degrees? ______ How far did it move? _____

Move 60 cm. What is the number of degrees? ______ How far did it move? _____

Move 90 cm. What is the number of degrees? ______ How far did it move? _____

Page 37: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

37

Motor Rotations and Degrees

Select On for Rotations

Wheel

Try to run using steering with 1 rotation at speed 25, 50, and 75.

Did the robot move the same distance?

How far did the robot move?

The distance should be the circumference of the wheel.

1 Rotation

1 Rotation = 360 degrees

of motor rotation

Page 38: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

38

Movement through Geometry

› Take a piece of paper and wrap it around a wheel. This is the circumference of the wheel

– What is the length of the paper

– The length is the circumference

› Put the wheel and paper on the table and roll the wheel, while letting the paper stay on the table. The distance traveled in 1 rotation of the wheel should be equal to the circumference of the wheel

Circumference = p * diameter of wheel

Page 39: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

39

Worksheet for Calculating Distances

Distance to travelled = Rotations X Wheel Circumference

Motor Rotations = Distance you want to travel

Wheel Circumference

Motor Degrees = Distance you want to travel

Wheel CircumferenceX 360

1 centimeter = 10 millimeters

1 inch = 2.54 centimeters

1 centimeter = 0.3937 inches

Don’t forget about the correct units.

Page 40: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

40

Calculation Exercise

› Assume your robot has a wheel diameter of 56 mm (5.6 cm). How many motor rotations do you need the motor to turn to move 25.4 cm or 10 inches?

› How many motor degrees to move 10 inches?

Page 41: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

41

Exercise Answers

› Assume your robot has a wheel diameter of 49.5 mm (4.95 cm). How many motor rotations do you need the motor to turn to move 25.4 cm or 10 inches?

Motor rotations = 25.4 / (5.6 *3.1415) = 1.444 rotations

› How many motor degrees to move 10 inches?

Motor degrees = Motor rotations * 360 = 1.633 * 360 = 520 degrees

› Write a program to make your robot move forward 25.4 cm.

› How can you test accuracy? Pencil, Place the robot a certain distance away from a wall and see where it starts. Mark, starting and ending locations.

Page 42: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

42

Moving Forward with Brake or Coast

Page 43: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

43

Exercise 4: Changing power with Brake

› Try Move Steering at powers 10, 25, 50, 75, and 100.

– Make sure there is a wait after the Motor Steering Command.

– Measure the distance that it goes:

– First run the exercise without the brake

– Next run the move steering with brake

› How accurate was the final position?

– In the X-direction – the direction of the robot

– Was the final position from left to right (y-axis) any different?

› Look at the final rotation sensors using Port View.

– Use degrees to be more accurate in the position

You can simply type in the

value you want for the

power instead of moving

the slider

Page 44: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

44

Move Steering with Different powers

Brake Coast

› Robot over-shoots when using the Move Steering and Move Tank and there is a coast.

› Rotation sensors tell the block the robot has moved too far, so it needs to go backwards.

› Did the Brake get it to the right Position?

Start End Start End

Page 45: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

45

Movement: Starts and Stop with Brake

› The Move Tank and Move Steering apply power almost instantaneously.

› Similarly the brake happens immediately.

› This can lead to the following behaviors:

– Sudden jerk motions when the robot starts

– Robot popping off the table when starting “Wheelie”

– Abrupt stopping and then backing up.

Page 46: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

46

Pictures of Robots with Different Centers of Mass

Page 47: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

47

Exercise: Putting Several Move Blocks Together

› Make a program for the flowchart on the right.

› 25 cm robot movement = 25/(5.6*3.14)*360 = 512 motor degrees

› Did it return to the same position?

› What did the behavior of the movement?

Start

Move

Forward

25 cm

Move

Backwards

25 cm

Stop Motor

You can simply type in the value

you want for the speed instead of

moving the slider

Page 48: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

48

Exercise 5: Going a Forwards and Backwards

› Write a program to make your robot to go forward for 30 cm, and then go backwards 30 cm.

– First try this with a brake as true for both the forward motion and backwards motion.

– Next try this with coast (no break) on the forward motion and a brake on the backwards motion.

– Finally try this with coast on both moves.

– What happens at speeds 25, 50, and 75

› Did it start back at the same location?

› Now add a sound block and repeat the exercise. What happens when the sound is happening?

Page 49: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

49

Results of Going Forward and Backwards

25

50

75

100

Speed

Backwards

Forwards

• Above power 25, the robot

overshoots the starting

position.

• Ends at a point that is 0.5 to

1.25 cm away.

• On the return, you see a

wobble in the return trip.

This is due to a wheelie.

• Since there was not a wait

after the first move, the

second move starts before

the motor corrects for the

overshoot.

Page 50: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

50

Wait Block

› This Block is in the Orange Palette (Flow Control)

› The Wait block does not allow the program to move to the next step in the flow until the condition is met.

› The Wait can be Based on Time and Sensor input.

› Try moving forward and then backwards with a 1 second delay between the movements.

Have we

reached

a time?

Yes

No

Page 51: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

51

Recovering from Inaccuracies.

› What happens in the following flow chart and you bump into a wall before the 100 rotations are up?

› The robot never completes the first block because once the robot hits the wall, the motors top moving and the rotation sensor stays at its value.

› This is a common error in programming movements. Advanced teams may use some code to time out their commands.

Page 52: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

52

Move Tank, Move Steering, and Move Blocks with On or Off

› When selecting On or Off, there are fewer parameters available

› On will turn on the motor until:

– A new motor command changes it

– The program ends

› Off will turn off the motor.

– If the brake is selected, it will hold the motor at that position with some current to the motor.

– If coast is selected, the motor will not get current and can move on its own

Page 53: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

53

Exercise 6: Recovering from Inaccuracies.

› Turn the robot on for some time (on for seconds). Try 2 seconds.

› Let it coast so the motors come to rest.

› You may need to wait for some time before the next move (we’ll cover that soon).

› Before the next move put a motor off block with a break (we’ll cover later).

› Back off the wall 15 cm.

› Try this program with different angles into the wall.

› Try it with different speeds into the wall

Page 54: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

54

Movement for Attachments

› Attachments are typically connected to a medium motor, but can be connected to a large motor as well.

› Typically these motors are plugged into Port A and D.

› Instead of Move Steering, each motor can be controlled individually using Medium Motor or Large Motor blocks.

› Unless you are an advanced user, stick with Move Steering for movement of the drive motors.

Medium Motor Move Large Motor Move

Page 55: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

55

Exercise 7: Move Your Attachment

› Move your arm from the down position to the Up position

› Use the Port view to determine how far to move.

› Make a program to move up, wait 1 second and then move down to the same starting position.

› Use the Move Medium Motor.

› Try different power 10, 25, 50, 75, and 100

Medium Motor Move

Page 56: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

56

Exercise 8: Motor Stuck

› Make the following program: Move forward 1 rotation, move the medium motor 10 rotations and move the robot forward 1 rotation.

› Try stopping the medium motor from moving.

› Does the program ever get to the second move?

› This is a common error when all you do is bind moves or when moving attachments.

› How could you change this behavior?Include a way to “time out” of the

behavior?

Use other sensors to determine

when you get to a certain place

or rotation.

Page 57: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

57

Multiple Movements

› EV3 Has an internal counter that keeps track of the rotation sensor and each move compensates for the movement.

› The Tank and Steering Move Blocks try to match the actual rotation sensor to the expected rotation sensor

Move 7.7 cm Move 7.7 cm Move 7.7 cm

Total movement is 23.1

cm; There is a correction

after each move.

Move 8.2 cm Move 8.2 cm Move 6.7 cm

Total movement is 23.1

cm; There are no breaks

between the movements

Page 58: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

58

Programmer Toolbar

Save Project ZOOMSelect

Program List

Pan

• Documenting code is important for good

programming practice.

• Judges will be looking for comments in code to

see if it can be clearly understood.

• Flowcharts help them understand intent.

Comment

Comment Boxes

Page 59: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

59

What Affects Going Straight

Give the Team Time to Brainstorm or as Between Meeting Work

› Alignment of the robot at the starting position

› Move Steering vs. Move Tank

› Speed

› Motors are slightly different power http://www.techbrick.com/Lego/TechBrick/TechTips/NXTCalibration/index.htm

› Wheels have different sizes› TheFLLCoach (Vienna Robotics)

› http://www.youtube.com/watch?NR=1&v=OlAO9Ho-N58

› Surface of the Table

› Balance or Center of Mass of the Robot

› Wheels Slippage

› Touching the robot

Page 60: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

60

Alignment and Small Errors in Angles Can Lead to Large Errors in Position

› Over small movements there may be larger changes in the angle.

› At small movements there is small errors in the x-error (perpendicular to movement)

› At large movements the small angular error at the start can lead to large X-Errors.

– Use a laser pointer and show that small changes in angle produce large changes over distance.

• Each line is off by 1 degree

• The length of the line is scaled to 1 inch = 8

feet

• The vertical line represents 1 foot.

• Being off by 7 degrees will be about 1 foot error if

traveling 8 feet.

• Error is only about 1.5 inches if you travel 1 foot

Page 61: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

61

Alignment Tools for Setting up the Robot in Base

› Being off by 3 degrees in the beginning can set the path of the robot off right from the beginning.

› Create a tool or some method for alignment of the robot.

› Use the walls for alignment of the robot.

Page 62: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

62

Alignment at Launch

› Demonstrate that with only one point of alignment causes in accuracies.

› Build an alignment fixture for starting from base.

– Team cannot touch fixture when the robot starts

– Fixture must be made out of LEGO

› Use at least one straight edge, preferably 2.

› Best Choice: 3 points or more with which to align the robot

› When the robot is starting in base, use the tick marks on the base outline.

1

2 3

Page 63: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

63

Mechanical Solution to Going Straight

› Mechanical solutions are ones that many people tend to forget about.

› Guide wheels to keep the distance between the robot and the wheel equal.

› Angle the robot slightly towards the wall and it will follow the wall.

› Steer slightly towards the wall.

› Navigating away from the wall may be challenging.

Page 64: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

64

Spins, Turns, and Pivots

SPIN

One wheel forward,

one wheel backwards

TURN, PIVOT

One wheel break, one

wheel backwards

Steering = 100 or -100

Steering = 50 or -50

Page 65: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

65

Spinning Area for Movement

B C

Wall

Area for spinning is

small.

If you align to a wall,

think about how to

turn away from the

wall.

Page 66: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

66

B C

Turning Area for Movement

Wall

Spinning away from

wall is harder than

turning away.

9/17/2016

Page 67: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

67

PIVOT Vs. SPIN Turns

180 Degree Pivot Turn

180 Degree Spin Turn

Notice where the robot

ends in both pictures

after a 180 degree turn.

In the Spin Turn, the

robot moves a lot less

and that makes Spin

Turns are great for tight

positions. Spin turns tend

to be a bit faster but also

a little less accurate.

So when you need to

make turns, you should

decide which turn is best

for you!

Copyright © EV3Lessons.com 2014

(Last edit: 2/26/2015)

B

C

Start Position End Position

Motors

B and C

Move

B

CMotor

B Moves

Start Position

End PositionB

C

B

C

67

Page 68: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

68

How to Make Pivot and Spin turns

Steering Value

50 -50 100 -100

Pivot Turn Right Pivot Turn Left Spin Turn Right Spin Turn Left

Change Steering value here

Copyright © EV3Lessons.com 2014

(Last edit: 2/26/2015)

B

C

B

C

B

C

B

C

68

Move Steering

Block

Which is better?

Pivots are more accurate.

Spins take smaller space.

Page 69: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

69

MAKING A Pivot turn for 90 DEGREES

Program your robot to turn 90 degrees....Does the

robot actually turn 90 degrees if you just pick 90

degrees for distance?

Copyright © EV3Lessons.com 2014

(Last edit: 2/26/2015)

B

C

BC

?

69

Ans. NO! Solution on next

page

Page 70: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

70

Motor Degrees and Robot Degrees

› You want to make the Robot Spin 360 degrees (turn around).

› What happens if you put 360 degrees in the Move Tank or Move Steering Block?

› Did the robot spin 360 degrees? Probably not.

Motor Degrees ≠ Robot Turn/Spin Degrees

Page 71: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

71

› Turns are measured in degrees

› Motor rotations are also measured in degrees.

› Make sure to keep them straight.

Measuring Turns

90270

180

0/360

135

45

225

315

30

15

60

105

75

120

150

165210

195

240

300

330345

255

285

Page 72: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

72

Turning: One Wheel Spins

› One wheel goes forward,

› The other wheel is OFF but on brake

› What is the Pivot Point?

– The wheel that is OFF

B C

Page 73: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

73

Exercise 9: Use Port View to Measure Turns

› Hold one wheel firm and don’t let it move.

› Move he other wheel to allow the robot to pivot or turn around the firm wheel.

› How many motor degrees do you need to cause the robot to pivot or turn 90 degrees?

› Write down how many motor degrees is needed to turn 1 robot degree. For this example, divide the motor degree by 90 ________

› Calculate how many motor degrees is needed to turn 180 degrees _____

› Try pivoting 180 degrees. Was it accurate?

Page 74: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

74

Exercise 10: Trial and Error

› Try changing the motor degrees until the robot turns 180 degrees.

› Write down how many motor degrees is needed to turn 1 robot degree. For this example, divide the motor degree by 180 ________

› Calculate how many motor degrees is needed to turn 90 degrees _____

› Try pivoting 90 degrees. Was it accurate?

Page 75: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

75

Spinning: Two Wheel Spins

› One wheel goes forward, the other wheel goes backwards.

› What is the Pivot Point?

– Center of the axis between the drive motors.

› Move Steering: Set steering to 100 or -100.

› Since both motors are moving in opposite direction, the spins can be very fast.

Steering

B C

Page 76: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

76

Exercise 11: Spinning the Robot

› Make the robot spin 180 degrees (NOT TURN)

› Use whatever method you want.

› How many motor degrees does it take to move 1 motor spin degree?

› Try changing the power to 10, 25, 50, 75, and 100.

› Keep the power constant at 20. Change the robot spin to 45, 90, and 360 degrees.

Page 77: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

77

Exercise 12: Going in a Square

› Try to make your robot go in a Square.

› What is the English code (pseudocode) for this?

1. Move forward 20 centimeters

2. Turn right 90 degrees

3. Move forward 20 centimeters

4. Turn right 90 degrees

5. Move forward 20 centimeters

6. Turn right 90 degrees

7. Move forward 20 centimeters

8. Turn right 90 degrees

› Try at power 25, 50, 75, and 100. Do you end up at the same place?

Page 78: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

78

Consequences of Friction

› Each wheel has different amounts of friction (try them out)

– If the wheel slips, will the robot move to the right position?

– What happens if one wheel slips, but the other doesn’t?

– Do you want fat wheels or skinny wheels?

– The width of the wheel relates to distributing the weight over a larger area.

› Each table has slightly different friction

– Competition mats may be new

– Team mats are altered because of use, damage, tape…

› Think about turning the robot. Do you want more friction or less friction?

Page 79: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

79

Casters, Sliders, Ball Casters, Wheels

› Friction plays a major role in how accurately the robot moves

http://en-lego-vinir.weebly.com/our-robot.html

www.nxtprograms.com

Page 80: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

80

Alternative Sliders

Page 81: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

81

Summary for Straight Moves and Turns

› Each robot is different

– Wheels, weight, diameter

– Matching motors and wheels may be difficult (lack resources)

– Need to test the characteristics of your robot in the final configuration.

› Small errors can lead to big problems in position accuracy.

› Speed vs. Accuracy?

Page 82: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

82

Move Steering Control Movement

From David McQuiggan http://mycommunity.theiet.org/blogs/698/1706#.Vdj__flVhBc

Page 83: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

83

Other Turns

› The steering parameter in the Move Steering block allows you to move forward and at an angle.

› Steering of ±50 is a pivot/turn; Steering of ±100 is a spin.

› The details are given on the next slide, but this is how our robot performs with one motor rotation and speed 25.

0-5

-10

-15

-20

-25

Page 84: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

84

Typical Robot Match

› Align Robot in Base

› Wait for the MC to Say Go

› Push a button or activate a sensor to make the robot do the mission by running the program (called a Launch).

› Robot does the mission(s) and comes back to base

› Team adjusts robot with new attachments and align

› Push a button to make the robot do the mission or program

› Robot does the Mission

› Repeat until 2:30 are over

Start

Is the

Button

Pushed?

Move forward

30 cm

Turn 90

degrees

Yes

NoThe robot is

waiting for a button

to be pushed

Page 85: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

85

Wait Block

› This Block is in the Orange Palette (Flow Control)

› The Wait block does not allow the program to move to the next step in the flow until the condition is met.

› The Wait can be Based on Time and Sensor input.

› Each Sensor or Sub-function has different conditions that can be turned into a question.

Is the

Button

Pushed?

Yes

No

Page 86: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

86

Wait for EV3 Button

Select Compare and

Brick Button to get to

the appropriate

parameters

First parameter is

which button(s) are

you checking for.

Second Parameter

is what condition are

you looking for?

0 – Button is Released

1 – Button is Pressed

2 – Button is Bumped

3rd parameter is an

output of which button

triggered the condition

Page 87: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

87

Wait Brick Button

› Why would we not use Pressed with the Brick Button?

– If the next step is to move, then your hand is touching the Brick.

– This could cause the finger to change direction of the robot as it moves

› For Brick Button, Bumped or Released are the best state.

– Bumped and release are probably not good when using sensors)

› This wait can be great for starting a part of a program, or for debugging a program.

› Make a program that waits for the middle brick button to be pressed, moves forward 30 cm, waits for the left button, Turns left 90 degrees.

Pressed True if the button is pressed, False if not.

Released False if the button is pressed, True if not.

Bumped True if the button has been pressed and released in the past. The next

Bumped occurrence will then require a new press and release.

Page 88: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

88

Using the Bumped Parameter

When the finger presses

the button, the robot starts

to move. Your finger could

push on the robot and

change direction of the

robot.

When the finger is released

from the EV3, the robot

starts to move. No contact

with the robot.

You could add some time

after the button is pressed to

make sure there is no contact

with the robot.

Page 89: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

89

Exercise: Starting the Robot

› To start the robot, push the center EV3 button.

› Have the robot complete a simple task like:

– Move the shark forward

– Make a noise

– Come back to base.

Page 90: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

90

When Debugging Software, Here Are Some Tips

› Annotate your software so you know where to make any changes

› If you think you have several changes

– Change only one thing at a time

– Start with the changes closest to the beginning of the program

› You can put sound blocks in to have the robot give you audible signals when the robot does something

– Drawback: the soundblocks will take up extra memory in the NXT

› You can put “breaks” in the code by inserting a motor stop block followed by a wait for block (one possible example provided below)

Page 91: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

91

What Techniques Can you See in These Videos?› LEGO Vinir: Complex robot, but base

– 2014 www.youtube.com/watch?v=aHnqUz9-SbY

– 2013 www.youtube.com/watch?v=8_Hx5wHOuUY

– 2011 https://www.youtube.com/watch?v=jjWiTbRBvew

› Mechatronic Ants – First Place at World Class 2014-2015 World Championships and Robot Design Winners

– https://www.youtube.com/watch?v=QzcczsFI2uI

– https://www.youtube.com/watch?v=KTDd7vtHmpw

› Cassapeia – Second place at World Class 2014-2015 World Championships

– https://www.youtube.com/watch?v=cq5ExSPUGlU

– www.youtube.com/watch?v=_gpZWLG-Hnw

› Brick Warriors: Robot does not need to be complex (3rd Place)

– 2015 https://www.youtube.com/watch?v=UDhVrSkqhBQ

› World Class – World Festival Playoffs

– https://www.youtube.com/watch?v=AgQWes9R_F0

Page 92: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

92

Additional World Class Videos

› Nylan Cats, Isreal

– www.youtube.com/watch?v=ItO2z1mvCMs

› RoboPro, Isreal

– https://www.youtube.com/watch?v=GL1j3-ycnCQ

› 5th Gear, Colorado

– https://www.youtube.com/watch?v=PYlmYQqZ2Zo

› Robo Wizards, Colorado

– https://www.youtube.com/watch?v=VA0aDiUhCzA

› SAP Tigers

– https://www.youtube.com/watch?v=-TcSgxcHDUk

› RoboMasters, Greece

– https://www.youtube.com/watch?v=OU5XwQFdIdI

Page 93: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

93

Start Up at Competition

› Create a Checklist:

– Look for loose wires

– Look for loose LEGO

– Do you have your attachments

› Place the alignment tools if needed

› Calibrate the Light Sensors

› If using Gyro, make sure that you reset correctly

› Do you have many programs, or one big program or a sequencer?

Page 94: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

94

Summary of Localization and Sensors

› Localization rather than using dead reckoning or blind movements

› Sensors: Challenges and Utility in movements

› Planning complex challenges

› Improving repeatability and robustness

Page 95: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

95

Tips for Judging and Preparation for Competition› Create a 1-2 page summary of the robot design

– Have everyone know the key parts of the robot design

– Everyone should be able to describe the strategy and key features

› At the end of each meeting have everyone describe a key part of the robot and what they feel most comfortable presenting.

› They must be able to explain how the programs work to the judges

– Print out copies of the programs early

– Have examples of My Blocks, Loops, Cool programs

– They must be able to explain it, or they shouldn’t use it.

› Our teams practice robot presentation just like project presentation

› Document strategy and their missions

– http://ev3lessons.com/resources/drawplan/

› Demonstrate at least 1 mission – should be robust

› Talk about what makes the robot special, what they like about it, what inspired them.

Page 96: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

96

Page 97: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

97

Practicing Robot Rounds

› It’s never too early to have them practice dry runs at a competition

– We start as soon as we have a Chassis to work with.

– Set goals throughout the season. (make sure they are reasonable)

› Track how many points and what missions are completed ate the end of each meeting.

› Have everyone practice running the robot

– Pair them into members that work well together

– Have them focus on a limited set of missions/launches to stay focused.

– Let them work on this slowly at first.

› Practice with different lighting conditions (bring in a flood lamp)

› Set up the table with flaws and see if they catch the issues. They need to be able to identify incorrectly set up tables. You may want to score the round incorrectly.

› Make them score the rounds and double check them. Pick someone who will know how to score and be the person on the team that will check the judging. http://ev3lessons.com/resources/scorer/score.html

Page 98: EV3 Brick and Beginning Programming - FIRST in … · EV3 Brick and Beginning Programming Wizards.exe FTC Team 9794 1. ... Mindstorm Masterminds to 2015 World ... – A PROJECT will

Wizards.exe

FTC 9794

98

Thank You

› Good Luck in your Season !!!