(intermediate) ev3 robotics using lego mindstorms

37
Robotics using Lego Mindstorms EV3 (Intermediate)

Upload: others

Post on 15-Oct-2021

45 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: (Intermediate) EV3 Robotics using Lego Mindstorms

Robotics using Lego Mindstorms EV3

(Intermediate)

Page 2: (Intermediate) EV3 Robotics using Lego Mindstorms

Robotics using EV3

Are we ready to go Roboticists…?

– Does each group have at least one laptop?– Do you have EV3-G software installed on

the laptop?– If you have a question at any time please

raise your hand and we will help you

Page 3: (Intermediate) EV3 Robotics using Lego Mindstorms

Robotics using EV3

– Sensors

Ultrasonic

Color

Touch

Gyro

Infrared

Page 4: (Intermediate) EV3 Robotics using Lego Mindstorms

Robotics using EV3

• Putting it all together…– Take an EV3 Brick

– Build a chassis with Lego Structural elements, motors and wheels

– Use EV3 software to program it to perform the desired action and download the program to the brick

– Select the program and run it!

Page 5: (Intermediate) EV3 Robotics using Lego Mindstorms

Robotics using EV3

• Building the EV3 Castor Bot

Page 6: (Intermediate) EV3 Robotics using Lego Mindstorms
Page 7: (Intermediate) EV3 Robotics using Lego Mindstorms
Page 8: (Intermediate) EV3 Robotics using Lego Mindstorms
Page 9: (Intermediate) EV3 Robotics using Lego Mindstorms
Page 10: (Intermediate) EV3 Robotics using Lego Mindstorms

10

Page 11: (Intermediate) EV3 Robotics using Lego Mindstorms

11

Page 12: (Intermediate) EV3 Robotics using Lego Mindstorms

Adding the Touch Sensor

12

Page 13: (Intermediate) EV3 Robotics using Lego Mindstorms

Robotics using EV3

• EV3 programming concepts– Advanced Movements– Touch Sensor– Loop Control– Ultrasonic Sensor– Color Sensor/Line Following– MyBlocks / Functions

Page 14: (Intermediate) EV3 Robotics using Lego Mindstorms

How far are we actually going?

• Circumference = 2πr• r≈2 cm∴ 1 rotation = 360° = 2 cm*2*π1 cm ≈ 28.7°

Page 15: (Intermediate) EV3 Robotics using Lego Mindstorms

How do the degrees translate?

Pivot Turn Swing Turn

Page 16: (Intermediate) EV3 Robotics using Lego Mindstorms

Degrees to Degrees°

• Let r be the turning radius• 90° = ¼*(2πr)

1 = 1/180*(πr)

• For pivot turns just note that the turning radius is half of the turning radius for swing turns

Page 17: (Intermediate) EV3 Robotics using Lego Mindstorms

Conversions

Swing Turn: 6.5° of the wheel ->1° turn of the robot

Pivot Turn: Approximately half of the swing turn

Movement: 1 cm = 28.7°

Page 18: (Intermediate) EV3 Robotics using Lego Mindstorms

Touch Sensor

Page 19: (Intermediate) EV3 Robotics using Lego Mindstorms

Wait Until Touch

Page 20: (Intermediate) EV3 Robotics using Lego Mindstorms

Loop Control

Page 21: (Intermediate) EV3 Robotics using Lego Mindstorms

Touch Sensor Challenge

• Program the robot to move forward continuously at 40% power. If the touch sensor is pressed the first time, the robot should turn 180 degrees and move in the opposite direction continuously. If the touch sensor is pressed again, the robot should once again turn and move forward continuously. This process of moving then turning should repeat 5 times; after 5 cycles, the robot should stop completely.

Page 22: (Intermediate) EV3 Robotics using Lego Mindstorms

Touch Sensor Challenge…

Page 23: (Intermediate) EV3 Robotics using Lego Mindstorms

Ultrasonic Sensor

23

Page 24: (Intermediate) EV3 Robotics using Lego Mindstorms

Don’t Touch the Walls! Challenge

• Program the robot to move forward continuously at 40% power. Every time it hits an obstacle as indicated by an ultrasonic sensor, the robot should move back one rotation, turn at about 120 degrees and continue. Robot should stop after 10 repetitions.

24

Page 25: (Intermediate) EV3 Robotics using Lego Mindstorms

Don’t Touch the Walls! Challenge

Page 26: (Intermediate) EV3 Robotics using Lego Mindstorms

Adding the Color Sensor

• Attach the color sensor accessory and plug it into port 3

26

Page 27: (Intermediate) EV3 Robotics using Lego Mindstorms

Line Following

● Humans want to follow the line in the middle.

● Let’s have the robot do the same thing using the Color Sensor

Page 28: (Intermediate) EV3 Robotics using Lego Mindstorms

1. If we are on black, keep going straight

2. If we are on white, turn left to get back to the line

Line Following

When the robot leaves the left side of the line, the program no longer works!

Page 29: (Intermediate) EV3 Robotics using Lego Mindstorms

Line Following

Why can’t the robot follow the line the same way humans do?● They can see ahead.● They can see the whole line and its

surroundings● They see both sides and which side they left● Can’t tell right or left side of the line

Instead of the middle, could the robot follow the “edge”?So now the robot will fall off only the same side.

Page 30: (Intermediate) EV3 Robotics using Lego Mindstorms

The robot has to choose which way to turn when the color sensor sees a

different color.

The answer depends on what side of the line you

are following!

Line Following

If on black, turn left.If on white turn right.

If on black, turn right.If on white turn left.

Left Edge

RightEdge

Page 31: (Intermediate) EV3 Robotics using Lego Mindstorms

Line Following

Page 32: (Intermediate) EV3 Robotics using Lego Mindstorms

MyBlocks

32

1. Create a program. It can be any sequence of blocks.

2. Highlight the blocks by holding the SHIFT key and clicking each block.

Page 33: (Intermediate) EV3 Robotics using Lego Mindstorms

MyBlocks

33

3. Select the “Tools” menu, and click on “My Block Builder”.

Page 34: (Intermediate) EV3 Robotics using Lego Mindstorms

MyBlocks

34

4. Name and choose an icon for your block.

Page 35: (Intermediate) EV3 Robotics using Lego Mindstorms

Create Your Own MyBlock

Create a MyBlock for your

Line Following program from

the last challenge!

35

Page 36: (Intermediate) EV3 Robotics using Lego Mindstorms

Open Challenges★ Use the brick buttons to make a remote control for your

robot: the left-arrow turns left, and the right-arrow turns right. The robot moves continuously forward, only pausing to turn when the buttons are pressed.○ Optional: If the up-arrow is pressed, move forward 3

rotations. If the down-arrow is pressed, move backward 3 rotations.

★ Use the touch sensor to give your robot emotions! If the touch sensor is pressed, have the EV3 brick screen display a “Big smile”. If the touch sensor is not pressed, have the screen display a “Sad” face.○ Optional: Display additional expressions when the brick

buttons are pressed.★ Use “The Force” to move your robot! If it is closer than 20cm

from your hand, move backward, otherwise move forward.

Page 37: (Intermediate) EV3 Robotics using Lego Mindstorms

Robotics using EV3

Thanks for coming!

Web resources:● Legomindstorms.com● EV3lessons.com

Visit our website to sign up for more classes this summer!