fake processes that are not used

old-commit-hash: ca690e6ff9
commatwo_master
Willem Melching 5 years ago
parent 17d28e3ffc
commit deecaf4b45
  1. 20
      selfdrive/debug/internal/mock_process/fake_UiNavigationEvent.py
  2. 21
      selfdrive/debug/internal/mock_process/fake_controls_state.py
  3. 26
      selfdrive/debug/internal/mock_process/fake_fusion_state.py
  4. 45
      selfdrive/debug/internal/mock_process/fake_gps.py
  5. 26
      selfdrive/debug/internal/mock_process/fake_gps_external.py
  6. 21
      selfdrive/debug/internal/mock_process/fake_liveMpc.py
  7. 21
      selfdrive/debug/internal/mock_process/fake_trafficsignd.py

@ -1,20 +0,0 @@
#!/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('uiNavigationEvent')
while 1:
m = messaging.new_message('uiNavigationEvent')
m.uiNavigationEvent.type = log.UiNavigationEvent.Type.mergeRight
m.uiNavigationEvent.status = log.UiNavigationEvent.Status.active
m.uiNavigationEvent.distanceTo = 100.
traffic_events.send(m.to_bytes())
time.sleep(0.01)
if __name__=="__main__":
mock()

@ -1,21 +0,0 @@
#!/usr/bin/env python3
import time
import zmq
from hexdump import hexdump
from common.realtime import Ratekeeper
import cereal.messaging as messaging
from cereal.services import service_list
if __name__ == "__main__":
controls_state = messaging.pub_sock('controlsState')
rk = Ratekeeper(100)
while 1:
dat = messaging.new_message('controlsState')
dat.controlsState.vEgo = 25.
dat.controlsState.enabled = True
controls_state.send(dat.to_bytes())
rk.keep_time()

@ -1,26 +0,0 @@
#!/usr/bin/env python3
import zmq
import time
from hexdump import hexdump
import cereal.messaging as messaging
from cereal.services import service_list
from cereal import log
def leadRange(start, end, step):
x = start
while x < end:
yield x
x += (x * step)
def mock_lead():
radarState = messaging.pub_sock('radarState')
while 1:
m = messaging.new_message('radarState')
m.radarState.leadOne.status = True
for x in leadRange(3.0, 65.0, 0.005):
m.radarState.leadOne.dRel = x
radarState.send(m.to_bytes())
time.sleep(0.01)
if __name__=="__main__":
mock_lead()

@ -1,45 +0,0 @@
# mock_gps.py: Publishes a generated path moving at 15m/s to gpsLocation
# USAGE: python mock_gps.py
# Then start manager
from itertools import cycle
import time
import zmq
from cereal import log
import cereal.messaging as messaging
from cereal.services import service_list
degrees_per_meter = 0.000009000009 # approximation
start_lat = 43.64199141443989
start_lng = -94.97520411931725
def gen_path(length_seconds, speed=15):
return [{"lat": start_lat,
"lng": start_lng + speed * i * degrees_per_meter, # moving along longitudinal axis at speed m/s
"speed": speed}
for i in range(1, length_seconds + 1)]
if __name__ == '__main__':
gpsLocation = messaging.pub_sock('gpsLocation')
path_stopped_5s = [{"lat": start_lat, "lng": start_lng, "speed": 0}] * 5
path_moving = gen_path(30, speed=15)
path_stopped_5s_then_moving = path_stopped_5s + path_moving
for point in cycle(path_stopped_5s_then_moving):
print('sending gpsLocation from point: {}'.format(str(point)))
dat = messaging.new_message('gpsLocation')
dat.gpsLocation.latitude = point['lat']
dat.gpsLocation.longitude = point['lng']
dat.gpsLocation.speed = point['speed']
dat.gpsLocation.flags = 0
dat.gpsLocation.altitude = 0
dat.gpsLocation.bearing = 0 # todo we can mock this
dat.gpsLocation.accuracy = 1
dat.gpsLocation.timestamp = int(time.time() * 1000)
dat.gpsLocation.source = log.GpsLocationData.SensorSource.android
gpsLocation.send(dat.to_bytes())
time.sleep(1)

@ -1,26 +0,0 @@
#!/usr/bin/env python3
import time
import zmq
from cereal import log
import cereal.messaging as messaging
from cereal.services import service_list
if __name__ == '__main__':
gpsLocationExternal = messaging.pub_sock('gpsLocationExternal')
while True:
dat = messaging.new_message('gpsLocationExternal')
dat.gpsLocationExternal.latitude = 37.6513687
dat.gpsLocationExternal.longitude = -122.4535056
dat.gpsLocationExternal.speed = 28.2
dat.gpsLocationExternal.flags = 1
dat.gpsLocationExternal.altitude = 75.
dat.gpsLocationExternal.bearing = 145.5
dat.gpsLocationExternal.accuracy = 1.
dat.gpsLocationExternal.timestamp = int(time.time() * 1000)
dat.gpsLocationExternal.source = log.GpsLocationData.SensorSource.ublox
gpsLocationExternal.send(dat.to_bytes())
time.sleep(.1)

@ -1,21 +0,0 @@
#!/usr/bin/env python3
import zmq
import time
from hexdump import hexdump
import cereal.messaging as messaging
from cereal.services import service_list
from cereal import log
def mock_x():
liveMpc = messaging.pub_sock('liveMpc')
while 1:
m = messaging.new_message('liveMpc')
mx = []
for x in range(0, 100):
mx.append(x*1.0)
m.liveMpc.x = mx
liveMpc.send(m.to_bytes())
if __name__=="__main__":
mock_x()

@ -1,21 +0,0 @@
#!/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()
Loading…
Cancel
Save