mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-13 05:04:40 +08:00
Merge branch 'devel' of https://github.com/commaai/openpilot into devel
This commit is contained in:
@@ -12,15 +12,6 @@ try:
|
||||
except ImportError:
|
||||
CarController = None
|
||||
|
||||
# Car chimes, beeps, blinker sounds etc
|
||||
class CM:
|
||||
TOCK = 0x81
|
||||
TICK = 0x82
|
||||
LOW_BEEP = 0x84
|
||||
HIGH_BEEP = 0x85
|
||||
LOW_CHIME = 0x86
|
||||
HIGH_CHIME = 0x87
|
||||
|
||||
class CanBus(object):
|
||||
def __init__(self):
|
||||
self.powertrain = 0
|
||||
|
||||
@@ -25,17 +25,12 @@ from selfdrive.controls.lib.latcontrol import LatControl
|
||||
from selfdrive.controls.lib.alertmanager import AlertManager
|
||||
from selfdrive.controls.lib.vehicle_model import VehicleModel
|
||||
from selfdrive.controls.lib.driver_monitor import DriverStatus
|
||||
from selfdrive.locationd.calibration_values import Calibration, Filter
|
||||
|
||||
ThermalStatus = log.ThermalData.ThermalStatus
|
||||
State = log.Live100Data.ControlState
|
||||
|
||||
|
||||
class Calibration:
|
||||
UNCALIBRATED = 0
|
||||
CALIBRATED = 1
|
||||
INVALID = 2
|
||||
|
||||
|
||||
def isActive(state):
|
||||
"""Check if the actuators are enabled"""
|
||||
return state in [State.enabled, State.softDisabling]
|
||||
@@ -293,7 +288,10 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last,
|
||||
extra_text_1, extra_text_2 = "", ""
|
||||
if e == "calibrationIncomplete":
|
||||
extra_text_1 = str(cal_perc) + "%"
|
||||
extra_text_2 = "35 kph" if is_metric else "15 mph"
|
||||
if is_metric:
|
||||
extra_text_2 = str(int(round(Filter.MIN_SPEED * CV.MS_TO_KPH))) + " kph"
|
||||
else:
|
||||
extra_text_2 = str(int(round(Filter.MIN_SPEED * CV.MS_TO_MPH))) + " mph"
|
||||
AM.add(str(e) + "Permanent", enabled, extra_text_1=extra_text_1, extra_text_2=extra_text_2)
|
||||
|
||||
AM.process_alerts(sec_since_boot())
|
||||
|
||||
11
selfdrive/locationd/calibration_values.py
Normal file
11
selfdrive/locationd/calibration_values.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import math
|
||||
|
||||
class Filter:
|
||||
MIN_SPEED = 7 # m/s (~15.5mph)
|
||||
MAX_YAW_RATE = math.radians(3) # per second
|
||||
|
||||
class Calibration:
|
||||
UNCALIBRATED = 0
|
||||
CALIBRATED = 1
|
||||
INVALID = 2
|
||||
|
||||
@@ -3,10 +3,10 @@ import os
|
||||
import zmq
|
||||
import cv2
|
||||
import copy
|
||||
import math
|
||||
import json
|
||||
import numpy as np
|
||||
import selfdrive.messaging as messaging
|
||||
from selfdrive.locationd.calibration_values import Calibration, Filter
|
||||
from selfdrive.swaglog import cloudlog
|
||||
from selfdrive.services import service_list
|
||||
from common.params import Params
|
||||
@@ -17,8 +17,6 @@ from common.transformations.camera import view_frame_from_device_frame, get_view
|
||||
eon_intrinsics, get_calib_from_vp, normalize, denormalize, H, W
|
||||
|
||||
|
||||
MIN_SPEED_FILTER = 7 # m/s (~15.5mph)
|
||||
MAX_YAW_RATE_FILTER = math.radians(3) # per second
|
||||
FRAMES_NEEDED = 120 # allow to update VP every so many frames
|
||||
VP_CYCLES_NEEDED = 2
|
||||
CALIBRATION_CYCLES_NEEDED = FRAMES_NEEDED * VP_CYCLES_NEEDED
|
||||
@@ -42,12 +40,6 @@ c_code += "\n" + open(os.path.join(EXTERNAL_PATH, "get_vp.c")).read()
|
||||
ffi, lib = ffi_wrap('get_vp', c_code, c_header)
|
||||
|
||||
|
||||
class Calibration:
|
||||
UNCALIBRATED = 0
|
||||
CALIBRATED = 1
|
||||
INVALID = 2
|
||||
|
||||
|
||||
def increment_grid_c(grid, lines, n):
|
||||
lib.increment_grid(ffi.cast("double *", grid.ctypes.data),
|
||||
ffi.cast("double *", lines.ctypes.data),
|
||||
@@ -131,8 +123,8 @@ class Calibrator(object):
|
||||
|
||||
def update(self, uvs, yaw_rate, speed):
|
||||
if len(uvs) < 10 or \
|
||||
abs(yaw_rate) > MAX_YAW_RATE_FILTER or \
|
||||
speed < MIN_SPEED_FILTER:
|
||||
abs(yaw_rate) > Filter.MAX_YAW_RATE or \
|
||||
speed < Filter.MIN_SPEED:
|
||||
return
|
||||
rot_speeds = np.array([0.,0.,-yaw_rate])
|
||||
uvs[:,1,:] = denormalize(correct_pts(normalize(uvs[:,1,:]), rot_speeds, self.dt))
|
||||
|
||||
Reference in New Issue
Block a user