Download presentation
Presentation is loading. Please wait.
Published byDerrick Norman Modified over 9 years ago
1
Ben Fluehr, Derrick Lam, Brett Melonis, Alex Person
2
Overview Work Completed Car Motion Control – Servos Car Vision – CMUcam Car Steering – Magnetometers Car Obstacle Avoidance – Range finders Work Remaining
3
Car Motion Control Electronic Speed Controller (ESC) Single steering servo Controlled via Handy Board
4
ESC Control Pulse Width Modulated (PWM) control signal from Handy Board Draws power from battery Grounded to Handy Board
5
Steering Servo Control Pulse Width Modulated (PWM) control signal from Handy Board Draws power from ESC Grounded to Handy Board
6
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; }
7
Car Vision - CMUcam 1
8
CMUcam Main Loop void 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 }
9
CMUcam Detecting Blobs int track_red() { if (trackRaw(180,220,40,65,85,115) > 0) { return track_confidence; } else return 0; }
10
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
11
Magnetometer – Eval Board Pre-mounted Components HMC1052L MOSFET reset Amplifier circuitry Five Holes Vcc and GND Out1 and Out2 Set
12
Magnetometer – Behavior Neutral Voltage = Vcc / 2 Voltage changes more as distance decreases Magnetic field strength Strongest at poles and weakest in between Very strong fields cause problems Point axis towards pole for best results
13
Magnetometer – Behavior (cont.)
14
Magnetometer – Code void CheckMagnetometer() { int reading = analog(MAGNET_PORT); int absDiff = abs(reading - neutral); if (absDiff > MAGNET_THRESHOLD) { ChangeSteering(absDiff); neutral = analog(MAGNET_PORT); }
15
Car Obstacle Avoidance Original plan Maxbotix Range Finder Analog output Problem Still having jumpy output in the distances of interest Increased code complexity Difficulty responding to small changes in distance
16
Solution Sharp Range Sensors Use infrared instead of sonar Should “see” a narrower range Only requires power, ground, analog output May combine multiple sensors Sharp GP2D12: 10 – 80 cm Sharp GP2Y0A02YK: 20 – 150 cm MaxSonar-EZ1: 15 – 645 cm
17
Sharp Range Sensors GP2D12 GP2Y0A02YK Sensor Cable
18
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(); }
19
Work Remaining Mount components in final position Glue Pieces of plastic Combine code to run simultaneously Code finished for each component Can probably call functions in turn from main loop Possibility: multiple processes ○ Support from Interactive C ○ Spawn from any C function ○ Each runs for 5 ms
20
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.