Prints all the key-bindings between the keys and the GoPiGo3/LineFollower's commands on the screen.
()
| 23 | print("Press on the appropriate keys to tune the PID parameters for the line follower.\n") |
| 24 | |
| 25 | def drawMenu(): |
| 26 | """ |
| 27 | Prints all the key-bindings between the keys and the GoPiGo3/LineFollower's commands on the screen. |
| 28 | """ |
| 29 | keybindings = { |
| 30 | "<ESC>" : "Exit", |
| 31 | "x" : "Move the GoPiGo3 forward", |
| 32 | "<SPACE>" : "Stop the GoPiGo3 from moving", |
| 33 | "1" : "Increase loop frequency", |
| 34 | "2" : "Decrease loop frequency", |
| 35 | "3" : "Increase GoPiGo3 speed", |
| 36 | "4" : "Decrease GoPiGo3 speed", |
| 37 | "u" : "Increase the Kp gain", |
| 38 | "j" : "Increase the Ki gain", |
| 39 | "n" : "Increase the Kd gain", |
| 40 | "i" : "Decrease the Kp gain", |
| 41 | "k" : "Decrease the Ki gain", |
| 42 | "m" : "Decrease the Kd gain", |
| 43 | "r" : "Reset integral area for Ki gain to 0.0", |
| 44 | "w" : "Calibrate the line follower on a white surface", |
| 45 | "b" : "Calibrate the line follower on a black surface" |
| 46 | } |
| 47 | |
| 48 | order_of_keys = ["<ESC>", "x", "<SPACE>", "1", "2", "3", "4", "u", "j", "n", "i", "k", "m", "r", "w", "b"] |
| 49 | try: |
| 50 | for key in order_of_keys: |
| 51 | print("\r[key {:8}] : {}".format(key, keybindings[key])) |
| 52 | except KeyError: |
| 53 | print("Error: Keys found in order_of_keys don't match with those in keybindings.") |
| 54 | print() |
| 55 | |
| 56 | stopper = Event() |
| 57 |