200 likes | 336 Views
Ben Fluehr, Derrick Lam, Brett Melonis, Alex Person. W itty's robotically engineered car kraziness (W.R.E.C.K.). Overview. Work Completed Car Motion Control – Servos Car Vision – CMUcam Car Steering – Magnetometers Car Obstacle Avoidance – Range finders Work Remaining. Car Motion Control.
E N D
Ben Fluehr, Derrick Lam, Brett Melonis, Alex Person Witty's robotically engineered car kraziness (W.R.E.C.K.)
Overview • Work Completed • Car Motion Control – Servos • Car Vision – CMUcam • Car Steering – Magnetometers • Car 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
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 } }
CMUcam Detecting Blobs int 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 Components • HMC1052L • MOSFET reset • Amplifier circuitry • Five Holes • Vcc and GND • Out1 and Out2 • Set
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
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 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
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
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 • 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