You are on page 1of 31

Lesson 4

Simple Behaviors 2

EMT05L (Emerging Technologies I)


1T 2019-2020
Learning Objectives
• To recall simple behaviors

• To recall calculations of the number of wheel


rotations

• To construct a Standard Drive Base Robot

• To program a Standard Drive Base to perform


challenges 2
Timeline (7:00 – 10:00 AM Classes)
Time Period Duration Task
7:00 – 7:15 AM 15 mins • Review of Simple Behaviors
7:15 – 7:20 AM 5 mins • Borrowing of Materials
7:20 – 8:20 AM 60 mins • Building of Standard Drive Base Robot
• Doing the activity (time-based vs. rotation-based
8:20 – 8:30 AM 10 mins
programming)
• Programming the robot to perform the challenge
8:30 – 9:20 AM 50 mins
(forward, point turn + swing turn)
9:20 – 9:30 AM 10 mins • Dismantling the robot
9:30 – 9:50 AM 20 mins • Returning of materials

3
Timeline (8:30 – 11:30 AM Classes)
Time Period Duration Task
8:30 – 8:45 AM 15 mins • Review of Simple Behaviors
8:45 – 8:50 AM 5 mins • Borrowing of Materials
8:50 – 9:50 AM 60 mins • Building of Standard Drive Base Robot
• Doing the activity (time-based vs. rotation-based
9:50 – 10:00 AM 10 mins
programming)
• Programming the robot to perform the challenge
10:00 – 10:50 AM 50 mins
(forward, point turn + swing turn)
10:50 – 11:00 AM 10 mins • Dismantling the robot
11:00 – 11:20 AM 20 mins • Returning of materials

4
Timeline (11:30 AM – 2:30 PM Classes)
Time Period Duration Task
11:30 – 11:45 AM 15 mins • Review of Simple Behaviors
11:45 – 11:50 AM 5 mins • Borrowing of Materials
11:50 AM – 12:50 PM 60 mins • Building of Standard Drive Base Robot
• Doing the activity (time-based vs. rotation-based
12:50 – 1:00 PM 10 mins
programming)
• Programming the robot to perform the challenge
1:00 – 1:50 PM 50 mins
(forward, point turn + swing turn)
1:50 – 2:00 PM 10 mins • Dismantling the robot
2:00 – 2:20 PM 20 mins • Returning of materials

5
Timeline (1:00 – 4:00 PM Classes)
Time Period Duration Task
1:00 – 1:15 PM 15 mins • Review of Simple Behaviors
1:15 – 1:20 PM 5 mins • Borrowing of Materials
1:20 – 2:20 PM 60 mins • Building of Standard Drive Base Robot
• Doing the activity (time-based vs. rotation-based
2:20 – 2:30 PM 10 mins
programming)
• Programming the robot to perform the challenge
2:30 – 3:20 PM 50 mins
(forward, point turn + swing turn)
3:20 – 3:30 PM 10 mins • Dismantling the robot
3:30 – 3:50 PM 20 mins • Returning of materials

6
Simple Behaviors

7
Recall: Behavior
• anything that your robot does

• examples:
 turning on a single motor
 moving forward
 tracking a line
 navigating a maze

• Three types:
1. Basic Behavior
2. Simple Behavior
3. Complex Behavior 8
Recall: Basic vs. Simple vs. Complex Behaviors

9
Recall: Basic vs. Simple vs. Complex Behaviors

10
Recall: Basic vs. Simple vs. Complex Behaviors

11
Programming Simple Behaviors in RobotC

Quantity Unit Speed / Power Level

Motor Port Quantity Unit Speed / Power Level

12
Simple Behaviors (Linear Movement)
• Linear movement commands in RobotC:
forward and backward

• To get the number of rotations of the wheel:


dt
nr 
Cw
where:
𝑛𝑟 = number of rotations needed
𝑑𝑡 = target distance
𝐶𝑤 = circumference of the wheel 13
Simple Behaviors (Linear Movement)
Question: Is 1 rotation of the wheel equals to the
circumference of the wheel and distance travelled by the
robot?
In the VEX IQ Super Kit,
𝐶𝑤 = 200 mm = 20 cm.

In general, 𝐶𝑤 = 𝜋 × 𝑑𝑖𝑎𝑚𝑒𝑡𝑒𝑟𝑤ℎ𝑒𝑒𝑙 .

14
Simple Behaviors (Linear Movement)
Sample computations:
20 cm
• Target distance: 20 cm nr   1 rotation
20 cm

60 cm
• Target distance: 60 cm nr   3 rotations
20 cm

90 cm
• Target distance: 90 cm nr   4.5 rotations
20 cm
15
Simple Behaviors (Linear Movement)
• Converting rotation to degrees:

nd  nr  360
where:
𝑛𝑑 = number of degrees
𝑛𝑟 = number of rotations

16
Simple Behaviors (Turning)
Two types of turn:

