openpilot v0.4.5.1 release
parent
37285038d3
commit
1b7b3b4e66
Binary file not shown.
Binary file not shown.
|
@ -263,9 +263,9 @@ struct CarParams {
|
|||
radarNameDEPRECATED @1 :Text;
|
||||
carFingerprint @2 :Text;
|
||||
|
||||
enableSteer @3 :Bool;
|
||||
enableGas @4 :Bool;
|
||||
enableBrake @5 :Bool;
|
||||
enableSteerDEPRECATED @3 :Bool;
|
||||
enableGasInterceptor @4 :Bool;
|
||||
enableBrakeDEPRECATED @5 :Bool;
|
||||
enableCruise @6 :Bool;
|
||||
enableCamera @26 :Bool;
|
||||
enableDsu @27 :Bool; # driving support unit
|
||||
|
|
|
@ -145,7 +145,7 @@ class CarController(object):
|
|||
can_sends.append(
|
||||
hondacan.create_brake_command(self.packer, apply_brake, pcm_override,
|
||||
pcm_cancel_cmd, hud.chime, hud.fcw, idx))
|
||||
if not CS.brake_only:
|
||||
if CS.CP.enableGasInterceptor:
|
||||
# send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas.
|
||||
# This prevents unexpected pedal range rescaling
|
||||
can_sends.append(hondacan.create_gas_command(self.packer, apply_gas, idx))
|
||||
|
|
|
@ -145,7 +145,7 @@ def get_can_signals(CP):
|
|||
signals += [("MAIN_ON", "SCM_BUTTONS", 0)]
|
||||
|
||||
# add gas interceptor reading if we are using it
|
||||
if CP.enableGas:
|
||||
if CP.enableGasInterceptor:
|
||||
signals.append(("INTERCEPTOR_GAS", "GAS_SENSOR", 0))
|
||||
checks.append(("GAS_SENSOR", 50))
|
||||
|
||||
|
@ -159,7 +159,6 @@ def get_can_parser(CP):
|
|||
|
||||
class CarState(object):
|
||||
def __init__(self, CP):
|
||||
self.brake_only = CP.enableCruise
|
||||
self.CP = CP
|
||||
|
||||
self.user_gas, self.user_gas_pressed = 0., 0
|
||||
|
@ -233,7 +232,7 @@ class CarState(object):
|
|||
|
||||
# this is a hack for the interceptor. This is now only used in the simulation
|
||||
# TODO: Replace tests by toyota so this can go away
|
||||
if self.CP.enableGas:
|
||||
if self.CP.enableGasInterceptor:
|
||||
self.user_gas = cp.vl["GAS_SENSOR"]['INTERCEPTOR_GAS']
|
||||
self.user_gas_pressed = self.user_gas > 0 # this works because interceptor read < 0 when pedal position is 0. Once calibrated, this will change
|
||||
|
||||
|
@ -300,8 +299,7 @@ if __name__ == '__main__':
|
|||
class CarParams(object):
|
||||
def __init__(self):
|
||||
self.carFingerprint = "HONDA CIVIC 2016 TOURING"
|
||||
self.enableGas = 0
|
||||
self.enableCruise = 0
|
||||
self.enableGasInterceptor = 0
|
||||
CP = CarParams()
|
||||
CS = CarState(CP)
|
||||
|
||||
|
|
|
@ -146,15 +146,12 @@ class CarInterface(object):
|
|||
|
||||
ret.safetyModel = car.CarParams.SafetyModels.honda
|
||||
|
||||
ret.enableSteer = True
|
||||
ret.enableBrake = True
|
||||
|
||||
ret.enableCamera = not any(x for x in CAMERA_MSGS if x in fingerprint)
|
||||
ret.enableGas = 0x201 in fingerprint
|
||||
ret.enableGasInterceptor = 0x201 in fingerprint
|
||||
print "ECU Camera Simulated: ", ret.enableCamera
|
||||
print "ECU Gas Interceptor: ", ret.enableGas
|
||||
print "ECU Gas Interceptor: ", ret.enableGasInterceptor
|
||||
|
||||
ret.enableCruise = not ret.enableGas
|
||||
ret.enableCruise = not ret.enableGasInterceptor
|
||||
|
||||
# FIXME: hardcoding honda civic 2016 touring params so they can be used to
|
||||
# scale unknown params for other cars
|
||||
|
@ -264,7 +261,7 @@ class CarInterface(object):
|
|||
# min speed to enable ACC. if car can do stop and go, then set enabling speed
|
||||
# to a negative value, so it won't matter. Otherwise, add 0.5 mph margin to not
|
||||
# conflict with PCM acc
|
||||
ret.minEnableSpeed = -1. if (stop_and_go or ret.enableGas) else 25.5 * CV.MPH_TO_MS
|
||||
ret.minEnableSpeed = -1. if (stop_and_go or ret.enableGasInterceptor) else 25.5 * CV.MPH_TO_MS
|
||||
|
||||
centerToRear = ret.wheelbase - ret.centerToFront
|
||||
# TODO: get actual value, for now starting with reasonable value for
|
||||
|
@ -289,7 +286,7 @@ class CarInterface(object):
|
|||
ret.steerMaxV = [1.] # max steer allowed
|
||||
|
||||
ret.gasMaxBP = [0.] # m/s
|
||||
ret.gasMaxV = [0.6] if ret.enableGas else [0.] # max gas allowed
|
||||
ret.gasMaxV = [0.6] if ret.enableGasInterceptor else [0.] # max gas allowed
|
||||
ret.brakeMaxBP = [5., 20.] # m/s
|
||||
ret.brakeMaxV = [1., 0.8] # max brake allowed
|
||||
|
||||
|
@ -329,7 +326,7 @@ class CarInterface(object):
|
|||
|
||||
# gas pedal
|
||||
ret.gas = self.CS.car_gas / 256.0
|
||||
if not self.CP.enableGas:
|
||||
if not self.CP.enableGasInterceptor:
|
||||
ret.gasPressed = self.CS.pedal_gas > 0
|
||||
else:
|
||||
ret.gasPressed = self.CS.user_gas_pressed
|
||||
|
|
|
@ -56,9 +56,6 @@ class CarInterface(object):
|
|||
|
||||
ret.safetyModel = car.CarParams.SafetyModels.toyota
|
||||
|
||||
ret.enableSteer = True
|
||||
ret.enableBrake = True
|
||||
|
||||
# pedal
|
||||
ret.enableCruise = True
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define COMMA_VERSION "0.4.5-release"
|
||||
#define COMMA_VERSION "0.4.5.1-release"
|
||||
|
|
|
@ -15,18 +15,15 @@ from selfdrive.controls.lib.planner import Planner
|
|||
from selfdrive.controls.lib.drive_helpers import learn_angle_offset, \
|
||||
get_events, \
|
||||
create_event, \
|
||||
EventTypes as ET
|
||||
EventTypes as ET, \
|
||||
update_v_cruise, \
|
||||
initialize_v_cruise
|
||||
from selfdrive.controls.lib.longcontrol import LongControl, STARTING_TARGET_SPEED
|
||||
from selfdrive.controls.lib.latcontrol import LatControl
|
||||
from selfdrive.controls.lib.alertmanager import AlertManager
|
||||
from selfdrive.controls.lib.vehicle_model import VehicleModel
|
||||
|
||||
|
||||
V_CRUISE_MAX = 144
|
||||
V_CRUISE_MIN = 8
|
||||
V_CRUISE_DELTA = 8
|
||||
V_CRUISE_ENABLE_MIN = 40
|
||||
|
||||
AWARENESS_TIME = 360. # 6 minutes limit without user touching steering wheels
|
||||
AWARENESS_PRE_TIME = 20. # a first alert is issued 20s before start decelerating the car
|
||||
|
||||
|
@ -125,16 +122,11 @@ def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM
|
|||
# compute conditional state transitions and execute actions on state transitions
|
||||
enabled = isEnabled(state)
|
||||
|
||||
# handle button presses. TODO: this should be in state_control, but a decelCruise press
|
||||
# would have the effect of both enabling and changing speed is checked after the state transition
|
||||
v_cruise_kph_last = v_cruise_kph
|
||||
for b in CS.buttonEvents:
|
||||
if not CP.enableCruise and enabled and not b.pressed:
|
||||
if b.type == "accelCruise":
|
||||
v_cruise_kph -= (v_cruise_kph % V_CRUISE_DELTA) - V_CRUISE_DELTA
|
||||
elif b.type == "decelCruise":
|
||||
v_cruise_kph -= (v_cruise_kph % V_CRUISE_DELTA) + V_CRUISE_DELTA
|
||||
v_cruise_kph = clip(v_cruise_kph, V_CRUISE_MIN, V_CRUISE_MAX)
|
||||
|
||||
# if stock cruise is completely disabled, then we can use our own set speed logic
|
||||
if not CP.enableCruise:
|
||||
v_cruise_kph = update_v_cruise(v_cruise_kph, CS.buttonEvents, enabled)
|
||||
|
||||
# decrease the soft disable timer at every step, as it's reset on
|
||||
# entrance in SOFT_DISABLING state
|
||||
|
@ -155,8 +147,7 @@ def state_transition(CS, CP, state, events, soft_disable_timer, v_cruise_kph, AM
|
|||
else:
|
||||
state = State.enabled
|
||||
AM.add("enable", enabled)
|
||||
# on activation, let's always set v_cruise from where we are, even if PCM ACC is active
|
||||
v_cruise_kph = int(round(max(CS.vEgo * CV.MS_TO_KPH, V_CRUISE_ENABLE_MIN)))
|
||||
v_cruise_kph = initialize_v_cruise(CS.vEgo)
|
||||
|
||||
# ENABLED
|
||||
elif state == State.enabled:
|
||||
|
@ -274,10 +265,6 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last,
|
|||
actuators.steer, actuators.steerAngle = LaC.update(active, CS.vEgo, CS.steeringAngle,
|
||||
CS.steeringPressed, plan.dPoly, angle_offset, VM, PL)
|
||||
|
||||
# send a "steering required alert" if saturation count has reached the limit
|
||||
if LaC.sat_flag and CP.steerLimitAlert:
|
||||
AM.add("steerSaturated", enabled)
|
||||
|
||||
if CP.enableCruise and CS.cruiseState.enabled:
|
||||
v_cruise_kph = CS.cruiseState.speed * CV.MS_TO_KPH
|
||||
|
||||
|
@ -288,6 +275,10 @@ def state_control(plan, CS, CP, state, events, v_cruise_kph, v_cruise_kph_last,
|
|||
state in [State.preEnabled, State.disabled]:
|
||||
awareness_status = 1.
|
||||
|
||||
# send a "steering required alert" if saturation count has reached the limit
|
||||
if LaC.sat_flag and CP.steerLimitAlert:
|
||||
AM.add("steerSaturated", enabled)
|
||||
|
||||
# parse permanent warnings to display constantly
|
||||
for e in get_events(events, [ET.PERMANENT]):
|
||||
AM.add(str(e) + "Permanent", enabled)
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
from common.numpy_fast import clip
|
||||
from cereal import car
|
||||
from common.numpy_fast import clip
|
||||
from selfdrive.config import Conversions as CV
|
||||
|
||||
# kph
|
||||
V_CRUISE_MAX = 144
|
||||
V_CRUISE_MIN = 8
|
||||
V_CRUISE_DELTA = 8
|
||||
V_CRUISE_ENABLE_MIN = 40
|
||||
|
||||
class MPC_COST_LAT:
|
||||
PATH = 1.0
|
||||
|
@ -66,3 +72,21 @@ def learn_angle_offset(lateral_control, v_ego, angle_offset, c_poly, c_prob, ang
|
|||
angle_offset = clip(angle_offset, min_offset, max_offset)
|
||||
|
||||
return angle_offset
|
||||
|
||||
|
||||
def update_v_cruise(v_cruise_kph, buttonEvents, enabled):
|
||||
# handle button presses. TODO: this should be in state_control, but a decelCruise press
|
||||
# would have the effect of both enabling and changing speed is checked after the state transition
|
||||
for b in buttonEvents:
|
||||
if enabled and not b.pressed:
|
||||
if b.type == "accelCruise":
|
||||
v_cruise_kph += V_CRUISE_DELTA - (v_cruise_kph % V_CRUISE_DELTA)
|
||||
elif b.type == "decelCruise":
|
||||
v_cruise_kph -= V_CRUISE_DELTA - ((V_CRUISE_DELTA - v_cruise_kph) % V_CRUISE_DELTA)
|
||||
v_cruise_kph = clip(v_cruise_kph, V_CRUISE_MIN, V_CRUISE_MAX)
|
||||
|
||||
return v_cruise_kph
|
||||
|
||||
|
||||
def initialize_v_cruise(v_ego):
|
||||
return int(round(max(v_ego * CV.MS_TO_KPH, V_CRUISE_ENABLE_MIN)))
|
||||
|
|
Binary file not shown.
|
@ -36,17 +36,19 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
#ifdef DSP
|
||||
char my_path[PATH_MAX+1];
|
||||
readlink("/proc/self/exe", my_path, PATH_MAX);
|
||||
my_path[strlen(my_path)-4] = '\0';
|
||||
LOGW("running from %s", my_path);
|
||||
ssize_t len = readlink("/proc/self/exe", my_path, sizeof(my_path));
|
||||
assert(len > 5);
|
||||
my_path[len-5] = '\0';
|
||||
LOGW("running from %s with PATH_MAX %d", my_path, PATH_MAX);
|
||||
|
||||
char adsp_path[PATH_MAX+1];
|
||||
snprintf(adsp_path, PATH_MAX, "ADSP_LIBRARY_PATH=%s/dsp/gen;/dsp;/system/lib/rfsa/adsp;/system/vendor/lib/rfsa/adsp", my_path);
|
||||
putenv(adsp_path);
|
||||
snprintf(adsp_path, PATH_MAX, "ADSP_LIBRARY_PATH=%s/dsp/gen", my_path);
|
||||
assert(putenv(adsp_path) == 0);
|
||||
|
||||
uint32_t test_leet = 0;
|
||||
assert(calculator_init(&test_leet) == 0);
|
||||
assert(test_leet == 0x1337);
|
||||
LOGW("orbd init complete");
|
||||
#else
|
||||
init_gpyrs();
|
||||
#endif
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -90,7 +90,6 @@ class Plant(object):
|
|||
|
||||
def __init__(self, lead_relevancy=False, rate=100, speed=0.0, distance_lead=2.0):
|
||||
self.rate = rate
|
||||
self.brake_only = False
|
||||
|
||||
if not Plant.messaging_initialized:
|
||||
context = zmq.Context()
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue