ramping up speed - primelessons.orgspike prime lessons by the creators of ev3lessons acceleration by...

12
PRIME LESSONS By the Makers of EV3Lessons PRIME LESSONS ACCELERATION BY SANJAY AND ARVIND SESHAN

Upload: others

Post on 22-Nov-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

PRIME LESSONSBy the Makers of EV3Lessons

PRIME LESSONS

ACCELERATIONBY SANJAY AND ARVIND SESHAN

Page 2: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

LESSON OBJECTIVES

¢ Learn what acceleration means

¢ Learn how and when to use accelerate

¢ Learn how to use the Timer Block

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 2

Page 3: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

WHY RAMP UP

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 3

• Acceleration is very helpful when running fast-paced programs

• The speed steadily increases over time in a linear fashion

• Usually, if the robot starts up with high speed, then there would be a small jerk in the beginning. The jerk may change the position of the robot.

• With the acceleration, it would start up slowly and increase speed over time (see video on the right)

0

20

40

60

80

100

120

0 1 2 3 4 5 6

spee

d (%

)

Time (seconds)

Acceleration of Speed

Page 4: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

NEW TOOL: TIMER BLOCK

¢ The timer block is used to count time

¢ It is found in the Blue sensor tab

¢ 1 timer is available You can use the reset timer block to reset a the timer back to 0 seconds

¢ You can use the block to read the time since reset…

¢ If you are a FIRST LEGO League Challenge team, you can use timers to track time or for the acceleration code in this lesson

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 4

Page 5: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

ACCELERATE IN 4 EASY STEPS

1. Reset timer

2. In a loop, read the number of seconds passed and multiply the speed by 20. The 20 is the rate at which it speeds up and is measured in speed/second

3. Still in the loop, take the result of the multiplication and apply it to the move block.

4. Repeat the Loop for 5 seconds (duration)

Note that the final speed will be final speed = duration*rate which should be less than or equal to 100

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 5

Page 6: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

ACCELERATION CODE

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 6

Reset timer

Set movement motors

Accelerate over the course of 5 seconds

Page 7: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

ACCELERATION CHALLENGE

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 7

Step 1: Can you now make an acceleration program that takes 2 inputs (total duration of acceleration and how much speed you want the motor to accelerate per second)? Create a My Block.

Step 2: Accelerate your robot, then move until a black line.

Page 8: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

MAKING THE MY BLOCK

A. Go to Make a My Block

B. Add 2 inputs: one for seconds (duration) and one for how quickly you want to accelerate (rate)

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 8

How quickly you

want to ramp up

Seconds to ramp

up

Page 9: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

DEFINING THE MY BLOCK

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 9

Drag the “duration” and “rate” operators into the correct locations

Page 10: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

CHALLENGE SOLUTION

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 10

This program accelerates for 2 seconds to 40% speed and moves until the color sensor (on port B) sees a black line.

Page 11: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

NEXT STEPS

¢ Think about what else you might be able to use a timer block for

¢ Create a deceleration program now that you know how to create an acceleration program.

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 11

Page 12: Ramping Up Speed - primelessons.orgSPIKE PRIME LESSONS By the Creators of EV3Lessons ACCELERATION BY SANJAY AND ARVIND SESHAN

CREDITS

¢ This lesson was created by Sanjay Seshan and Arvind Seshan for Prime Lessons

¢ More lessons are available at www.primelessons.org

Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 5/30/2020) 12

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.