(intermediate) ev3 robotics using lego mindstorms

Post on 15-Oct-2021

45 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Robotics using Lego Mindstorms EV3

(Intermediate)

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

Robotics using EV3

– Sensors

Ultrasonic

Color

Touch

Gyro

Infrared

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!

Robotics using EV3

• Building the EV3 Castor Bot

10

11

Adding the Touch Sensor

12

Robotics using EV3

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

How far are we actually going?

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

How do the degrees translate?

Pivot Turn Swing Turn

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

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°

Touch Sensor

Wait Until Touch

Loop Control

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.

Touch Sensor Challenge…

Ultrasonic Sensor

23

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

Don’t Touch the Walls! Challenge

Adding the Color Sensor

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

26

Line Following

● Humans want to follow the line in the middle.

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

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!

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.

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

Line Following

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.

MyBlocks

33

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

MyBlocks

34

4. Name and choose an icon for your block.

Create Your Own MyBlock

Create a MyBlock for your

Line Following program from

the last challenge!

35

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.

Robotics using EV3

Thanks for coming!

Web resources:● Legomindstorms.com● EV3lessons.com

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

top related