forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added conversion constants * implemented std unit conversion * changed centerToFront ratio Changed weight distribution ratios used to calc center of gravity distances to align closer to manufacturer specs * implemented std unit conversion * remove unused conversion * reverted wheelbase conversion slight change to pilot wheelbase * removed redundant conversion * removed incorrect/unused conversion * removed class that now exists in honda/values.py * redirect Cruisebuttons call * redirect Cruisebuttons call * Update interface.py * Update numpy_fast.py Refactor * Update numpy_fast.py * Update numpy_fast.py -encapsulated get_interp -reduced calls to len() for iterable input
- Loading branch information
Showing
7 changed files
with
27 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,18 @@ | ||
def int_rnd(x): | ||
return int(round(x)) | ||
|
||
|
||
def clip(x, lo, hi): | ||
return max(lo, min(hi, x)) | ||
|
||
|
||
def interp(x, xp, fp): | ||
N = len(xp) | ||
if not hasattr(x, '__iter__'): | ||
hi = 0 | ||
while hi < N and x > xp[hi]: | ||
hi += 1 | ||
low = hi - 1 | ||
return fp[-1] if hi == N and x > xp[low] else ( | ||
fp[0] if hi == 0 else | ||
(x - xp[low]) * (fp[hi] - fp[low]) / (xp[hi] - xp[low]) + fp[low]) | ||
|
||
result = [] | ||
for v in x: | ||
def get_interp(xv): | ||
hi = 0 | ||
while hi < N and v > xp[hi]: | ||
while hi < N and xv > xp[hi]: | ||
hi += 1 | ||
low = hi - 1 | ||
result.append(fp[-1] if hi == N and v > xp[low] else (fp[ | ||
0] if hi == 0 else (v - xp[low]) * (fp[hi] - fp[low]) / (xp[hi] - xp[low] | ||
) + fp[low])) | ||
return result | ||
return fp[-1] if hi == N and xv > xp[low] else ( | ||
fp[0] if hi == 0 else | ||
(xv - xp[low]) * (fp[hi] - fp[low]) / (xp[hi] - xp[low]) + fp[low]) | ||
return [get_interp(v) for v in x] if hasattr( | ||
x, '__iter__') else get_interp(x) |
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
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