enable flake8 E303: too many blank lines

pull/1615/head
Adeeb Shihadeh 2020-05-31 17:18:08 -07:00
parent b86460c28e
commit f3dcf861c7
52 changed files with 4 additions and 84 deletions

View File

@ -17,7 +17,7 @@ repos:
- id: flake8 - id: flake8
exclude: '^(pyextra)|(external)|(cereal)|(rednose)|(panda)|(laika)|(laika_repo)|(rednose_repo)/' exclude: '^(pyextra)|(external)|(cereal)|(rednose)|(panda)|(laika)|(laika_repo)|(rednose_repo)/'
args: args:
- --ignore=E111,E114,E121,E122,E123,E124,E126,E127,E128,E201,E202,E203,E226,E241,E251,E265,E266,E302,E303,E305,E402,E501,E502,E722,E741,W504 - --ignore=E111,E114,E121,E122,E123,E124,E126,E127,E128,E201,E202,E203,E226,E241,E251,E265,E266,E302,E305,E402,E501,E502,E722,E741,W504
- --statistics - --statistics
- repo: local - repo: local
hooks: hooks:

2
cereal

@ -1 +1 @@
Subproject commit 76eb23e062679058025369204f4e9a81ea7d479b Subproject commit b25a7d6f6e4dc923f1ee1fd5ea13d6e12100341e

View File

@ -50,7 +50,6 @@ class TestSimpleKalman(unittest.TestCase):
self.assertAlmostEqual(x_old[0], x[0]) self.assertAlmostEqual(x_old[0], x[0])
self.assertAlmostEqual(x_old[1], x[1]) self.assertAlmostEqual(x_old[1], x[1])
def test_new_is_faster(self): def test_new_is_faster(self):
setup = """ setup = """
import numpy as np import numpy as np

View File

@ -5,7 +5,6 @@ with each row as a position.
""" """
a = 6378137 a = 6378137
b = 6356752.3142 b = 6356752.3142
esq = 6.69437999014 * 0.001 esq = 6.69437999014 * 0.001
@ -91,7 +90,6 @@ class LocalCoord():
init_geodetic = ecef2geodetic(init_ecef) init_geodetic = ecef2geodetic(init_ecef)
return LocalCoord(init_geodetic, init_ecef) return LocalCoord(init_geodetic, init_ecef)
def ecef2ned(self, ecef): def ecef2ned(self, ecef):
ecef = np.array(ecef) ecef = np.array(ecef)
return np.dot(self.ecef2ned_matrix, (ecef - self.init_ecef).T).T return np.dot(self.ecef2ned_matrix, (ecef - self.init_ecef).T).T

View File

@ -132,10 +132,6 @@ rot_from_euler = euler2rot
quat_from_euler = euler2quat quat_from_euler = euler2quat
''' '''
Random helpers below Random helpers below
''' '''

View File

@ -50,7 +50,6 @@ ned_offsets_batch = np.array([[ 53.88103168, 43.83445935, -46.27488057],
[ 78.56272609, 18.53100158, -43.25290759]]) [ 78.56272609, 18.53100158, -43.25290759]])
class TestNED(unittest.TestCase): class TestNED(unittest.TestCase):
def test_small_distances(self): def test_small_distances(self):
start_geodetic = np.array([33.8042184, -117.888593, 0.0]) start_geodetic = np.array([33.8042184, -117.888593, 0.0])
@ -83,8 +82,6 @@ class TestNED(unittest.TestCase):
np.testing.assert_allclose(geodetic_positions_radians[:, :2], coord.ecef2geodetic(ecef_positions, radians=True)[:, :2], rtol=1e-7) np.testing.assert_allclose(geodetic_positions_radians[:, :2], coord.ecef2geodetic(ecef_positions, radians=True)[:, :2], rtol=1e-7)
np.testing.assert_allclose(geodetic_positions_radians[:, 2], coord.ecef2geodetic(ecef_positions, radians=True)[:, 2], rtol=1e-7, atol=1e-4) np.testing.assert_allclose(geodetic_positions_radians[:, 2], coord.ecef2geodetic(ecef_positions, radians=True)[:, 2], rtol=1e-7, atol=1e-4)
def test_ned(self): def test_ned(self):
for ecef_pos in ecef_positions: for ecef_pos in ecef_positions:
converter = coord.LocalCoord.from_ecef(ecef_pos) converter = coord.LocalCoord.from_ecef(ecef_pos)
@ -99,7 +96,6 @@ class TestNED(unittest.TestCase):
np.testing.assert_allclose(geo_pos_moved[:2], geo_pos_double_converted_moved[:2], rtol=1e-9, atol=1e-6) np.testing.assert_allclose(geo_pos_moved[:2], geo_pos_double_converted_moved[:2], rtol=1e-9, atol=1e-6)
np.testing.assert_allclose(geo_pos_moved[2], geo_pos_double_converted_moved[2], rtol=1e-9, atol=1e-4) np.testing.assert_allclose(geo_pos_moved[2], geo_pos_double_converted_moved[2], rtol=1e-9, atol=1e-4)
def test_ned_saved_results(self): def test_ned_saved_results(self):
for i, ecef_pos in enumerate(ecef_positions): for i, ecef_pos in enumerate(ecef_positions):
converter = coord.LocalCoord.from_ecef(ecef_pos) converter = coord.LocalCoord.from_ecef(ecef_pos)