1. Point turn - when the two drive motors set to


equal but opposite (100 and -100, for example)
power levels

2. Swing turn - when the two drive motors are set to


different values and the robot's path makes a
curve 17
Turning Concepts (Point Turn)
• Point turns require that the
center of rotation is centered
between the drive wheels.

• For this to happen one side must


go forward while the other side
goes backwards. Since the
attempted direction of travel are
opposite they counteract each
other and cause the vehicle to
spin in place. 18
Simple Behaviors (Turning)
• Point Turn commands in RobotC: turnLeft and turnRight

• Formula for Point Turn (number of rotations):

 (Cr )
nr 
Cw (360)
where:
𝑛𝑟 = number of rotations needed
𝜃 = target turn angle
𝐶𝑟 = circumference of the robot = 𝜋 × 𝑑𝑖𝑎𝑚𝑒𝑡𝑒𝑟𝑟𝑜𝑏𝑜𝑡
𝐶𝑤 = circumference of the wheel 19
Simple Behaviors (Turning)

Cr    diameterrobot
 3.1416 18 cm
 56.55 cm
Approximate diameter
of the robot: 18 cm
20
Simple Behaviors (Turning)
Sample computations (Point Turn):
(45)(56.55 cm)
• Target turn angle: 45° nr   0.35 rotation
(20 cm)(360)

(90)(56.55 cm)
• Target turn angle: 90° nr   0.71 rotation
(20 cm)(360)

(180)(56.55 cm)
• Target turn angle: 180° nr   1.41 rotations
(20 cm)(360)
21
Turning Concepts (Swing Turn)
• A swing turn is where a vehicle
"swings" around a pivot point.
This occurs when one side of the
vehicle is traveling faster than the
other.

• It is often the case that one side


is completely stopped, causing
the vehicle to pivot around the
stopped wheel.
22
Simple Behaviors (Turning)
• Swing Turn command in RobotC: moveMotor

• Formula for Swing Turn (number of rotations):

 (2Cr )
nr 
Cw (360)
where:
𝑛𝑟 = number of rotations needed
𝜃 = target turn angle
𝐶𝑟 = circumference of the robot = 𝜋 × 𝑑𝑖𝑎𝑚𝑒𝑡𝑒𝑟𝑟𝑜𝑏𝑜𝑡
𝐶𝑤 = circumference of the wheel 23
Simple Behaviors (Turning)
Sample computations (Swing Turn):
(45)(2  56.55 cm)
• Target turn angle: 45° nr   0.71 rotation
(20 cm)(360)

(90)(2  56.55 cm)


• Target turn angle: 90° nr   1.41 rotations
(20 cm)(360)

(180)(2  56.55 cm)


• Target turn angle: 180° nr  (20 cm)(360)  2.83 rotations
24
Point Turn vs. Swing Turn

25
Lab Activity 3: Simple Behaviors (Physical)

26
Lab Activity 3
Activity No.: Lab 3
Title: Simple Behaviors (Physical)
EMT05L Lab 3 R204/R208
Simple Behaviors (Physical)

Student Numbers, Names, and

Materials: Signatures of Group Members

1 unit Standard Drive Base Kit 1 unit Standard Drive Base Kit

1 unit Laptop
1 unit Laptop
1 unit Mouse
1 unit Charger
1 unit Extension Cord (to be assigned by Instructor)

1 unit Mouse
1 unit Charger Instructor’s
Borrower’s Signature
(after borrowing)

Signature

1 unit Extension Cord


Borrower’s Signature
(before borrowing)

(Extension Cord - to be assigned by instructor whose


27
group will borrow)
Lab Activity 3
Steps:

1. Build the Standard Drive Base Robot


following the Build Instructions

2. Do the guided activities


• time-based vs. rotation based
programming

3. Do the challenge (program the


robot to follow a certain path) 28
Do This
Time-based Programming

• Program your robot to move forward for 1 second with 100%


speed (power level)
• Identify the distance travelled by the robot
• Using the data-gathered, program the robot to move 50 cm (change
only the number of seconds / quantity)
• How did you come up with the number of seconds to solve the
mission?
• Change the speed to 50% and run the program again
• Did the robot move to its desired location? What did you observe?
29
Do This
Rotation-based Programming

• Program your robot to move forward for 1 rotation with 100%


speed (power level)
• Identify the distance travelled by the robot
• Using the data-gathered, program the robot to move 50 cm (change
only the number of rotations / quantity)
• How did you come up with the number of rotations to solve the
mission?
• Change the speed to 50% and run the program again
• Did the robot move to its desired location? What did you observe?
30
Challenge
Program your robot to follow Starting
the path shown, in the field Point

track. Use a combination of


point turns and swing turns
for every turn.

The top three groups to finish


will receive additional points! End
Point
First: 5 points
Second: 3 points
Third: 2 points 31

You might also like