Files
StarPilot/panda/tests/hitl/test_7_internal.py
firestar5683 22a8575199 Vendor dependencies and resources for standalone builds
Keep official openpilot ancestry and dependency licenses. Store resources directly in Git, remove LFS setup requirements, and leave the downloadable big model outside the source tree.
2026-10-03 21:01:18 +00:00

44 lines
1.1 KiB
Python

import time
from panda.tests.hitl.base import PandaTestCase, panda_test
from panda import Panda
MAX_RPM = 5000
class TestInternal(PandaTestCase):
panda_types = Panda.INTERNAL_DEVICES
@panda_test(timeout=2*60)
def test_fan_curve(self):
p = self.p
# ensure fan curve is (roughly) linear
rpms = []
for power in (30, 70, 100):
# wait until fan spins up
p.set_fan_power(power)
for _ in range(20):
time.sleep(1)
if p.get_fan_rpm() > 1000:
break
time.sleep(2) # wait for RPM to converge
rpms.append(p.get_fan_rpm())
print(rpms)
diffs = [b - a for a, b in zip(rpms, rpms[1:])]
assert all(x > 0 for x in diffs), f"Fan RPMs not strictly increasing: {rpms=}"
assert rpms[-1] > (0.75*MAX_RPM)
def test_fan_cooldown(self):
p = self.p
# if the fan cooldown doesn't work, we get high frequency noise on the tach line
# while the rotor spins down. this makes sure it never goes beyond the expected max RPM
p.set_fan_power(100)
time.sleep(3)
p.set_fan_power(0)
for _ in range(5):
assert p.get_fan_rpm() <= MAX_RPM*2
time.sleep(0.5)