diff --git a/common/conversions.py b/common/conversions.py new file mode 100644 index 0000000000..b02b33c625 --- /dev/null +++ b/common/conversions.py @@ -0,0 +1,19 @@ +import numpy as np + +class Conversions: + # Speed + MPH_TO_KPH = 1.609344 + KPH_TO_MPH = 1. / MPH_TO_KPH + MS_TO_KPH = 3.6 + KPH_TO_MS = 1. / MS_TO_KPH + MS_TO_MPH = MS_TO_KPH * KPH_TO_MPH + MPH_TO_MS = MPH_TO_KPH * KPH_TO_MS + MS_TO_KNOTS = 1.9438 + KNOTS_TO_MS = 1. / MS_TO_KNOTS + + # Angle + DEG_TO_RAD = np.pi / 180. + RAD_TO_DEG = 1. / DEG_TO_RAD + + # Mass + LB_TO_KG = 0.453592 diff --git a/release/files_common b/release/files_common index e69d58520d..30029ba0d9 100644 --- a/release/files_common +++ b/release/files_common @@ -17,6 +17,7 @@ site_scons/site_tools/cython.py common/.gitignore common/__init__.py +common/conversions.py common/gpio.py common/realtime.py common/clock.pyx @@ -69,7 +70,6 @@ installer/updater/updater selfdrive/version.py selfdrive/__init__.py -selfdrive/config.py selfdrive/sentry.py selfdrive/swaglog.py selfdrive/logmessaged.py diff --git a/selfdrive/car/chrysler/carstate.py b/selfdrive/car/chrysler/carstate.py index f7dc140e2e..5f83bbde8b 100644 --- a/selfdrive/car/chrysler/carstate.py +++ b/selfdrive/car/chrysler/carstate.py @@ -1,7 +1,7 @@ from cereal import car +from common.conversions import Conversions as CV from opendbc.can.parser import CANParser from opendbc.can.can_define import CANDefine -from selfdrive.config import Conversions as CV from selfdrive.car.interfaces import CarStateBase from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD diff --git a/selfdrive/car/ford/carstate.py b/selfdrive/car/ford/carstate.py index 6324791740..ff82e585b4 100644 --- a/selfdrive/car/ford/carstate.py +++ b/selfdrive/car/ford/carstate.py @@ -1,7 +1,7 @@ from cereal import car -from opendbc.can.parser import CANParser +from common.conversions import Conversions as CV from common.numpy_fast import mean -from selfdrive.config import Conversions as CV +from opendbc.can.parser import CANParser from selfdrive.car.interfaces import CarStateBase from selfdrive.car.ford.values import DBC diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py index fc6843c826..5d89950816 100755 --- a/selfdrive/car/ford/interface.py +++ b/selfdrive/car/ford/interface.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 from cereal import car -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car.ford.values import MAX_ANGLE from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config from selfdrive.car.interfaces import CarInterfaceBase diff --git a/selfdrive/car/ford/radar_interface.py b/selfdrive/car/ford/radar_interface.py index 94eb8bb0cc..f8477951cd 100755 --- a/selfdrive/car/ford/radar_interface.py +++ b/selfdrive/car/ford/radar_interface.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 from cereal import car +from common.conversions import Conversions as CV from opendbc.can.parser import CANParser from selfdrive.car.ford.values import DBC -from selfdrive.config import Conversions as CV from selfdrive.car.interfaces import RadarInterfaceBase RADAR_MSGS = list(range(0x500, 0x540)) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 39e348ff29..11c2d367cb 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -1,11 +1,11 @@ from cereal import car +from common.conversions import Conversions as CV from common.realtime import DT_CTRL from common.numpy_fast import interp -from selfdrive.config import Conversions as CV +from opendbc.can.packer import CANPacker from selfdrive.car import apply_std_steer_torque_limits from selfdrive.car.gm import gmcan from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams -from opendbc.can.packer import CANPacker VisualAlert = car.CarControl.HUDControl.VisualAlert diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 0aad0a7f04..7125b4a913 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -1,10 +1,11 @@ #!/usr/bin/env python3 from cereal import car from math import fabs -from selfdrive.config import Conversions as CV + +from common.conversions import Conversions as CV +from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config from selfdrive.car.gm.values import CAR, CruiseButtons, \ AccState, CarControllerParams -from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config from selfdrive.car.interfaces import CarInterfaceBase ButtonType = car.CarState.ButtonEvent.Type diff --git a/selfdrive/car/gm/radar_interface.py b/selfdrive/car/gm/radar_interface.py index 66fac54748..6904e6f899 100755 --- a/selfdrive/car/gm/radar_interface.py +++ b/selfdrive/car/gm/radar_interface.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 import math from cereal import car +from common.conversions import Conversions as CV from opendbc.can.parser import CANParser from selfdrive.car.gm.values import DBC, CAR, CanBus -from selfdrive.config import Conversions as CV from selfdrive.car.interfaces import RadarInterfaceBase RADAR_HEADER_MSG = 1120 diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 4d09fdcacb..332290373a 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -1,9 +1,10 @@ -from cereal import car from collections import defaultdict + +from cereal import car +from common.conversions import Conversions as CV from common.numpy_fast import interp from opendbc.can.can_define import CANDefine from opendbc.can.parser import CANParser -from selfdrive.config import Conversions as CV from selfdrive.car.interfaces import CarStateBase from selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index db7104cd4f..513babf3d1 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -1,5 +1,5 @@ +from common.conversions import Conversions as CV from selfdrive.car.honda.values import HondaFlags, HONDA_BOSCH, CAR, CarControllerParams -from selfdrive.config import Conversions as CV # CAN bus layout with relay # 0 = ACC-CAN - radar side diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 9f09f8a719..2c801f7f15 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 from cereal import car from panda import Panda +from common.conversions import Conversions as CV from common.numpy_fast import interp from common.params import Params from selfdrive.car.honda.values import CarControllerParams, CruiseButtons, HondaFlags, CAR, HONDA_BOSCH, HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_ALT_BRAKE_SIGNAL from selfdrive.car import STD_CARGO_KG, CivicParams, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config from selfdrive.car.interfaces import CarInterfaceBase from selfdrive.car.disable_ecu import disable_ecu -from selfdrive.config import Conversions as CV ButtonType = car.CarState.ButtonEvent.Type diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 55fc442f6d..6b2cbd422d 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -1,7 +1,7 @@ from cereal import car from common.realtime import DT_CTRL from common.numpy_fast import clip, interp -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car import apply_std_steer_torque_limits from selfdrive.car.hyundai.hyundaican import create_lkas11, create_clu11, create_lfahda_mfc, create_acc_commands, create_acc_opt, create_frt_radar_opt from selfdrive.car.hyundai.values import Buttons, CarControllerParams, CAR diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 2356782dde..95c1878e3d 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -1,10 +1,10 @@ import copy from cereal import car -from selfdrive.car.hyundai.values import DBC, STEER_THRESHOLD, FEATURES, EV_CAR, HYBRID_CAR -from selfdrive.car.interfaces import CarStateBase +from common.conversions import Conversions as CV from opendbc.can.parser import CANParser from opendbc.can.can_define import CANDefine -from selfdrive.config import Conversions as CV +from selfdrive.car.hyundai.values import DBC, STEER_THRESHOLD, FEATURES, EV_CAR, HYBRID_CAR +from selfdrive.car.interfaces import CarStateBase class CarState(CarStateBase): diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index cda94e1346..89308c7897 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -2,7 +2,7 @@ from cereal import car from panda import Panda from common.params import Params -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car.hyundai.values import CAR, EV_CAR, HYBRID_CAR, LEGACY_SAFETY_MODE_CAR, Buttons, CarControllerParams from selfdrive.car.hyundai.radar_interface import RADAR_START_ADDR from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index e6f546acc3..80d6b1db3e 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -7,7 +7,7 @@ from cereal import car from common.kalman.simple_kalman import KF1D from common.realtime import DT_CTRL from selfdrive.car import gen_empty_fingerprint -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX from selfdrive.controls.lib.events import Events from selfdrive.controls.lib.vehicle_model import VehicleModel diff --git a/selfdrive/car/mazda/carstate.py b/selfdrive/car/mazda/carstate.py index ea3d420e5d..fa15f2453c 100644 --- a/selfdrive/car/mazda/carstate.py +++ b/selfdrive/car/mazda/carstate.py @@ -1,5 +1,5 @@ from cereal import car -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from opendbc.can.can_define import CANDefine from opendbc.can.parser import CANParser from selfdrive.car.interfaces import CarStateBase diff --git a/selfdrive/car/mazda/interface.py b/selfdrive/car/mazda/interface.py index fb8edd6f42..c910d7e148 100755 --- a/selfdrive/car/mazda/interface.py +++ b/selfdrive/car/mazda/interface.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 from cereal import car -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car.mazda.values import CAR, LKAS_LIMITS from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config from selfdrive.car.interfaces import CarInterfaceBase diff --git a/selfdrive/car/mock/interface.py b/selfdrive/car/mock/interface.py index b2e315a5f9..d7fcad0748 100755 --- a/selfdrive/car/mock/interface.py +++ b/selfdrive/car/mock/interface.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import math from cereal import car -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.swaglog import cloudlog import cereal.messaging as messaging from selfdrive.car import gen_empty_fingerprint, get_safety_config diff --git a/selfdrive/car/nissan/carstate.py b/selfdrive/car/nissan/carstate.py index 6b030e9b45..3c5d7dc24b 100644 --- a/selfdrive/car/nissan/carstate.py +++ b/selfdrive/car/nissan/carstate.py @@ -3,7 +3,7 @@ from collections import deque from cereal import car from opendbc.can.can_define import CANDefine from selfdrive.car.interfaces import CarStateBase -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from opendbc.can.parser import CANParser from selfdrive.car.nissan.values import CAR, DBC, CarControllerParams diff --git a/selfdrive/car/subaru/carstate.py b/selfdrive/car/subaru/carstate.py index ad86131d74..45ea66fb27 100644 --- a/selfdrive/car/subaru/carstate.py +++ b/selfdrive/car/subaru/carstate.py @@ -1,7 +1,7 @@ import copy from cereal import car from opendbc.can.can_define import CANDefine -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car.interfaces import CarStateBase from opendbc.can.parser import CANParser from selfdrive.car.subaru.values import DBC, STEER_THRESHOLD, CAR, PREGLOBAL_CARS diff --git a/selfdrive/car/tesla/carstate.py b/selfdrive/car/tesla/carstate.py index 484f5d3630..42a7983505 100644 --- a/selfdrive/car/tesla/carstate.py +++ b/selfdrive/car/tesla/carstate.py @@ -1,10 +1,10 @@ import copy from cereal import car +from common.conversions import Conversions as CV from selfdrive.car.tesla.values import DBC, CANBUS, GEAR_MAP, DOORS, BUTTONS from selfdrive.car.interfaces import CarStateBase from opendbc.can.parser import CANParser from opendbc.can.can_define import CANDefine -from selfdrive.config import Conversions as CV class CarState(CarStateBase): def __init__(self, CP): diff --git a/selfdrive/car/tesla/teslacan.py b/selfdrive/car/tesla/teslacan.py index 1301802860..d48cd284d9 100644 --- a/selfdrive/car/tesla/teslacan.py +++ b/selfdrive/car/tesla/teslacan.py @@ -1,6 +1,6 @@ import copy import crcmod -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car.tesla.values import CANBUS, CarControllerParams diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 8c7aa34c5c..8a6f91324a 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -1,11 +1,11 @@ from cereal import car +from common.conversions import Conversions as CV from common.numpy_fast import mean from common.filter_simple import FirstOrderFilter from common.realtime import DT_CTRL from opendbc.can.can_define import CANDefine -from selfdrive.car.interfaces import CarStateBase from opendbc.can.parser import CANParser -from selfdrive.config import Conversions as CV +from selfdrive.car.interfaces import CarStateBase from selfdrive.car.toyota.values import ToyotaFlags, CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, TSS2_CAR, EPS_SCALE diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index b6a01bcc46..4ac13d3d97 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 from cereal import car -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car.toyota.tunes import LatTunes, LongTunes, set_long_tune, set_lat_tune from selfdrive.car.toyota.values import Ecu, CAR, ToyotaFlags, TSS2_CAR, NO_DSU_CAR, MIN_ACC_SPEED, EPS_SCALE, EV_HYBRID_CAR, CarControllerParams from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py index 31a40a71f8..acf3f42c38 100644 --- a/selfdrive/car/toyota/values.py +++ b/selfdrive/car/toyota/values.py @@ -2,8 +2,8 @@ from collections import defaultdict from enum import IntFlag from cereal import car +from common.conversions import Conversions as CV from selfdrive.car import dbc_dict -from selfdrive.config import Conversions as CV Ecu = car.CarParams.Ecu MIN_ACC_SPEED = 19. * CV.MPH_TO_MS diff --git a/selfdrive/car/volkswagen/carstate.py b/selfdrive/car/volkswagen/carstate.py index d7ec587106..83dbb956f7 100644 --- a/selfdrive/car/volkswagen/carstate.py +++ b/selfdrive/car/volkswagen/carstate.py @@ -1,6 +1,6 @@ import numpy as np from cereal import car -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.car.interfaces import CarStateBase from opendbc.can.parser import CANParser from opendbc.can.can_define import CANDefine diff --git a/selfdrive/config.py b/selfdrive/config.py deleted file mode 100644 index 511f6126c4..0000000000 --- a/selfdrive/config.py +++ /dev/null @@ -1,29 +0,0 @@ -import numpy as np - -class Conversions: - #Speed - MPH_TO_KPH = 1.609344 - KPH_TO_MPH = 1. / MPH_TO_KPH - MS_TO_KPH = 3.6 - KPH_TO_MS = 1. / MS_TO_KPH - MS_TO_MPH = MS_TO_KPH * KPH_TO_MPH - MPH_TO_MS = MPH_TO_KPH * KPH_TO_MS - MS_TO_KNOTS = 1.9438 - KNOTS_TO_MS = 1. / MS_TO_KNOTS - #Angle - DEG_TO_RAD = np.pi / 180. - RAD_TO_DEG = 1. / DEG_TO_RAD - #Mass - LB_TO_KG = 0.453592 - - -RADAR_TO_CENTER = 2.7 # (deprecated) RADAR is ~ 2.7m ahead from center of car -RADAR_TO_CAMERA = 1.52 # RADAR is ~ 1.5m ahead from center of mesh frame - -class UIParams: - lidar_x, lidar_y, lidar_zoom = 384, 960, 6 - lidar_car_x, lidar_car_y = lidar_x / 2., lidar_y / 1.1 - car_hwidth = 1.7272 / 2 * lidar_zoom - car_front = 2.6924 * lidar_zoom - car_back = 1.8796 * lidar_zoom - car_color = 110 diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index cf403b50b2..fcb1a4974a 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -9,7 +9,7 @@ from common.realtime import sec_since_boot, config_realtime_process, Priority, R from common.profiler import Profiler from common.params import Params, put_nonblocking import cereal.messaging as messaging -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.swaglog import cloudlog from selfdrive.boardd.boardd import can_list_to_can_capnp from selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can diff --git a/selfdrive/controls/lib/desire_helper.py b/selfdrive/controls/lib/desire_helper.py index c34d143a5a..978c386530 100644 --- a/selfdrive/controls/lib/desire_helper.py +++ b/selfdrive/controls/lib/desire_helper.py @@ -1,6 +1,6 @@ from cereal import log +from common.conversions import Conversions as CV from common.realtime import DT_MDL -from selfdrive.config import Conversions as CV LaneChangeState = log.LateralPlan.LaneChangeState LaneChangeDirection = log.LateralPlan.LaneChangeDirection diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index 01d7600345..dba6c190d7 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -2,7 +2,7 @@ import math from cereal import car from common.numpy_fast import clip, interp from common.realtime import DT_MDL -from selfdrive.config import Conversions as CV +from common.conversions import Conversions as CV from selfdrive.modeld.constants import T_IDXS # WARNING: this value was determined based on the model's training distribution, diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 931932cc0d..e04ec262de 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -4,8 +4,8 @@ from typing import Dict, Union, Callable, List, Optional from cereal import log, car import cereal.messaging as messaging +from common.conversions import Conversions as CV from common.realtime import DT_CTRL -from selfdrive.config import Conversions as CV from selfdrive.locationd.calibrationd import MIN_SPEED_FILTER from selfdrive.version import get_short_branch diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index ad44953e94..fd76142366 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -4,10 +4,10 @@ import numpy as np from common.numpy_fast import interp import cereal.messaging as messaging +from common.conversions import Conversions as CV from common.filter_simple import FirstOrderFilter from common.realtime import DT_MDL from selfdrive.modeld.constants import T_IDXS -from selfdrive.config import Conversions as CV from selfdrive.controls.lib.longcontrol import LongCtrlState from selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import LongitudinalMpc from selfdrive.controls.lib.longitudinal_mpc_lib.long_mpc import T_IDXS as T_IDXS_MPC diff --git a/selfdrive/controls/lib/radar_helpers.py b/selfdrive/controls/lib/radar_helpers.py index 4f87fdf09b..85699866b0 100644 --- a/selfdrive/controls/lib/radar_helpers.py +++ b/selfdrive/controls/lib/radar_helpers.py @@ -1,6 +1,5 @@ from common.numpy_fast import mean from common.kalman.simple_kalman import KF1D -from selfdrive.config import RADAR_TO_CAMERA # the longer lead decels, the more likely it will keep decelerating @@ -13,6 +12,8 @@ SPEED, ACCEL = 0, 1 # Kalman filter states enum # stationary qualification parameters v_ego_stationary = 4. # no stationary object flag below this speed +RADAR_TO_CENTER = 2.7 # (deprecated) RADAR is ~ 2.7m ahead from center of car +RADAR_TO_CAMERA = 1.52 # RADAR is ~ 1.5m ahead from center of mesh frame class Track(): def __init__(self, v_lead, kalman_params): diff --git a/selfdrive/controls/radard.py b/selfdrive/controls/radard.py index 65f8480c7c..ddba0920b8 100755 --- a/selfdrive/controls/radard.py +++ b/selfdrive/controls/radard.py @@ -8,9 +8,8 @@ from cereal import car from common.numpy_fast import interp from common.params import Params from common.realtime import Ratekeeper, Priority, config_realtime_process -from selfdrive.config import RADAR_TO_CAMERA from selfdrive.controls.lib.cluster.fastcluster_py import cluster_points_centroid -from selfdrive.controls.lib.radar_helpers import Cluster, Track +from selfdrive.controls.lib.radar_helpers import Cluster, Track, RADAR_TO_CAMERA from selfdrive.swaglog import cloudlog from selfdrive.hardware import TICI diff --git a/selfdrive/locationd/calibrationd.py b/selfdrive/locationd/calibrationd.py index ae314e38c4..c8c3912528 100755 --- a/selfdrive/locationd/calibrationd.py +++ b/selfdrive/locationd/calibrationd.py @@ -13,12 +13,12 @@ from typing import NoReturn from cereal import log import cereal.messaging as messaging +from common.conversions import Conversions as CV from common.params import Params, put_nonblocking from common.realtime import set_realtime_priority from common.transformations.model import model_height from common.transformations.camera import get_view_frame_from_road_frame from common.transformations.orientation import rot_from_euler, euler_from_rot -from selfdrive.config import Conversions as CV from selfdrive.hardware import TICI from selfdrive.swaglog import cloudlog diff --git a/tools/replay/lib/ui_helpers.py b/tools/replay/lib/ui_helpers.py index 33a1e77e05..d66fe79306 100644 --- a/tools/replay/lib/ui_helpers.py +++ b/tools/replay/lib/ui_helpers.py @@ -10,8 +10,7 @@ from matplotlib.backends.backend_agg import FigureCanvasAgg from common.transformations.camera import (eon_f_frame_size, eon_f_focal_length, tici_f_frame_size, tici_f_focal_length, get_view_frame_from_calib_frame) -from selfdrive.config import UIParams as UP -from selfdrive.config import RADAR_TO_CAMERA +from selfdrive.controls.lib.radar_helpers import RADAR_TO_CAMERA RED = (255, 0, 0) @@ -24,6 +23,15 @@ WHITE = (255, 255, 255) _FULL_FRAME_SIZE = { } +class UIParams: + lidar_x, lidar_y, lidar_zoom = 384, 960, 6 + lidar_car_x, lidar_car_y = lidar_x / 2., lidar_y / 1.1 + car_hwidth = 1.7272 / 2 * lidar_zoom + car_front = 2.6924 * lidar_zoom + car_back = 1.8796 * lidar_zoom + car_color = 110 +UP = UIParams + _BB_TO_FULL_FRAME = {} _CALIB_BB_TO_FULL = {} _FULL_FRAME_TO_BB = {} diff --git a/tools/replay/ui.py b/tools/replay/ui.py index b39377ffdc..dcbcef1016 100755 --- a/tools/replay/ui.py +++ b/tools/replay/ui.py @@ -10,8 +10,7 @@ import pygame # pylint: disable=import-error import cereal.messaging as messaging from common.numpy_fast import clip from common.basedir import BASEDIR -from selfdrive.config import UIParams as UP -from tools.replay.lib.ui_helpers import (_BB_TO_FULL_FRAME, +from tools.replay.lib.ui_helpers import (_BB_TO_FULL_FRAME, UP, _INTRINSICS, BLACK, GREEN, YELLOW, Calibration, get_blank_lid_overlay, init_plots,