W itty's robotically engineered car kraziness (W.R.E.C.K.)
description
Transcript of W itty's robotically engineered car kraziness (W.R.E.C.K.)
Ben Fluehr, Derrick Lam, Brett Melonis, Alex Person
Overview Work Completed
Car Motion Control – ServosCar Vision – CMUcamCar Steering – MagnetometersCar Obstacle Avoidance – Range finders
Work Remaining
Car Motion Control
Electronic Speed Controller (ESC) Single steering servo Controlled via Handy Board
ESC Control
Pulse Width Modulated (PWM) control signal from Handy Board
Draws power from battery Grounded to Handy Board
Steering Servo Control
Pulse Width Modulated (PWM) control signal from Handy Board
Draws power from ESC Grounded to Handy Board
Motion Control Example#use "servo_a5.icb"#use "servo_a7.icb"
#define MOTOR_NEUTRAL 3040#define STEERING_NEUTRAL 3000#define NORMAL_SPEED 3350
void drive_forward() { servo_a5_pulse = NORMAL_SPEED;}
void brake() { servo_a5_pulse = MOTOR_NEUTRAL;}
Void steer_straight() { servo_a7_pulse = STEERING_NEUTRAL;}
#use “servo_a5.icb”
#define MOTOR_NEUTRAL 3040#define NORMAL_SPEED 3350
void accelerate() { int i; for (i = MOTOR_NEUTRAL; i <= NORMAL_SPEED; i + 10) { servo_a5_pulse = i; }}
Car Vision - CMUcam 1
CMUcam Main Loopvoid main(){ //Initialize camera init_camera(); clamp_camera_yuv();
//Main loop while(1) { if (track_red() > 40) { //Stop sign found }
if (track_yellow() > 40) { //Yield sign found
} }
CMUcam Detecting Blobsint track_red()
{
if (trackRaw(180,220,40,65,85,115) > 0) {
return track_confidence;
} else return 0;
}
CMUCam Continued int trackRaw(int rmin, int rmax, int ymin,
int ymax, int bmin, int bmax) Uses CrYCb instead of more commonly
known RGB space A box bounds the pixels within color
boundaries, and the amount of pixels within box determines the confidence rating
Must calibrate color ranges in track’s room with actual signs
Magnetometer – Eval Board Pre-mounted
ComponentsHMC1052L MOSFET resetAmplifier circuitry
Five HolesVcc and GNDOut1 and Out2Set
Magnetometer – Behavior Neutral Voltage = Vcc / 2 Voltage changes more as distance
decreases Magnetic field strength
Strongest at poles and weakest in betweenVery strong fields cause problemsPoint axis towards pole for best results
Amplified Magnetometer Output Voltage vs. Magnet Distance
2
2.5
3
3.5
4
0 5 10 15 20
Distance (cm)
Out
put
(V)
Magnetometer – Behavior (cont.)
Magnetometer – Code void CheckMagnetometer(){ int reading = analog(MAGNET_PORT); int absDiff = abs(reading - neutral); if (absDiff > MAGNET_THRESHOLD) {
ChangeSteering(absDiff);neutral = analog(MAGNET_PORT);
}}
Car Obstacle Avoidance
Original planMaxbotix Range FinderAnalog output
ProblemStill having jumpy output in the distances of
interestIncreased code complexityDifficulty responding to small changes in
distance
Solution
Sharp Range SensorsUse infrared instead of sonarShould “see” a narrower rangeOnly requires power, ground, analog output
May combine multiple sensorsSharp GP2D12: 10 – 80 cmSharp GP2Y0A02YK: 20 – 150 cmMaxSonar-EZ1: 15 – 645 cm
Sharp Range Sensors GP2D12
GP2Y0A02YK
Sensor Cable
Interactive C Example
#define PORT 5 /* 7 available ports */
void main()
{
int distance = analog(PORT); /* 0 to 255 */
if (distance > 128) /* half max distance */
brake();
}
Work Remaining Mount components in final position
GluePieces of plastic
Combine code to run simultaneouslyCode finished for each componentCan probably call functions in turn from
main loopPossibility: multiple processes
○ Support from Interactive C○ Spawn from any C function○ Each runs for 5 ms
Questions?