From deecaf4b457b39bfe57e3de3e9daa69a7a8aaf9b Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Fri, 24 Apr 2020 14:12:14 -0700 Subject: [PATCH] fake processes that are not used old-commit-hash: ca690e6ff9113279bd0a8f98164fff0b4230019b --- .../mock_process/fake_UiNavigationEvent.py | 20 --------- .../mock_process/fake_controls_state.py | 21 --------- .../mock_process/fake_fusion_state.py | 26 ----------- .../debug/internal/mock_process/fake_gps.py | 45 ------------------- .../mock_process/fake_gps_external.py | 26 ----------- .../internal/mock_process/fake_liveMpc.py | 21 --------- .../mock_process/fake_trafficsignd.py | 21 --------- 7 files changed, 180 deletions(-) delete mode 100755 selfdrive/debug/internal/mock_process/fake_UiNavigationEvent.py delete mode 100755 selfdrive/debug/internal/mock_process/fake_controls_state.py delete mode 100755 selfdrive/debug/internal/mock_process/fake_fusion_state.py delete mode 100755 selfdrive/debug/internal/mock_process/fake_gps.py delete mode 100755 selfdrive/debug/internal/mock_process/fake_gps_external.py delete mode 100755 selfdrive/debug/internal/mock_process/fake_liveMpc.py delete mode 100755 selfdrive/debug/internal/mock_process/fake_trafficsignd.py diff --git a/selfdrive/debug/internal/mock_process/fake_UiNavigationEvent.py b/selfdrive/debug/internal/mock_process/fake_UiNavigationEvent.py deleted file mode 100755 index ac4ce168c8..0000000000 --- a/selfdrive/debug/internal/mock_process/fake_UiNavigationEvent.py +++ /dev/null @@ -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() diff --git a/selfdrive/debug/internal/mock_process/fake_controls_state.py b/selfdrive/debug/internal/mock_process/fake_controls_state.py deleted file mode 100755 index 2cc9a9cb89..0000000000 --- a/selfdrive/debug/internal/mock_process/fake_controls_state.py +++ /dev/null @@ -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() diff --git a/selfdrive/debug/internal/mock_process/fake_fusion_state.py b/selfdrive/debug/internal/mock_process/fake_fusion_state.py deleted file mode 100755 index f4c61e99d1..0000000000 --- a/selfdrive/debug/internal/mock_process/fake_fusion_state.py +++ /dev/null @@ -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() diff --git a/selfdrive/debug/internal/mock_process/fake_gps.py b/selfdrive/debug/internal/mock_process/fake_gps.py deleted file mode 100755 index b3a23ba6e3..0000000000 --- a/selfdrive/debug/internal/mock_process/fake_gps.py +++ /dev/null @@ -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) - diff --git a/selfdrive/debug/internal/mock_process/fake_gps_external.py b/selfdrive/debug/internal/mock_process/fake_gps_external.py deleted file mode 100755 index 33dae6d510..0000000000 --- a/selfdrive/debug/internal/mock_process/fake_gps_external.py +++ /dev/null @@ -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) diff --git a/selfdrive/debug/internal/mock_process/fake_liveMpc.py b/selfdrive/debug/internal/mock_process/fake_liveMpc.py deleted file mode 100755 index f7471b1aef..0000000000 --- a/selfdrive/debug/internal/mock_process/fake_liveMpc.py +++ /dev/null @@ -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() diff --git a/selfdrive/debug/internal/mock_process/fake_trafficsignd.py b/selfdrive/debug/internal/mock_process/fake_trafficsignd.py deleted file mode 100755 index 4562e1fcd1..0000000000 --- a/selfdrive/debug/internal/mock_process/fake_trafficsignd.py +++ /dev/null @@ -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()