Files
StarPilot/selfdrive/debug/internal/mock_process/fake_trafficsignd.py
T
Shane Smiskol 682c866a55 initialize all messages in 1 line (#1206)
old-commit-hash: 6ff881f7894d0117099787e56ec0966bfc63fa7c
2020-03-05 17:32:52 -08:00

22 lines
572 B
Python
Executable File

#!/usr/bin/env python3
import zmq
import time
from cereal.services import service_list
import cereal.messaging as messaging
from cereal import log
def mock():
traffic_events = messaging.pub_sock('trafficEvents')
while 1:
m = messaging.new_message('trafficEvents', 1)
m.trafficEvents[0].type = log.TrafficEvent.Type.stopSign
m.trafficEvents[0].resuming = False
m.trafficEvents[0].distance = 100.
m.trafficEvents[0].action = log.TrafficEvent.Action.stop
traffic_events.send(m.to_bytes())
time.sleep(0.01)
if __name__=="__main__":
mock()