dragonpilot - 基於 openpilot 的開源駕駛輔助系統
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
504 B

#!/usr/bin/env python3
import numpy as np
from common.realtime import Ratekeeper
if __name__ == '__main__':
RATE = 123
print("measuring for 5 seconds at %dhz 3 times" % RATE)
rk = Ratekeeper(RATE, print_delay_threshold=None)
for _ in range(3):
pwrs = []
for _ in range(RATE*5):
with open("/sys/bus/i2c/devices/0-0040/hwmon/hwmon1/power1_input") as f:
pwrs.append(int(f.read()) / 1000.)
rk.keep_time()
print("mean %.2f std %.2f" % (np.mean(pwrs), np.std(pwrs)))