View File

@ -64,6 +64,5 @@ class TestOrientation(unittest.TestCase):
np.testing.assert_allclose(ned_eulers, ned_euler_from_ecef(ecef_positions, eulers), rtol=1e-7) np.testing.assert_allclose(ned_eulers, ned_euler_from_ecef(ecef_positions, eulers), rtol=1e-7)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View File

@ -77,7 +77,6 @@ class URLFile(object):
if response_code != 206 and response_code != 200: if response_code != 206 and response_code != 200:
raise Exception("Error {} ({}): {}".format(response_code, self._url, repr(dats.getvalue())[:500])) raise Exception("Error {} ({}): {}".format(response_code, self._url, repr(dats.getvalue())[:500]))
ret = dats.getvalue() ret = dats.getvalue()
self._pos += len(ret) self._pos += len(ret)
return ret return ret

View File

@ -23,7 +23,6 @@ class Window():
pygame.surfarray.blit_array(self.screen, out.swapaxes(0, 1)) pygame.surfarray.blit_array(self.screen, out.swapaxes(0, 1))
pygame.display.flip() pygame.display.flip()
def getkey(self): def getkey(self):
while 1: while 1:
event = pygame.event.wait() event = pygame.event.wait()

View File

@ -220,11 +220,9 @@ class AdbHelper(object):
self.adb_path = adb_path self.adb_path = adb_path
self.enable_switch_to_root = enable_switch_to_root self.enable_switch_to_root = enable_switch_to_root
def run(self, adb_args): def run(self, adb_args):
return self.run_and_return_output(adb_args)[0] return self.run_and_return_output(adb_args)[0]
def run_and_return_output(self, adb_args, stdout_file=None, log_output=True): def run_and_return_output(self, adb_args, stdout_file=None, log_output=True):
adb_args = [self.adb_path] + adb_args adb_args = [self.adb_path] + adb_args
log_debug('run adb cmd: %s' % adb_args) log_debug('run adb cmd: %s' % adb_args)
@ -247,14 +245,12 @@ class AdbHelper(object):
def check_run(self, adb_args): def check_run(self, adb_args):
self.check_run_and_return_output(adb_args) self.check_run_and_return_output(adb_args)
def check_run_and_return_output(self, adb_args, stdout_file=None, log_output=True): def check_run_and_return_output(self, adb_args, stdout_file=None, log_output=True):
result, stdoutdata = self.run_and_return_output(adb_args, stdout_file, log_output) result, stdoutdata = self.run_and_return_output(adb_args, stdout_file, log_output)
if not result: if not result:
log_exit('run "adb %s" failed' % adb_args) log_exit('run "adb %s" failed' % adb_args)
return stdoutdata return stdoutdata
def _unroot(self): def _unroot(self):
result, stdoutdata = self.run_and_return_output(['shell', 'whoami']) result, stdoutdata = self.run_and_return_output(['shell', 'whoami'])
if not result: if not result:
@ -266,7 +262,6 @@ class AdbHelper(object):
self.run(['wait-for-device']) self.run(['wait-for-device'])
time.sleep(1) time.sleep(1)
def switch_to_root(self): def switch_to_root(self):
if not self.enable_switch_to_root: if not self.enable_switch_to_root:
self._unroot() self._unroot()
@ -292,7 +287,6 @@ class AdbHelper(object):
def set_property(self, name, value): def set_property(self, name, value):
return self.run(['shell', 'setprop', name, value]) return self.run(['shell', 'setprop', name, value])
def get_device_arch(self): def get_device_arch(self):
output = self.check_run_and_return_output(['shell', 'uname', '-m']) output = self.check_run_and_return_output(['shell', 'uname', '-m'])
if 'aarch64' in output: if 'aarch64' in output:
@ -305,7 +299,6 @@ class AdbHelper(object):
return 'x86' return 'x86'
log_fatal('unsupported architecture: %s' % output.strip()) log_fatal('unsupported architecture: %s' % output.strip())
def get_android_version(self): def get_android_version(self):
build_version = self.get_property('ro.build.version.release') build_version = self.get_property('ro.build.version.release')
android_version = 0 android_version = 0

