![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
ManualControl
Dependencies: TPixy-Interface
Fork of MbedOS_Robot_Team by
Diff: ui.cpp
- Revision:
- 2:ca2a7430739b
- Parent:
- 1:3e9684e81312
- Child:
- 4:417e475239c7
--- a/ui.cpp Sat Feb 03 00:05:08 2018 +0000 +++ b/ui.cpp Sat Feb 03 00:37:57 2018 +0000 @@ -14,15 +14,16 @@ char x; extern int16_t dPosition, dTime; - extern float Ki; extern float Kp; - extern int vel; +extern int32_t e; +extern int32_t xState; +extern int32_t u; int16_t position; -extern int32_t e; + /****************************************************************************** A function to test blutooth communication @@ -109,7 +110,7 @@ } } position += dPosition; - bluetooth.printf("\r\nPos: %d, dP: %d, dT: %d, Kp: %f, Ki: %f, vel: %d, e: %d", position, dPosition, dTime, Kp, Ki, vel, e); + bluetooth.printf("\r\nPos: %d, dP: %d, dT: %d, Kp: %f, Ki: %f, vel: %d, e: %d", position, dPosition, xState, dTime, Kp, Ki, vel, e); } @@ -135,7 +136,7 @@ // by incrementing u else if(x == 'w') { setpoint_mutex.lock(); - if ( setpoint < 703 ) + if ( setpoint < 506 ) { //setpoint = setpoint + SPEED_STEP; setpoint = 200; @@ -151,7 +152,7 @@ else if(x == 's') { setpoint_mutex.lock(); - if (setpoint > -703) + if (setpoint > -560) { setpoint = -200; //setpoint = setpoint - SPEED_STEP; @@ -186,7 +187,11 @@ } position += dPosition; + //bluetooth.printf("\r\nPos: %d, dP: %d, dT: %d, Kp: %f, Ki: %f, vel: %d, e: %d", position, dPosition, dTime, Kp, Ki, vel, e); - bluetooth.printf("\r\nKp: %f, Ki: %f, vel: %d, e: %d", Kp, Ki, vel, e); + + bluetooth.printf("\r\ndP: %d, vel: %d, Kp: %f, Ki: %f, e: %d, xState: %d", dPosition, vel, Kp, Ki, e, xState); + + //bluetooth.printf("\r\ne: %d, Pos: %d, dP: %d, xState: %d, u: %d, dT: %d", e, position, dPosition, xState, u, dTime); }