Configuring Robot Movement

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

PRIME LESSONS

By the Makers of EV3Lessons

CONFIGURING ROBOT MOVEMENT


BY SANJAY AND ARVIND SESHAN
LESSON OBJECTIVES
 Learn to configure robot movement on a SPIKE Prime or Robot Inventor robot
 Note: Although images in this lesson show a SPIKE Prime, the code blocks are the same for
Robot Inventor
 Learn how to add you first programming blocks to the programming canvas

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


2
WHY CONFIGURE YOUR CODE?
 Every robot is different
 Before you can program to move or turn, you need to first set how you have configured
your robot:
 What ports are the drive motors connected to?
 What type of wheels are you using?
 What fast do you want to move?
 Do you want to stop immediately at the end of a move?

 This information needs to be in every program you write

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


3
WHAT IS CONNECTED TO EACH PORT?

Droid Bot IV ADB

Droid Bot IV Configuration


ADB Default settings
Drive
Motor Drive
Motor

Drive Drive
Motor Motor

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


4
CONFIGURING MOVEMENT BLOCKS
 Before using movement blocks, you must configure the robot
Left A
first.
 There are three blocks for this purpose:

Right E
Determines which motors are connected to the left &
right wheels (change the settings for your robot).
Whenever blocks have 2 inputs for wheels – the first
one is for the left wheel and second is for right.

Sets the “default” speed for move blocks you may


use later in the program
Determines what the robot does at the end of a move
block (brake, hold position, or float). To access this
block you will need to add “More Movement
Blocks” from block extensions

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


5
STOP MODES: BRAKE VS. HOLD VS. FLOAT
 Break – after move, bring motors to a hard stop
 Hold position – after move, bring motor to a hard stop and use motor power to counter
any further movement until the motor is used again. You will not be able to move the
motor by hand.
 Float – after move, allow motors to move due to momentum
 In general, we will use hold or brake in most of our programs.

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


6
HOW TO ADD A PROGRAMMING BLOCK

STEP 1: Click and hold


Set Speed block and drag
to programming area

STEP 2: Drop next to the Start Block


(green arrow) (See animation)
Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 1/9/2020)
7
WHEEL SIZE AND MOVEMENT CONFIGURATION
 The default option for the move block is to
move for a specified distance in CM
 However, prior to using this mode, you have to
tell the program the number of cm per rotation
travelled
 You will need to calculate this value as it
depends on what wheel you use. The next two
slides explain different ways to calculate this
value.
 Note that you can use inches instead of
centimeters if you prefer

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


8
HOW MANY CM DOES THE ROBOT MOVE IN 1 ROTATION?
(METHOD 1)
1. Look up the wheel size in mm printed on your tire Helpful chart with common LEGO
wheels and their diameters.
and divide by 10 to convert to cm (because
1cm=10mm) http://wheels.sariel.pl/

2. Multiply the answer in step 1 by π (3.14) to compute


circumference
3. Use the value to set the motor rotation block
 Example calculation using the standard small SPIKE
Prime wheels (used in Droid Bot IV):
1. Small SPIKE Prime Wheels = 5.6cm in diameter
2. 5.6cm × π = 17.5cm per rotation
 Example calculation using the standard large SPIKE
Prime set wheels (used in ADB):
1. Large SPIKE Prime Wheels = 8.8 cm in diameter
2. 8.8 cm × π = 27.6 cm per rotation

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


9
HOW MANY CM DOES THE ROBOT MOVE IN 1 ROTATION?
(METHOD 2)
Use the Dashboard to view sensor data to find the Motor Degrees value
1. Put your ruler next to your wheel/robot at 0 centimeters (whatever part of the robot you use to align
with 0, you should use to use to measure distance in step 2)
2. Roll your robot forward until the motor encoder reading (in the SPIKE software) reaches 1 rotation, or
360 degrees. Once you learn to program movement, you can program the robot to move 1 rotation
forward.
3. Read the number of CM the robot moved along the ruler
4. Use the values to configure your robot’s movement

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


10
PUTTING IT TOGETHER
 For Droid Bot IV, smaller wheels are used. One rotation only moves 17.5cm. The default is
speed is, therefore, also set higher.
 For ADB, the larger wheels are used. One rotation moves 27.6cm. The default speed is lower
for additional control.

Droid Bot IV ADB

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


11
CREDITS

 This lesson was created by Sanjay Seshan and Arvind Seshan for Prime Lessons
 More lessons are available at www.primelessons.org

                         
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2020 Prime Lessons (primelessons.org) CC-BY-NC-SA. (Last edit: 1/9/2020)
12

You might also like