@ -1 +1 @@
Subproject commit d0872aa16155e8f73961d52952c8cef41d5702d4 Subproject commit 4d9df5eb0994523d8061358e0210ca6e6a473e48

2
panda

@ -1 +1 @@
Subproject commit 9102c16118171597abf6cb7b9dee99b557f7eee7 Subproject commit 275e76c2b2f9206c82990fe7ba0a6a96ecb8a0bc

View File

@ -56,7 +56,6 @@ if __name__ == "__main__":
serials = Panda.list() serials = Panda.list()
num_senders = len(serials) num_senders = len(serials)
if num_senders == 0: if num_senders == 0:
print("No senders found. Exiting") print("No senders found. Exiting")
sys.exit(1) sys.exit(1)

View File

@ -17,7 +17,6 @@ class CarController():
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
def update(self, enabled, CS, actuators, pcm_cancel_cmd, hud_alert): def update(self, enabled, CS, actuators, pcm_cancel_cmd, hud_alert):
# this seems needed to avoid steering faults and to force the sync with the EPS counter # this seems needed to avoid steering faults and to force the sync with the EPS counter
frame = CS.lkas_counter frame = CS.lkas_counter

View File

@ -8,7 +8,6 @@ VisualAlert = car.CarControl.HUDControl.VisualAlert
GearShifter = car.CarState.GearShifter GearShifter = car.CarState.GearShifter
class TestChryslerCan(unittest.TestCase): class TestChryslerCan(unittest.TestCase):
def test_hud(self): def test_hud(self):

View File

@ -10,7 +10,6 @@ class SteerLimitParams:
STEER_ERROR_MAX = 80 STEER_ERROR_MAX = 80
class CAR: class CAR:
PACIFICA_2017_HYBRID = "CHRYSLER PACIFICA HYBRID 2017" PACIFICA_2017_HYBRID = "CHRYSLER PACIFICA HYBRID 2017"
PACIFICA_2018_HYBRID = "CHRYSLER PACIFICA HYBRID 2018" PACIFICA_2018_HYBRID = "CHRYSLER PACIFICA HYBRID 2018"

View File

@ -34,7 +34,6 @@ class RadarInterface(RadarInterfaceBase):
if self.trigger_msg not in self.updated_messages: if self.trigger_msg not in self.updated_messages:
return None return None
ret = car.RadarData.new_message() ret = car.RadarData.new_message()
errors = [] errors = []
if not self.rcp.can_valid: if not self.rcp.can_valid:

View File

@ -339,7 +339,6 @@ class CarState(CarStateBase):
("FCM_PROBLEM", "ACC_HUD", 0), ("FCM_PROBLEM", "ACC_HUD", 0),
("ICONS", "ACC_HUD", 0)] ("ICONS", "ACC_HUD", 0)]
# all hondas except CRV, RDX and 2019 Odyssey@China use 0xe4 for steering # all hondas except CRV, RDX and 2019 Odyssey@China use 0xe4 for steering
checks = [(0xe4, 100)] checks = [(0xe4, 100)]
if CP.carFingerprint in [CAR.CRV, CAR.CRV_EU, CAR.ACURA_RDX, CAR.ODYSSEY_CHN]: if CP.carFingerprint in [CAR.CRV, CAR.CRV_EU, CAR.ACURA_RDX, CAR.ODYSSEY_CHN]:

View File

