80 likes | 165 Views
TEAM 9 - MRAV SOFTWARE DESIGN NARRATIVE Nick Gentry, Vinayak Gokhale , Vineet Ahuja & Oliver Staton. March 23, 2011. Design Considerations. Peripherals: ADC, UArt , Timer, I2C Constants stored in Information memory portion of Flash All peripherals will be Flag driven. Why?
E N D
TEAM 9 - MRAVSOFTWARE DESIGN NARRATIVENick Gentry, VinayakGokhale, Vineet Ahuja & Oliver Staton March 23, 2011
Design Considerations • Peripherals: ADC, UArt, Timer, I2C • Constants stored in Information memory portion of Flash • All peripherals will be Flag driven. Why? • JTAG ports will be used for debugging
Main Design Consideration • ADC used to Sample Ultrasonic Sensors at 20 Hz • Gyroscope sampled at 250 – 300 Hz • Accelerometer sampled at 250 – 300 Hz • Magnetometer sampled at 10Hz • User inputs at 250 – 300 Hz
START SENSOR SAMPLE == 1 INITIALIZE GLOBAL VARIABLES VERIFY SENSOR IDS SAMPLE SENSORS by enabling interrupts YES NO NO WRITE CONSTANTS TO NON-VOLATILE FLASH YES PIDCOUNT == 50 CHECK ESC ARM CONDITION FLAG CALCULATE MTR DUTY CYCLES YES NO INITIALIZE:ADCTIMER_A, B UART / I2C NO YES SET NEW PWM VALUES INITIALIZE ESCs , BEGIN IDLE CONDITION ENABLE PERIPHERALS W/O INTERRUPTS except UArt IF HEARTBEAT == 100 NO NO WHILE (1) VERIFY CONNECTION W/BASE STATION YES TOGGLE HEARTBEAT LED YES
Timer_A Interrupt Sensor counter == val YES Enable interrupt, set flag & set counter to 0 NO Increment counter Exit
PID STABILITY LOOPS y.pitchRate North tilt y.pitch ROTATE TO BODY r.pNy.pNy.vN F-B PID PID PID PID PID pitch y.yaw y.rollRate East tilt y.roll r.pEy.pEy.vE ROTATE TO BODY PID L-R y.yaw roll MOTOR MIXER r.hy.hy.w SUM (L+R+F+B) -1 yawRate r.yaw y.yawy.yawRate PIDw/ LPF L+R-F-B