47
1 Lawrence Technological University BottleSumo EV3 Workshop Instructor: Dr. Fred Brauchler Assistant: Nirmit & Devson 10/15/2016

RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

  • Upload
    others

  • View
    2

  • Download
    2

Embed Size (px)

Citation preview

Page 1: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

1Lawrence Technological University

BottleSumo EV3 Workshop

Instructor: Dr. Fred BrauchlerAssistant: Nirmit & Devson

10/15/2016

Page 2: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Thanks to our Sponsors!

10/15/2016 Lawrence Technological University 2

Page 3: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Download EV3

• A free EV3 download can be found here:https://education.lego.com/en-us/downloads/mindstorms-ev3/software

• EV3 PROGRAMMING SOFTWARE • (PC/MAC/CHROMEBOOK)

• Also note that EV3 software works with NXT robots and NXT sensors!

10/15/2016 Lawrence Technological University 3

Page 4: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Course Overview

• 2018-19 RoboFest BottleSumo Rule Highlights• EV3 Robot Configuration• EV3 Software introduction• Using the EV3 for BottleSumo• Sense the table edge• Finding the bottle/opponent• Push bottle/opponent off

• Physics and Strategy

10/15/2016 Lawrence Technological University 4

Page 5: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Rules Overview

• Objective: Intentionally push the bottle or opponent off ANDremain on the table for > 3 second after

• How to start the robot – unveiled 30 min before impound• Starting location, orientation, and exact location of bottle zone

unveiled after impounding• Please remember to read the rules!

10/15/2016 Lawrence Technological University 5

Page 6: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Robot Configuration

10/15/2016 Lawrence Technological University

Left Motor B Left Light Sensor 4

EV3Brick

Right Light Sensor 1Right Motor C

UltrasonicSensor 3

6

Page 7: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Motor and Sensor Connections

• Left Motor connects to port B• Right Motor connects to port C

• Left Light sensor connects to port 4• Right Light sensor connects to port 1• Ultrasonic sensor connects to port 3

10/15/2016 Lawrence Technological University 7

Page 8: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

What does your robot need to do to win?

• Not fall off the table• Find objects: bottle or opponent• Push objects off of table

10/15/2016 Lawrence Technological University 8

Page 9: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

EV3 Software• Click the LEGO MINDSTORMS icon on• Click File > New Project > Program > Open

10/15/2016 Lawrence Technological University

For Home Edition optional• Select the “+”

9

Page 10: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Creating a Program

10/15/2016 Lawrence Technological University

Click on the green tab, drag a“Move Steering” block to the middle of the screen

10

Page 11: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Move “Forever”

10/15/2016 Lawrence Technological University

Set the motors to “On”

Make sure you’re using the right motors!

11

Page 12: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Save Your Program

10/15/2016 Lawrence Technological University

1. Click “File” then “Save As”2. Choose a memorable name3. Click Save

12

Page 13: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Downloading a Program

10/15/2016 Lawrence Technological University

• Verify the robot is turned on• Connect the USB cable

• Click refresh• Click the box under

USB• Click the blue arrow to

download

13

Page 14: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Running a Program

10/15/2016 Lawrence Technological University

• Press the middle button to run your program

• Press the top left button to stop your program

• Use the surrounding buttons to switch menus and view programs

14

Page 15: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Motors “On”

10/15/2016 Lawrence Technological University

• What happened when run? – the program finished and turned motors off before they moved.

• Did the motor turn on?– electrically yes, but maybe not long enough to see them move

15

Page 16: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Loops

10/15/2016 Lawrence Technological University

Put the Move Stearingblock in an infinite loop.

16

Page 17: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Spin

10/15/2016 Lawrence Technological University

• We can make the robot spin by changing the “Steering”

• �100 for a point turn (one motor forward, other backwards)

17

Page 18: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Moving Backwards

10/15/2016 Lawrence Technological University

• We can still use the Move block.

• Change the speed to a negative number

18

Page 19: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Light (Color) Sensor Readings

10/15/2016 Lawrence Technological University

Put one Light Sensor on the table and the other Light Sensor off the edge of the table

19

On Table Off Table

Page 20: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Color Sensors

10/15/2016 Lawrence Technological University

Click on the yellow tab and drag a color Color Sensor block up

20

Page 21: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding the Edge

10/15/2016 Lawrence Technological University

• Change the loop to Logic• Now it will

“loop until true”

21

Page 22: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding the Edge

10/15/2016 Lawrence Technological University

• Change the light sensor to Compare > Reflected Light Intensity

• Light sensor threshold: Average of the “on the table” and “off the table” values.Put your value here.

22

Page 23: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding the Edge

10/15/2016 Lawrence Technological University

• Use your mouse to draw a green “logic” data wire

• A yellow data wire is for a “number”

Start Here and Click the Mouse

Drag to Here and Release

23

Page 24: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Stopping at the Edge

10/15/2016 Lawrence Technological University

Make sure to turn off the motors once your robot finds the edge!

24

Page 25: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Edge Problems

10/15/2016 Lawrence Technological University

• If your robot stops too late or not at all:

• Check that the move block is “On” not “On for Seconds/degrees/rotations”

• Check color sensor is shining a red light

• Check color sensor values on/off the table, the threshold average, and the “less than” inequality

• Check light sensor port number (1 for left sensor)

• We only are looking at one light sensor – what if the other one goes off the table first?

25

Page 26: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding Edge with Both Sensors

10/15/2016 Lawrence Technological University 26

Left Light Sensor

Right Light Sensor