@ -387,7 +387,6 @@ class CarInterface(CarInterfaceBase):
ret.longitudinalTuning.kiBP = [0., 35.] ret.longitudinalTuning.kiBP = [0., 35.]
ret.longitudinalTuning.kiV = [0.18, 0.12] ret.longitudinalTuning.kiV = [0.18, 0.12]
else: else:
raise ValueError("unsupported car %s" % candidate) raise ValueError("unsupported car %s" % candidate)

View File

@ -52,7 +52,6 @@ class RadarInterface(RadarInterfaceBase):
self.updated_messages.clear() self.updated_messages.clear()
return rr return rr
def _update(self, updated_messages): def _update(self, updated_messages):
ret = car.RadarData.new_message() ret = car.RadarData.new_message()

View File

@ -94,7 +94,6 @@ class CarController():
elif self.last_lead_distance != 0: elif self.last_lead_distance != 0:
self.last_lead_distance = 0 self.last_lead_distance = 0
# 20 Hz LFA MFA message # 20 Hz LFA MFA message
if frame % 5 == 0 and self.car_fingerprint in [CAR.SONATA, CAR.PALISADE]: if frame % 5 == 0 and self.car_fingerprint in [CAR.SONATA, CAR.PALISADE]:
can_sends.append(create_lfa_mfa(self.packer, frame, enabled)) can_sends.append(create_lfa_mfa(self.packer, frame, enabled))

View File

