forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add primitive steer tuning script and json params (commaai#130)
* Pull Gernby tuning params into kegman.json & add cell phone Python tuner (commaai#126) * Add Gernby params to /data/kegman.json config file * Add Gernby params to JSON part 2 * Add Gernby "live" tuning thru /data/kegman.json * Fix missing " * == * float() * Add Gernby tuning Params into /data/kegman.json * Add Gernby live json tuning params to interface.py * Add tune.py and tune.sh primitive tuning script * Update planner.py (commaai#124) Improve Acceleration * Turn on tuneGernby to "1" when running tune.py * Fix kegman.conf for tuneGernby assignment * Write tuneGernby to JSON * Remove tuning code - cannot enable live from here * Extract live tuning params kegman_conf in latcontrol.py * Put live tune params into Latcontrol * self.live_tune call * remove e2front for now * Fix PL * don't pull from kegman.json every frame * mod 300 * mpc_frame init * Add KpV and KiV to live_tune * Update latcontrol.py * change tune vals to -1 to self-populate in latcontrol.py * add KpV and KiV * Update kegman_conf.py * Update kegman_conf.py * fix steerKf * write defaults to JSON * Update latcontrol.py * Update latcontrol.py * Update latcontrol.py * Change to Ki and Kp to avoid var conflict * Update kegman_conf.py * Fix retrieval of kegman json object in __init__ latcontrol.py * Fix quotes around "-1" values in JSON * Ki and Kp in tune.py instead of KiV and KpV * Comment out __init__ kegman_conf write troubleshoot * Update latcontrol.py * convert kP and kI into arrays? * Update latcontrol.py * convert array back into string before writing kP and kI * Round kI and kP to 2 decimal places * Press space for next, M for previous element, add 1 and 0 * Remap keys * Fix indent * Update tune.py * Update tune.py * d g j instead of e t u
- Loading branch information
kegman
authored
Mar 10, 2019
1 parent
fe0388f
commit b1f39cb
Showing
6 changed files
with
182 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
from selfdrive.kegman_conf import kegman_conf | ||
|
||
letters = { "a":[ "###", "# #", "###", "# #", "# #"], "b":[ "###", "# #", "###", "# #", "###"], "c":[ "###", "#", "#", "#", "###"], "d":[ "##", "# #", "# #", "# #", "##"], "e":[ "###", "#", "###", "#", "###"], "f":[ "###", "#", "###", "#", "#"], "g":[ "###", "# #", "###", " #", "###"], "h":[ "# #", "# #", "###", "# #", "# #"], "i":[ "###", " #", " #", " #", "###"], "j":[ "###", " #", " #", " #", "##"], "k":[ "# #", "##", "#", "##", "# #"], "l":[ "#", "#", "#", "#", "###"], "m":[ "# #", "###", "###", "# #", "# #"], "n":[ "###", "# #", "# #", "# #", "# #"], "o":[ "###", "# #", "# #", "# #", "###"], "p":[ "###", "# #", "###", "#", "#"], "q":[ "###", "# #", "###", " #", " #"], "r":[ "###", "# #", "##", "# #", "# #"], "s":[ "###", "#", "###", " #", "###"], "t":[ "###", " #", " #", " #", " #"], "u":[ "# #", "# #", "# #", "# #", "###"], "v":[ "# #", "# #", "# #", "# #", " #"], "w":[ "# #", "# #", "# #", "###", "###"], "x":[ "# #", " #", " #", " #", "# #"], "y":[ "# #", "# #", "###", " #", "###"], "z":[ "###", " #", " #", "#", "###"], " ":[ " "], "1":[ " #", "##", " #", " #", "###"], "2":[ "###", " #", "###", "#", "###"], "3":[ "###", " #", "###", " #", "###"], "4":[ "#", "#", "# #", "###", " #"], "5":[ "###", "#", "###", " #", "###"], "6":[ "###", "#", "###", "# #", "###"], "7":[ "###", " # ", " #", " #", "#"], "8":[ "###", "# #", "###", "# #", "###"], "9":[ "###", "# #", "###", " #", "###"], "0":[ "###", "# #", "# #", "# #", "###"], "!":[ " # ", " # ", " # ", " ", " # "], "?":[ "###", " #", " ##", " ", " # "], ".":[ " ", " ", " ", " ", " # "], "]":[ " ", " ", " ", " #", " # "], "/":[ " #", " #", " # ", "# ", "# "], ":":[ " ", " # ", " ", " # ", " "], "@":[ "###", "# #", "## ", "# ", "###"], "'":[ " # ", " # ", " ", " ", " "], "#":[ " # ", "###", " # ", "###", " # "], "-":[ " ", " ","###"," "," "] } | ||
# letters stolen from here: http://www.stuffaboutcode.com/2013/08/raspberry-pi-minecraft-twitter.html | ||
|
||
def print_letters(text): | ||
bigletters = [] | ||
for i in text: | ||
bigletters.append(letters.get(i.lower(),letters[' '])) | ||
output = ['']*5 | ||
for i in range(5): | ||
for j in bigletters: | ||
temp = ' ' | ||
try: | ||
temp = j[i] | ||
except: | ||
pass | ||
temp += ' '*(5-len(temp)) | ||
temp = temp.replace(' ',' ') | ||
temp = temp.replace('#','@') | ||
output[i] += temp | ||
return '\n'.join(output) | ||
import sys, termios, tty, os, time | ||
|
||
def getch(): | ||
fd = sys.stdin.fileno() | ||
old_settings = termios.tcgetattr(fd) | ||
try: | ||
tty.setraw(sys.stdin.fileno()) | ||
ch = sys.stdin.read(1) | ||
|
||
finally: | ||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) | ||
return ch | ||
|
||
button_delay = 0.2 | ||
|
||
kegman = kegman_conf() | ||
#kegman.conf['tuneGernby'] = "1" | ||
#kegman.write_config(kegman.conf) | ||
param = ["tuneGernby", "react", "damp", "resist", "Kp", "Ki"] | ||
|
||
j = 0 | ||
while True: | ||
print "" | ||
print "" | ||
print print_letters(param[j]) | ||
print "" | ||
print print_letters(kegman.conf[param[j]]) | ||
print "" | ||
print ("Press 7, 5, 3 to increase by 0.1, 0.05, 0.01") | ||
print ("press d, g, j to decrease by 0.1, 0.05, 0.01") | ||
print ("press 0 to make the value 0") | ||
print ("press 1 to make the value 1") | ||
print ("press SPACE for next parameter") | ||
print ("press m for previous parameter") | ||
print ("press q to quit") | ||
|
||
char = getch() | ||
if (char == "7"): | ||
kegman.conf[param[j]] = str(float(kegman.conf[param[j]]) + 0.01) | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == "5"): | ||
kegman.conf[param[j]] = str(float(kegman.conf[param[j]]) + 0.05) | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == "3"): | ||
kegman.conf[param[j]] = str(float(kegman.conf[param[j]]) + 0.1) | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == "j"): | ||
kegman.conf[param[j]] = str(float(kegman.conf[param[j]]) - 0.01) | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == "g"): | ||
kegman.conf[param[j]] = str(float(kegman.conf[param[j]]) - 0.05) | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == "d"): | ||
kegman.conf[param[j]] = str(float(kegman.conf[param[j]]) - 0.1) | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == "0"): | ||
kegman.conf[param[j]] = "0" | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == "1"): | ||
kegman.conf[param[j]] = "1" | ||
kegman.write_config(kegman.conf) | ||
time.sleep(button_delay) | ||
|
||
elif (char == " "): | ||
if j < len(param) - 1: | ||
j = j + 1 | ||
else: | ||
j = 0 | ||
|
||
elif (char == "m"): | ||
if j > 0: | ||
j = j - 1 | ||
else: | ||
j = len(param) - 1 | ||
|
||
elif (char == "q"): | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python2.7 tune.py |