Custom version for NXP cup car
Diff: MotorControl.h
- Revision:
- 2:0d5c994d8135
- Parent:
- 1:7ce4ffeb8ccb
- Child:
- 3:170c22171ec2
--- a/MotorControl.h Fri Mar 25 13:03:59 2016 +0000 +++ b/MotorControl.h Thu Jun 01 13:16:50 2017 +0000 @@ -16,16 +16,23 @@ void stop(); void saveBatteryVoltageMeasure(uint16_t ADCresult); void saveMotorCurrentMeasure(uint16_t MotA_ADCresult, uint16_t MotB_ADCresult); - void saveSteering(float angle); float getWheelSpeed(char mot); float getWheelRPS(char mot); + float getCarSpeed(); void processTasks(); + float getMotCurrent(char mot); + float getMotPWM(char mot); float getAverageMotCurrent(char mot); float getAverageBatteryVoltage(); void setFixedPWMValue(float pwm); + void setSpeedTargetValue(float speed); + + float getSpeedError(); private: + int16_t motorAPWM[MOTSAMPLECOUNT]; + int16_t motorBPWM[MOTSAMPLECOUNT]; uint16_t motorACurrent[MOTSAMPLECOUNT]; uint16_t motorBCurrent[MOTSAMPLECOUNT]; uint16_t batteryVoltage[BATSAMPLECOUNT]; @@ -33,8 +40,14 @@ uint8_t motorCurrentIndex; uint8_t batVoltageIndex; - float currentPWM; - float steeringAngle; + int16_t nextPWM; +// int16_t torqueDiffAvg; + uint8_t motorDriveIndex; + float currentMotAPWM; + float currentMotBPWM; + + int32_t speedTarget; + int32_t speederror1000000; }; #endif \ No newline at end of file