@ -36,7 +36,6 @@ class CarController():
# Match stock message rate which is sent at 10hz # Match stock message rate which is sent at 10hz
can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, Buttons.CANCEL)) can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, Buttons.CANCEL))
self.apply_steer_last = apply_steer self.apply_steer_last = apply_steer
can_sends.append(mazdacan.create_steering_control(self.packer, CS.CP.carFingerprint, can_sends.append(mazdacan.create_steering_control(self.packer, CS.CP.carFingerprint,

View File

@ -56,7 +56,6 @@ class CarState(CarStateBase):
ret.gas = cp.vl["ENGINE_DATA"]['PEDAL_GAS'] ret.gas = cp.vl["ENGINE_DATA"]['PEDAL_GAS']
ret.gasPressed = ret.gas > 0 ret.gasPressed = ret.gas > 0
# LKAS is enabled at 52kph going up and disabled at 45kph going down # LKAS is enabled at 52kph going up and disabled at 45kph going down
if speed_kph > LKAS_LIMITS.ENABLE_SPEED: if speed_kph > LKAS_LIMITS.ENABLE_SPEED:
self.lkas_allowed = True self.lkas_allowed = True
@ -155,7 +154,6 @@ class CarState(CarStateBase):
return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0) return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 0)
@staticmethod @staticmethod
def get_cam_can_parser(CP): def get_cam_can_parser(CP):
signals = [ ] signals = [ ]

View File

@ -46,7 +46,6 @@ class CarInterface(CarInterfaceBase):
# No steer below disable speed # No steer below disable speed
ret.minSteerSpeed = LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS ret.minSteerSpeed = LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS
ret.centerToFront = ret.wheelbase * 0.41 ret.centerToFront = ret.wheelbase * 0.41
# TODO: get actual value, for now starting with reasonable value for # TODO: get actual value, for now starting with reasonable value for

View File

@ -16,7 +16,6 @@ class CarControllerParams():
self.STEER_DRIVER_FACTOR = 1 # from dbc self.STEER_DRIVER_FACTOR = 1 # from dbc
class CarController(): class CarController():
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.lkas_active = False self.lkas_active = False

View File

@ -160,7 +160,6 @@ class CarState(CarStateBase):
signals.append(("LOW_SPEED_LOCKOUT", "PCM_CRUISE_2", 0)) signals.append(("LOW_SPEED_LOCKOUT", "PCM_CRUISE_2", 0))
checks.append(("PCM_CRUISE_2", 33)) checks.append(("PCM_CRUISE_2", 33))
if CP.carFingerprint == CAR.PRIUS: if CP.carFingerprint == CAR.PRIUS:
signals += [("STATE", "AUTOPARK_STATUS", 0)] signals += [("STATE", "AUTOPARK_STATUS", 0)]

View File

@ -146,7 +146,6 @@ class Controls:
self.rk = Ratekeeper(100, print_delay_threshold=None) self.rk = Ratekeeper(100, print_delay_threshold=None)
self.prof = Profiler(False) # off by default self.prof = Profiler(False) # off by default
def update_events(self, CS): def update_events(self, CS):
"""Compute carEvents from carState""" """Compute carEvents from carState"""
@ -226,7 +225,6 @@ class Controls:
and not self.CP.radarOffCan and CS.vEgo < 0.3: and not self.CP.radarOffCan and CS.vEgo < 0.3:
self.events.add(EventName.noTarget) self.events.add(EventName.noTarget)
def data_sample(self): def data_sample(self):
"""Receive data from sockets and update carState""" """Receive data from sockets and update carState"""
@ -255,7 +253,6 @@ class Controls:
return CS return CS
def state_transition(self, CS): def state_transition(self, CS):
"""Compute conditional state transitions and execute actions on state transitions""" """Compute conditional state transitions and execute actions on state transitions"""
@ -331,7 +328,6 @@ class Controls:
# Check if openpilot is engaged # Check if openpilot is engaged
self.enabled = self.active or self.state == State.preEnabled self.enabled = self.active or self.state == State.preEnabled
def state_control(self, CS): def state_control(self, CS):
"""Given the state, this function returns an actuators packet""" """Given the state, this function returns an actuators packet"""
@ -382,7 +378,6 @@ class Controls:
return actuators, v_acc_sol, a_acc_sol, lac_log return actuators, v_acc_sol, a_acc_sol, lac_log
def publish_logs(self, CS, start_time, actuators, v_acc, a_acc, lac_log): def publish_logs(self, CS, start_time, actuators, v_acc, a_acc, lac_log):
"""Send actuators and hud commands to the car, send controlsstate and MPC logging""" """Send actuators and hud commands to the car, send controlsstate and MPC logging"""

View File

@ -133,7 +133,6 @@ class RadarD():
idens = list(sorted(self.tracks.keys())) idens = list(sorted(self.tracks.keys()))
track_pts = list([self.tracks[iden].get_key_for_cluster() for iden in idens]) track_pts = list([self.tracks[iden].get_key_for_cluster() for iden in idens])
# If we have multiple points, cluster them # If we have multiple points, cluster them
if len(track_pts) > 1: if len(track_pts) > 1:
cluster_idxs = cluster_points_centroid(track_pts, 2.5) cluster_idxs = cluster_points_centroid(track_pts, 2.5)

View File

@ -6,12 +6,10 @@ import cereal.messaging as messaging
if __name__ == "__main__": if __name__ == "__main__":
sm = messaging.SubMaster(['thermal', 'health', 'model', 'liveCalibration', 'dMonitoringState', 'plan', 'pathPlan']) sm = messaging.SubMaster(['thermal', 'health', 'model', 'liveCalibration', 'dMonitoringState', 'plan', 'pathPlan'])
i = 0 i = 0
while True: while True:
sm.update(0) sm.update(0)
i += 1 i += 1
if i % 100 == 0: if i % 100 == 0:
print() print()

View File

@ -55,7 +55,6 @@ def mpc_vwr_thread(addr="127.0.0.1"):
aa.invert_xaxis() aa.invert_xaxis()
plt.show() plt.show()
# *** log *** # *** log ***
livempc = messaging.sub_sock('liveMpc', addr=addr) livempc = messaging.sub_sock('liveMpc', addr=addr)
model = messaging.sub_sock('model', addr=addr) model = messaging.sub_sock('model', addr=addr)

View File

@ -97,8 +97,6 @@ def plot_longitudinal_mpc(addr="127.0.0.1"):
fig.canvas.flush_events() fig.canvas.flush_events()
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) > 1: if len(sys.argv) > 1:
plot_longitudinal_mpc(sys.argv[1]) plot_longitudinal_mpc(sys.argv[1])

View File

@ -151,7 +151,6 @@ ys.append(sol_y)
deltas.append(delta) deltas.append(delta)
plt.figure() plt.figure()
for i in range(len(xs)): for i in range(len(xs)):

View File

@ -167,7 +167,6 @@ def calibrationd_thread(sm=None, pm=None):
sm['cameraOdometry'].transStd, sm['cameraOdometry'].transStd,
sm['cameraOdometry'].rotStd) sm['cameraOdometry'].rotStd)
if DEBUG and new_vp is not None: if DEBUG and new_vp is not None:
print('got new vp', new_vp) print('got new vp', new_vp)

