Mechanical Components and Programming

Transcription

Mechanical Components and Programming
Mechanical Components and Programming
Ken Youssefi
Introduction to Engineering – E10
1
7.2 V, 3000 mAh battery pack
and charger
Ken Youssefi
Introduction to Engineering – E10
2
Controller (Cortex)
Ken Youssefi
Motor and
Servo ports
Introduction to Engineering – E10
8 analog and
12 digital
ports. Digital
ports are
used for Limit,
Bumper and
Ultrasonic
sensors 3
Side view of the VEX Controller
On/Off switch
Backup Batter Port
(not available)
Ken Youssefi
Batter Ports
Introduction to Engineering – E10
4
Orange cable (USB
connections at both ends)
used to download
programs from computer
to the controller
Battery
connection
Ken Youssefi
Introduction to Engineering – E10
5
Mechanical Components – Motor (Cortex)
The new robot kit includes three 2-wire motors that can be
converted to a 3-wire motor using the controller 29. Ports 1 and
10 on the new controller are designated for 2-wire motors only.
3 pins
2 pins
Hsu/Youssefi
6
Servo and Clutch
Servo are used to control the rotation of a shaft (controls the
motion of the robot arm). Make sure the clutch module is always
used. It prevents damage to the motor in case of large torque.
Clutch
Ken Youssefi
Introduction to Engineering – E10
7
VEX Sensors
Limit Switch Sensor
Ultrasonic Sensor
Attach all digital sensors
to 1-12 ports in Digital
section
Bumper Switch Sensor
Ken Youssefi
Introduction to Engineering – E10
8
8 Detectors, cover a field
of view of 100O
Infrared Receiver Board (IRB), the eyes of the robot.
Ken Youssefi
Introduction to Engineering – E10
9
Do’s and Don’t’s
• Make sure the battery is charged.
• Do not place the VEX manual in your box, leave it on
the table.
• Do not tamper with other group’s robot. Do not leave
your box on the table, store it on top of the work bench
that includes your box number.
• Clean up before leaving
• There are two size of allen wrenches used for
tightening screws. Leave the allen wrenches on the
table for all to share.
Ken Youssefi
Introduction to Engineering – E10
10
Design Considerations
• The best design is the simplest design. Make your
robot using the fewest number of parts.
• Plan ahead the location of the major components
(controller, battery, electronic board, the arm, sensors
The electronic board should be in the front and the
white LEDs should have an unobstructed view of the
beacon. The height of the LEDs should be roughly the
same as the ones in the beacon.
• The electronic board should be insulated from the metal
parts of the robot. Otherwise the IRB will be shorted
• You will have to plug and unplug components from the
controller, leave space so the top of controller is
readily accessible.
Ken Youssefi
Introduction to Engineering – E10
11
EasyCcortex
Select New Standalone Project
Ken Youssefi
Choose Autonomous
Only
Project
Introduction to Engineering
– E10
12
From Window option select the Block & C Programing
option to view the code
Function
blocks
Ken Youssefi
Flow chart
Introduction to Engineering – E10
Program
code
13
EasyCcortex Layout
Your program is
inserted here
Program
code window
Function
blocks
Flow chart window
Ken Youssefi
Introduction to Engineering – E10
14
Program
blocks
Sensor
blocks
Outputs
options
Ken Youssefi
Introduction to Engineering – E10
15
Adding Continuous motor
Enter motor number,
as connected to the
Controller motor port
Max. speed
counterclockwise
Select Motor, drag
and drop on the
line between Begin
and End
Max. speed
clockwise
Custom
speed
Ken Youssefi
Introduction to Engineering – E10
16
Servo motor
Servos control the position of the
motor shaft, angle of rotation
Connect the Motor Controller 29 to the
2-wire Motor. This converts a 2-wire
motor to a 3-wire servo. Connect Red
to Red wire
0
127
-127
0
-127
Ken Youssefi
127
Introduction to Engineering – E10
17
Robot moving forward
Motor 1 rotates at
max speed clockwise
Motor 2 rotates at max speed
counterclockwise
Robot moves forward
at high speed
Ken Youssefi
Introduction to Engineering – E10
18
Enter time in millisecond
(5000 msec)
The Wait function
Ken Youssefi
Introduction to Engineering – E10
19
Robot goes forward at top
speed for 5 seconds and
then stops
Robot goes forward at
top speed for 5 seconds
and then stops. It waits 1
second and then it turns
right at half speed for 2
seconds and goes
forward.
Ken Youssefi
Introduction to Engineering – E10
20
Objective
Write a program so that the robot, upon encountering
any obstacle, would back up, turn and continue.
Define all sensors: Limit and Bumper switches on the right and left
side of the robot. Right click on the Variable and Edit the Block
Ken Youssefi
Introduction to Engineering – E10
21
Add an IF statement to check if the
sensors have been activated or not
(robot has hit an obstacle or not)
Inside a While Loop, drag
and drop all sensors
Initializing and scanning the sensors
Ken Youssefi
Introduction to Engineering – E10
22
ELSE  one of the sensors is activated (o)
Stop both motors for 1 second
Back up for 2 seconds
Turn for 2 seconds
Go forward
Ken Youssefi
Introduction to Engineering – E10
23
Downloading the Program to the Controller
Connect the PC to the Controller using the USB
orange cord. Select Build and Download option.
Follow the on screen instructions. Check for compilation
errors in the Program Code section.
Ken Youssefi
Introduction to Engineering – E10
24