Page 27: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding Edge with Both Sensors

10/15/2016 Lawrence Technological University 27

Logic Operations Block - OR

Logic Operations Block - OR

Page 28: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding Edge with Both Sensors

10/15/2016 Lawrence Technological University 28

find-edge.ev3p

Connect to the right wire hub.à The wire should be green for logic.

Hands-on Try it

Page 29: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding and Avoiding Table Edges

10/15/2016 Lawrence Technological University

avoid-table-edge.ev3p

29

What should you do when you get to an edge.à Back up and turn.

Hands-on Try it

Page 30: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Alternate Program

10/15/2016 Lawrence Technological University

This program uses a switch block instead of a loop to avoid tying up the program.

30

move-avoid-edge.ev3p

Page 31: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Ultrasonic Sensor

• Measures the distance to the closest object

• Uses sonar waves like a bat• Can be used to see if an

object is within a certain range of the robot

10/15/2016 Lawrence Technological University 31

Page 32: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding the Bottle/Opponent

• Point Turn (Spin) robot• Stop when object found

3210/15/2016 Lawrence Technological University

Page 33: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding the Bottle/Opponent

10/15/2016 Lawrence Technological University

These two programs do the same thing:• Point turn• Wait until sensing an object < 50cm• Then stops motors

Lower program allows more options – example:What if nothing within 50cm? – see next page

33

scan_loop.ev3p

Scan_wait.ev3p

Page 34: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Finding the Bottle/Opponent

10/15/2016 Lawrence Technological University

The added condition will limit how long (time) or how far (rotations) to turn and search

34

turn-scan-encoder.ev3p

Reset Encoder

Reset Timer

turn-scan-time.ev3p

Page 35: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Simple Sumo Program

10/15/2016 Lawrence Technological University 35

basic-sumo.ev3p

Putting it together:

Hands-on Try it

Page 36: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Push it all the way off the edge

• Set variable “rside” when right light sensor is off edge• Value of “rside” determines which way to move• Push bottle/opponent all the way off table• See program “better-sumo.ev3p”

10/15/2016 Lawrence Technological University 36

Page 37: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Unknown Factor examples

• Display “RoboFest” while waiting 10 seconds to move after starting program

• Wait for a black card to be removed from a sensor

10/15/2016 Lawrence Technological University 37

Page 38: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Physic of Sumo

Your robot will be more effective at pushing other robots off the table if you consider• Mass• Velocity• Force• Power

10/15/2016 Lawrence Technological University 40

Page 39: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Mass

• Quantity of matter [kilograms]• m=mass, n=velocity, p=(linear) momentum

p=m*n• F=force, a=acceleration

F=m*a•With a larger the mass, more Force is required for same acceleration•Where to add mass? Consider the center of gravity (should be low and inside wheel base)

10/15/2016 Lawrence Technological University 41

Page 40: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Velocity• Velocity = Speed and Direction [meter/second]• m=mass, n=velocity, p=(linear) momentum

p=m*n• If we increase the velocity, we increase the

momentum•The larger the momentum, the greater the impact force will be applied to the opponent•How do we increase the velocity of the robot? Higher motor speed setting, larger wheels, gear-up

10/15/2016 Lawrence Technological University 42

Page 41: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Force

• Pushing (Pulling) or Twisting • Linear Force [Newton] or Torque [N-m]• T=torque, r=wheel radius• Force=Torque/radius• How do we increase the Force applied by the

wheels?• Increase the torque (lower gear ratio)• Decrease the radius (smaller wheels)

10/15/2016 Lawrence Technological University 43

Page 42: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Power

• Power is Force *Distance / time [W=N*m/s]• P=Power, F =Force, T=Torque, n=velocity, w=angular velocity

P=F*nP=T*w

• How do we increase the Force and/or velocity?•Increase the power (Motor power)•Make sure batteries are fully charged!

10/15/2016 Lawrence Technological University 44

Page 43: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Build a better Robot (later)

• Sturdy construction• At least 2 attachment points for each part so robot

stays together• Compact design• Triple pegs on multiple beams

• Wheel base• Wide base for slow turns• Narrow base for fast turns• Which is best for stability of robot?

10/15/2016 Lawrence Technological University 45

Page 44: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Robot Design cont.

• Wheels• How many tires? 2 or more?• Tires- rubber or plastic? (for traction?)• Size – large or small?• Placement of wheels – front or back?

10/15/2016 Lawrence Technological University 46

Page 45: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Robot Design cont

• Sensors• Placement of light sensors (height above table?

How far in front or to side of wheels?)• Placement of sonar sensor (low or high?)• Use additional sensor(s)?• Touch sensor(s) to detect if an opponent is

pushing your robot?• Touch sensor(s) to detect if you are pushing an

opponent or the bottle?

10/15/2016 Lawrence Technological University 47

Page 46: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

Strategy (for the future)

• Try to lift an opponent off the table?• Try to hide from an opponent (cloaking)?• Bounce off an opponent if attacked?• Add a motor to power a mechanical device to attack

your opponent (try to flip your opponent over)?• Better search for opponent? Find again if opponent

moves before you get to him.

10/15/2016 Lawrence Technological University 48

Page 47: RoboFest BottleSumo EV3 Workshop 2016-Fall · •Please remember to read the rules! 10/15/2016 Lawrence Technological University 5. Robot Configuration 10/15/2016 Lawrence Technological

[email protected]

Questions?

Little Robots, Big Missions

4910/15/2016 Lawrence Technological University

Hands-on Try it