View File

@ -194,7 +194,6 @@ class Localizer():
ecef_pos_R = np.diag([(3*log.verticalAccuracy)**2]*3) ecef_pos_R = np.diag([(3*log.verticalAccuracy)**2]*3)
ecef_vel_R = np.diag([(log.speedAccuracy)**2]*3) ecef_vel_R = np.diag([(log.speedAccuracy)**2]*3)
#self.time = GPSTime.from_datetime(datetime.utcfromtimestamp(log.timestamp*1e-3)) #self.time = GPSTime.from_datetime(datetime.utcfromtimestamp(log.timestamp*1e-3))
self.unix_timestamp_millis = log.timestamp self.unix_timestamp_millis = log.timestamp
gps_est_error = np.sqrt((self.kf.x[0] - ecef_pos[0])**2 + gps_est_error = np.sqrt((self.kf.x[0] - ecef_pos[0])**2 +

View File

@ -38,7 +38,6 @@ class ObservationKind:
STEER_RATIO = 29 # [-] STEER_RATIO = 29 # [-]
ROAD_FRAME_X_SPEED = 30 # (x) [m/s] ROAD_FRAME_X_SPEED = 30 # (x) [m/s]
names = [ names = [
'Unknown', 'Unknown',
'No observation', 'No observation',

View File

@ -46,8 +46,5 @@ class TestParamsLearner(unittest.TestCase):
self.assertAlmostEqual(sr_target, sr, places=1) self.assertAlmostEqual(sr_target, sr, places=1)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()

View File

@ -737,7 +737,6 @@ class UBlox:
self.buf = self.buf[n:] self.buf = self.buf[n:]
return ret return ret
def write(self, dat): def write(self, dat):
pass pass

View File

@ -80,7 +80,6 @@ def configure_ublox(dev):
dev.configure_message_rate(ublox.CLASS_MON, ublox.MSG_MON_HW, 1) dev.configure_message_rate(ublox.CLASS_MON, ublox.MSG_MON_HW, 1)
def int_to_bool_list(num): def int_to_bool_list(num):
# for parsing bool bytes # for parsing bool bytes
return [bool(num & (1 << n)) for n in range(8)] return [bool(num & (1 << n)) for n in range(8)]
@ -181,8 +180,6 @@ def gen_nav_data(msg, nav_frame_buffer):
return gen_ephemeris(ephem_data) return gen_ephemeris(ephem_data)
def gen_raw(msg): def gen_raw(msg):
# meta data is in first part of tuple # meta data is in first part of tuple
# list of measurements is in second part # list of measurements is in second part
@ -284,7 +281,6 @@ def main():
for i in range(1, 33): for i in range(1, 33):
nav_frame_buffer[0][i] = {} nav_frame_buffer[0][i] = {}
gpsLocationExternal = messaging.pub_sock('gpsLocationExternal') gpsLocationExternal = messaging.pub_sock('gpsLocationExternal')
ubloxGnss = messaging.pub_sock('ubloxGnss') ubloxGnss = messaging.pub_sock('ubloxGnss')

View File

@ -103,7 +103,6 @@ class VisionTest():
transform) transform)
return result return result
def transform_output_buffer(self, yuv_data, y_out, u_out, v_out, def transform_output_buffer(self, yuv_data, y_out, u_out, v_out,
transform): transform):
assert len(yuv_data) == self.input_size[0] * self.input_size[1] * 3/2 assert len(yuv_data) == self.input_size[0] * self.input_size[1] * 3/2

View File

@ -61,7 +61,6 @@ class ManeuverPlot():
self.a_target_array.append(a_target) self.a_target_array.append(a_target)
self.fcw_array.append(fcw) self.fcw_array.append(fcw)
def write_plot(self, path, maneuver_name): def write_plot(self, path, maneuver_name):
# title = self.title or maneuver_name # title = self.title or maneuver_name
# TODO: Missing plots from the old one: # TODO: Missing plots from the old one:

View File

@ -355,7 +355,6 @@ class Plant():
msg_data = fix(msg_data, 0xe4) msg_data = fix(msg_data, 0xe4)
can_msgs.append([0xe4, 0, msg_data, 2]) can_msgs.append([0xe4, 0, msg_data, 2])
# Fake sockets that controlsd subscribes to # Fake sockets that controlsd subscribes to
live_parameters = messaging.new_message('liveParameters') live_parameters = messaging.new_message('liveParameters')
live_parameters.liveParameters.valid = True live_parameters.liveParameters.valid = True

View File

@ -65,7 +65,6 @@ def inject_model(msgs, segment_name):
time.sleep(2) time.sleep(2)
manager.kill_managed_process('camerad') manager.kill_managed_process('camerad')
new_msgs = [] new_msgs = []
midx = 0 midx = 0
for msg in msgs: for msg in msgs:

View File

@ -94,7 +94,6 @@ class FakeSubMaster(messaging.SubMaster):
wait_for_event(self.update_ready) wait_for_event(self.update_ready)
self.update_ready.clear() self.update_ready.clear()
def update_msgs(self, cur_time, msgs): def update_msgs(self, cur_time, msgs):
wait_for_event(self.update_called) wait_for_event(self.update_called)
self.update_called.clear() self.update_called.clear()

View File

@ -65,7 +65,6 @@ if __name__ == "__main__":
if not sync_to_ci_public(r): if not sync_to_ci_public(r):
failed_routes.append(r) failed_routes.append(r)
if len(failed_routes): if len(failed_routes):
print("failed routes:") print("failed routes:")
print(failed_routes) print(failed_routes)

View File

@ -63,7 +63,6 @@ while not done:
if event.type == pygame.JOYBUTTONUP: if event.type == pygame.JOYBUTTONUP:
print("Joystick button released.") print("Joystick button released.")
# DRAWING STEP # DRAWING STEP
# First, clear the screen to white. Don't put other drawing commands # First, clear the screen to white. Don't put other drawing commands
# above this, or they will be erased with this command. # above this, or they will be erased with this command.
@ -107,10 +106,8 @@ while not done:
textPrint.printf(screen, "Button {:>2} value: {}".format(i, button) ) textPrint.printf(screen, "Button {:>2} value: {}".format(i, button) )
textPrint.unindent() textPrint.unindent()
textPrint.unindent() textPrint.unindent()
# ALL CODE TO DRAW SHOULD GO ABOVE THIS COMMENT # ALL CODE TO DRAW SHOULD GO ABOVE THIS COMMENT
# Go ahead and update the screen with what we've drawn. # Go ahead and update the screen with what we've drawn.

View File

@ -31,14 +31,12 @@ class KBHit:
termios.tcsetattr(self.fd, termios.TCSAFLUSH, self.old_term) termios.tcsetattr(self.fd, termios.TCSAFLUSH, self.old_term)
def getch(self): def getch(self):
''' Returns a keyboard character after kbhit() has been called. ''' Returns a keyboard character after kbhit() has been called.
Should not be called in the same program as getarrow(). Should not be called in the same program as getarrow().
''' '''
return sys.stdin.read(1) return sys.stdin.read(1)
def getarrow(self): def getarrow(self):
''' Returns an arrow-key code after kbhit() has been called. Codes are ''' Returns an arrow-key code after kbhit() has been called. Codes are
0 : up 0 : up
@ -53,7 +51,6 @@ class KBHit:
return vals.index(ord(c.decode('utf-8'))) return vals.index(ord(c.decode('utf-8')))
def kbhit(self): def kbhit(self):
''' Returns True if keyboard character was hit, False otherwise. ''' Returns True if keyboard character was hit, False otherwise.
''' '''

View File

@ -75,7 +75,6 @@ class RouteFrameReader(object):
return self._frame_readers[segment_num].get(segment_id, **kwargs)[0] return self._frame_readers[segment_num].get(segment_id, **kwargs)[0]
def close(self): def close(self):
frs = self._frame_readers frs = self._frame_readers
self._frame_readers.clear() self._frame_readers.clear()

View File

@ -18,7 +18,6 @@ class TestReaders(unittest.TestCase):
self.assertEqual(hist['carControl'], 6000) self.assertEqual(hist['carControl'], 6000)
self.assertEqual(hist['logMessage'], 6857) self.assertEqual(hist['logMessage'], 6857)
with tempfile.NamedTemporaryFile(suffix=".bz2") as fp: with tempfile.NamedTemporaryFile(suffix=".bz2") as fp:
r = requests.get("https://github.com/commaai/comma2k19/blob/master/Example_1/b0c9d2329ad1606b%7C2018-08-02--08-34-47/40/raw_log.bz2?raw=true") r = requests.get("https://github.com/commaai/comma2k19/blob/master/Example_1/b0c9d2329ad1606b%7C2018-08-02--08-34-47/40/raw_log.bz2?raw=true")
fp.write(r.content) fp.write(r.content)
@ -36,11 +35,9 @@ class TestReaders(unittest.TestCase):
self.assertEqual(f.w, 1164) self.assertEqual(f.w, 1164)
self.assertEqual(f.h, 874) self.assertEqual(f.h, 874)
frame_first_30 = f.get(0, 30) frame_first_30 = f.get(0, 30)
self.assertEqual(len(frame_first_30), 30) self.assertEqual(len(frame_first_30), 30)
print(frame_first_30[15]) print(frame_first_30[15])
print("frame_0") print("frame_0")

View File

@ -19,7 +19,6 @@ _FULL_FRAME_TO_BB = np.linalg.inv(_BB_TO_FULL_FRAME)
_FULL_FRAME_SIZE = 1164, 874 _FULL_FRAME_SIZE = 1164, 874
def pygame_modules_have_loaded(): def pygame_modules_have_loaded():
return pygame.display.get_init() and pygame.font.get_init() return pygame.display.get_init() and pygame.font.get_init()

View File

@ -187,7 +187,6 @@ def draw_mpc(liveMpc, top_down):
top_down[1][px, py] = mpc_color top_down[1][px, py] = mpc_color
class CalibrationTransformsForWarpMatrix(object): class CalibrationTransformsForWarpMatrix(object):
def __init__(self, model_to_full_frame, K, E): def __init__(self, model_to_full_frame, K, E):
self._model_to_full_frame = model_to_full_frame self._model_to_full_frame = model_to_full_frame

View File

@ -42,7 +42,6 @@ if __name__ == "__main__":
calibration = CalibrationTransformsForWarpMatrix(warp_matrix, intrinsic_matrix, extrinsic_matrix) calibration = CalibrationTransformsForWarpMatrix(warp_matrix, intrinsic_matrix, extrinsic_matrix)
transform = np.dot(img_transform, calibration.model_to_full_frame) transform = np.dot(img_transform, calibration.model_to_full_frame)
if calibration is not None: if calibration is not None:
imgw = cv2.warpAffine(imgff, transform[:2], imgw = cv2.warpAffine(imgff, transform[:2],
(MEDMODEL_INPUT_SIZE[0], MEDMODEL_INPUT_SIZE[1]), (MEDMODEL_INPUT_SIZE[0], MEDMODEL_INPUT_SIZE[1]),

View File

@ -131,7 +131,6 @@ def ui_thread(addr, frame_address):
[ 0.0, 0.0, 1.0] [ 0.0, 0.0, 1.0]
]) ])
if rgb_img_raw and len(rgb_img_raw) == FULL_FRAME_SIZE[0] * FULL_FRAME_SIZE[1] * 3: if rgb_img_raw and len(rgb_img_raw) == FULL_FRAME_SIZE[0] * FULL_FRAME_SIZE[1] * 3:
imgff = np.frombuffer(rgb_img_raw, dtype=np.uint8).reshape((FULL_FRAME_SIZE[1], FULL_FRAME_SIZE[0], 3)) imgff = np.frombuffer(rgb_img_raw, dtype=np.uint8).reshape((FULL_FRAME_SIZE[1], FULL_FRAME_SIZE[0], 3))
imgff = imgff[:, :, ::-1] # Convert BGR to RGB imgff = imgff[:, :, ::-1] # Convert BGR to RGB
@ -189,7 +188,6 @@ def ui_thread(addr, frame_address):
# draw all radar points # draw all radar points
maybe_update_radar_points(sm['liveTracks'], top_down[1]) maybe_update_radar_points(sm['liveTracks'], top_down[1])
if sm.updated['liveCalibration']: if sm.updated['liveCalibration']:
extrinsic_matrix = np.asarray(sm['liveCalibration'].extrinsicMatrix).reshape(3, 4) extrinsic_matrix = np.asarray(sm['liveCalibration'].extrinsicMatrix).reshape(3, 4)
ke = intrinsic_matrix.dot(extrinsic_matrix) ke = intrinsic_matrix.dot(extrinsic_matrix)