Files
dragonpilot/selfdrive/services.py

21 lines
535 B
Python
Raw Normal View History

2017-05-11 12:41:17 -07:00
import os
import yaml
2019-10-09 18:43:53 +00:00
class Service():
def __init__(self, port, should_log, frequency, decimation=None):
2017-05-11 12:41:17 -07:00
self.port = port
self.should_log = should_log
2019-06-28 21:11:30 +00:00
self.frequency = frequency
2019-10-09 18:43:53 +00:00
self.decimation = decimation
2017-05-11 12:41:17 -07:00
service_list_path = os.path.join(os.path.dirname(__file__), "service_list.yaml")
service_list = {}
with open(service_list_path, "r") as f:
2019-06-28 21:11:30 +00:00
for k, v in yaml.safe_load(f).items():
2019-10-09 18:43:53 +00:00
decimation = None
if len(v) == 4:
decimation = v[3]
service_list[k] = Service(v[0], v[1], v[2], decimation)