-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into subaru_angle_meas
- Loading branch information
Showing
5 changed files
with
88 additions
and
18 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,13 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import time | ||
import re | ||
from panda import PandaJungle | ||
|
||
RED = '\033[91m' | ||
GREEN = '\033[92m' | ||
|
||
def colorize_errors(value): | ||
if isinstance(value, str): | ||
if re.search(r'(?i)No error', value): | ||
return f'{GREEN}{value}\033[0m' | ||
elif re.search(r'(?i)(?<!No error\s)(err|error)', value): | ||
return f'{RED}{value}\033[0m' | ||
return str(value) | ||
|
||
if __name__ == "__main__": | ||
jungle = PandaJungle() | ||
|
||
while True: | ||
print(chr(27) + "[2J") # clear screen | ||
print("Connected to " + ("internal panda" if jungle.is_internal() else "External panda") + f" id: {jungle.get_serial()[0]}: {jungle.get_version()}") | ||
for bus in range(3): | ||
print(bus, jungle.can_health(bus)) | ||
print(f"\nBus {bus}:") | ||
health = jungle.can_health(bus) | ||
for key, value in health.items(): | ||
print(f"{key}: {colorize_errors(value)} ", end=" ") | ||
print() | ||
time.sleep(1) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import random | ||
from panda import PandaJungle | ||
|
||
def get_test_string(): | ||
return b"test" + os.urandom(10) | ||
|
||
if __name__ == "__main__": | ||
p = PandaJungle() | ||
|
||
p.set_safety_mode(PandaJungle.SAFETY_ALLOUTPUT) | ||
|
||
print("Spamming all buses...") | ||
while True: | ||
at = random.randint(1, 2000) | ||
st = get_test_string()[0:8] | ||
bus = random.randint(0, 2) | ||
p.can_send(at, st, bus) | ||
# print("Sent message on bus: ", bus) |
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,29 @@ | ||
#!/usr/bin/env python3 | ||
import time | ||
import re | ||
from panda import Panda | ||
|
||
RED = '\033[91m' | ||
GREEN = '\033[92m' | ||
|
||
def colorize_errors(value): | ||
if isinstance(value, str): | ||
if re.search(r'(?i)No error', value): | ||
return f'{GREEN}{value}\033[0m' | ||
elif re.search(r'(?i)(?<!No error\s)(err|error)', value): | ||
return f'{RED}{value}\033[0m' | ||
return str(value) | ||
|
||
if __name__ == "__main__": | ||
|
||
panda = Panda() | ||
while True: | ||
print(chr(27) + "[2J") # clear screen | ||
print("Connected to " + ("internal panda" if panda.is_internal() else "External panda") + f" id: {panda.get_serial()[0]}: {panda.get_version()}") | ||
for bus in range(3): | ||
print(f"\nBus {bus}:") | ||
health = panda.can_health(bus) | ||
for key, value in health.items(): | ||
print(f"{key}: {colorize_errors(value)} ", end=" ") | ||
print() | ||
time.sleep(1) |
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