Johnathan Aspinwall Mykala Miller

Transcription

Johnathan Aspinwall Mykala Miller
Object Tracking
Johnathan Aspinwall
Mykala Miller
Objective
Track the Nearest Object’s Position
horizontally
vertically
Our Setup
4 IR Distance Sensors
80cm Range
2 Servo Motors (15kg)
Hardware
Vservo (6V)
Vsharp
Vcc
Vcc
Signal
Left IR Sensor
AN02
AN03
AN04
Gnd
AN05
Pan Servo
7
8
9
10
HCS12
H1
23
22
PT4
Signal
Gnd
PT3
Vcc
Tilt Servo
Vcc
Signal
Right IR Sensor
Signal
Gnd
Vcc
Signal
Top IR Sensor
Gnd
Vcc
Signal
Bottom
IR Sensor
Gnd
Gnd
Process
Arduino Proof of Concept Testing
Scaling IR Sensors
PWM System
Duty Cycle Issues
Software
Decided to Use Infinite Loop
Wanted to be as fast as possible
Periodic Intervals weren’t necessary
CPU didn’t need to do anything else
Pseudo-Code
declare global integers servoPanPos, servoTiltPos
set global integers servoPanMin, servoTiltMin, servoPanMax, servoTiltMax
function delayuSec takes one integer argument (time)
delay for time microseconds
end function
function calculatePositionChange takes 4 integer arguments (v1, v2, v3, v4)
set servoPanPos = servoPanPos + (v2 - v1)/divisor
if servoPanPos is less than the minimum allowable value
set servoPanPos = minimum allowable value
else if servoPanPos is greater than the maximum allowable value
set servoPanPos = maximum allowable value
set servoTiltPos = servoTiltPos + (v4-v3)/divisor
if servoTiltPos is less than the minimum allowable value
set servoTiltPos = minimum allowable value
else if servoTiltPos is greater than the maximum allowable value
set servoTiltPos = maximum allowable value
end function
Pseudo-Code - cont.
function main
enable run mode
set necessary pins to output
initialize A/D system
initialize PWM system - use a positive-going pulse
while true do
val1 = left IR sensor value from A/D converter
val2 = right IR sensor value from A/D converter
val3 = top IR sensor value from A/D converter
val4 = bottom IR sensor value from A/D converter
call calculatePositionChange(val1, val2, val3, val4)
set Paning Servo Input = servoPanPos
set Tilting Servo Input = servoTiltPos
call delayuSec(15000)
end while
end function
Improvement Ideas and
Practical Applications
Distance Measurement
Ability to Shoot a Projectile at the Object
Video Camera
Collision Detection and Avoidance
Questions?