Callum and Adel's changes on 12/02/19
Dependencies: Crypto
Diff: main.cpp
- Revision:
- 37:71adabab284a
- Parent:
- 35:132413ec3d65
- Child:
- 38:a3713a09c828
diff -r 132413ec3d65 -r 71adabab284a main.cpp --- a/main.cpp Mon Mar 18 19:22:27 2019 +0000 +++ b/main.cpp Mon Mar 18 20:04:34 2019 +0000 @@ -92,7 +92,7 @@ volatile uint8_t cmdIndx; volatile uint8_t inCharQIdx; - volatile uint32_t motorPower; // motor toque + volatile float motorPower; // motor toque volatile float targetVel; volatile float targetRot; @@ -358,7 +358,7 @@ Thread t_motor_ctrl; // Thread for motor Control - uint32_t MAXPWM; + float MAXPWM; public: @@ -494,7 +494,7 @@ int32_t locMotorPos; //Local copy of motor position static int32_t oldMotorPos = 0; //Old motor position used for calculations static uint8_t motorCtrlCounter = 0; //Counter to be reset every 10 iterations to get velocity calculation in seconds - int32_t torque; //Local variable to set motor torque + float torque; //Local variable to set motor torque float sError; //Velocity error between target and reality float rError; //Rotation error between target and reality static float rErrorOld; //Old rotation error used for calculation @@ -565,7 +565,8 @@ pwmCtrl.pulsewidth(torque); p_comm->motorPower = torque; //Lastly, update global variable motorPower which is updated by interrupt - + p_comm->pc.printf("%f, %i, %i \r", torque, Ys, Yr); + //p_comm->pc.printf("%u,%u,%u,%u. %.6i \r", iterElementMax, cpyStateCount[0],cpyStateCount[1],cpyStateCount[2], (totalDegrees*10)); } }