ObjectFollower
Dependencies: TPixy-Interface
Fork of PlayBack by
Diff: ui.cpp
- Revision:
- 18:db6d9fc1ebd0
- Parent:
- 17:1184df616383
- Child:
- 19:4fbffc755ed7
--- a/ui.cpp Sun Mar 11 01:26:23 2018 +0000 +++ b/ui.cpp Tue Mar 13 22:14:24 2018 +0000 @@ -35,9 +35,9 @@ /****************************************************************************** - User interface 3 + User interface 3 Camera ******************************************************************************/ -void consoleUI(void){ +void consoleUIcamera(void){ cameraData_mutex.lock(); bluetooth.printf("\r\nsetpointR: %d setpointL: %d ObjectWidth: %d ObjectXcoordinate: %d SteeringError: %d DistanceError: %d", setpointR, setpointL, ObjectWidth, xR, SteeringError, DistanceError); @@ -267,9 +267,8 @@ User interface 3 - manual control ******************************************************************************/ -void consoleUIManualControl(void) +void consoleUI(void) { - if (bluetooth.readable()) { x = bluetooth.getc(); @@ -287,7 +286,7 @@ // by incrementing u else if(x == 'w') { mutexSetpoint.lock(); - Setpoint = Setpoint + 100; + Setpoint = 100; mutexSetpoint.unlock(); } @@ -296,22 +295,22 @@ // by decrementing u else if(x == 's') { mutexSetpoint.lock(); - Setpoint = Setpoint - 100; + Setpoint = -100; mutexSetpoint.unlock(); } /******************************ROBOT STEERING**********************************/ + else if (x=='a') + { + mutexSetpoint.lock(); + SteeringError = 300; + mutexSetpoint.unlock(); + } else if (x=='d') { mutexSetpoint.lock(); - SteeringError = SteeringError + 10; - mutexSetpoint.unlock(); - } - else if (x=='a') - { - mutexSetpoint.lock(); - SteeringError = SteeringError - 10; + SteeringError = -300; mutexSetpoint.unlock(); } // error wrong input @@ -319,9 +318,11 @@ bluetooth.printf("\r\nwrong input please enter \'w\' to increase the speed, \'s\' to reduce it or move in the opposite direction and \'r\' to reset the watchdog"); } } - - // If no key is pressed stop the robot. - Setpoint = 0; - SteeringError = 0; + else{ + // If no key is pressed stop the robot. + Setpoint = 0; + SteeringError = 0; + + } }