19static const LOG_TAG ID =
"AeroServo";
27static const int angleMin = 30;
28static const int angleMax = 72;
29static const int lerpConst = 50;
31static PWMServo servo1;
32static PWMServo servo2;
34static int servoVal = angleMin * lerpConst;
37 Log.
i(ID,
"Initializing Aero servo pins");
38 servo1.attach(PINS_BACK_SERVO1_PWM);
39 servo2.attach(PINS_BACK_SERVO2_PWM);
40 Log.
i(ID,
"Turning on servos");
46 return servoVal / lerpConst;
49void run(
int breakPressure,
int steeringAngle) {
56 if (steeringAngle <= steerLMin) {
57 steerPos = map(steeringAngle, steerLMax, steerLMin, angleMax, angleMin);
58 }
else if (steeringAngle >= steerRMin) {
59 steerPos = map(steeringAngle, steerRMin, steerRMax, angleMin, angleMax);
62 servoVal += max(breakPos, steerPos) - (servoVal / lerpConst);
64 servo1.write(servoVal / lerpConst);
65 servo2.write(servoVal / lerpConst);
Interpretation of Aero subteam code.
Special logging functionality.
const char * LOG_TAG
Type definition of logging tags This typedef is necessary to allow for easier manipulation of code by...
Logging::Log_t Log
The global logging object.
#define PINS_ANALOG_MIN
The minimum analog value. Its zero, I think it will always be zero. Not sure why i needed this.
#define PINS_ANALOG_MAX
The maximum analog value, given the current PINS_ANALOG_RES.
#define PINS_VOLT_TO_ANALOG(x)
Maps Voltages 0-5v to an appropriate analog value.
Module used for aero calculations.
void run(int breakPressure, int steeringAngle)
Run Aero servo logic, given raw values.
void setup(void)
Attach analog pins to their servo objects.
int getServoValue()
Get the current servo position value.
void setPinValue(uint8_t GPIO_Pin, int value)
Set the pin value of a predefined pin.
void i(LOG_TAG TAG, LOG_MSG message)
Log a string using an info tag.