mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-03 04:22:09 +08:00
sim: send peripheralState message (#22541)
* controlsd: ignore peripheralState for Simulation * controlsd: use fake peripheralState for Simulation * controlsd: use fake peripheralState for Simulation * controlsd: use fake peripheralState for Simulation * Apply suggestions from code review * sim: send peripheralState message * sim: send peripheralState message * sim: send peripheralState message * sim: send peripheralState message Co-authored-by: wolffja <wolffja@ubuntu20.04LTS> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: 26c5e7b826cc04e301e3c8c50884582f05e27ceb
This commit is contained in:
@@ -97,6 +97,21 @@ def panda_state_function(exit_event: threading.Event):
|
||||
pm.send('pandaStates', dat)
|
||||
time.sleep(0.5)
|
||||
|
||||
def peripheral_state_function(exit_event: threading.Event):
|
||||
pm = messaging.PubMaster(['peripheralState'])
|
||||
while not exit_event.is_set():
|
||||
dat = messaging.new_message('peripheralState')
|
||||
dat.valid = True
|
||||
# fake peripheral state data
|
||||
dat.peripheralState = {
|
||||
'pandaType': log.PandaState.PandaType.blackPanda,
|
||||
'voltage': 12000,
|
||||
'current': 5678,
|
||||
'fanSpeedRpm': 1000
|
||||
}
|
||||
pm.send('peripheralState', dat)
|
||||
time.sleep(0.5)
|
||||
|
||||
def gps_callback(gps, vehicle_state):
|
||||
dat = messaging.new_message('gpsLocationExternal')
|
||||
|
||||
@@ -215,6 +230,7 @@ def bridge(q):
|
||||
threads = []
|
||||
exit_event = threading.Event()
|
||||
threads.append(threading.Thread(target=panda_state_function, args=(exit_event,)))
|
||||
threads.append(threading.Thread(target=peripheral_state_function, args=(exit_event,)))
|
||||
threads.append(threading.Thread(target=fake_driver_monitoring, args=(exit_event,)))
|
||||
threads.append(threading.Thread(target=can_function_runner, args=(vehicle_state, exit_event,)))
|
||||
for t in threads:
|
||||
|
||||
Reference in New Issue
Block a user