00001 00002 #ifndef STEERING_THROTTLE_H 00003 #define STEERING_THROTTLE_H 00004 00005 #include "coridium.h" 00006 #include "cor_hwlib.h" 00007 #include "cor_wrflash.h" 00008 00009 #include "string.h" 00010 #include "printf.h" 00011 #include <math.h> 00012 00013 //constants, min and max throttle and steering pulsout pulse durations 00014 static const int STEERING_ZERO = 1406, THROTTLE_ZERO = 1501; 00015 static const int FULL_LEFT = 1814, FULL_RIGHT = 998; //+-408 = +-128 * 3.19, 00016 static const int FULL_FORWARD = 1909, FULL_REVERSE = 1093; //+-408 = +-128 * 3.19, 00017 static const short PULSE_SPAN = 408; 00018 00019 //steering and throttle functions 00020 int initializeSteeringAndThrottleOut(int steering_out_pin, int throttle_out_pin); 00021 00022 int pulsoutSteering(int steering_setpoint); 00023 //reset_id: resets the static integral and derivitave terms 00024 int pulsoutThrottle(int throttle_setpoint, int normalized_counts); 00025 int pulsoutThrottleNoPID(int throttle_setpoint); 00026 void resetIntegralAndDerivative(); 00027 00028 void initializeSteeringAndThrottleIn(int steering_in_pin, int throttle_in_pin); 00029 int checkForSteeringAndThrottle(); 00030 int getSteeringPulsinDuration(); 00031 int getThrottlePulsinDuration(); 00032 00033 #endif