Skip to content

Commit

Permalink
Fix 0.7 Merge (commaai#247)
Browse files Browse the repository at this point in the history
* Fix ordinals in car.capnp

* Fix ordinals in car.capnp again

* Fix AccState for GM and disable mock radar for now

* Default stock UI for now

* Revert to stock UI for now

* Fix steer_rate_cost

* Fix bus in safety_honda

* Fix self.steer_rate_cost

* Fix steer_rate_cost and other stuff

* Moar pathplanner.py fixes

* Fix gm/carcontroller for fcw var

* Remove FCW_OFF_2 which is missing from some DBCs

* Remove ICONS from hondacan for DBCs that are missing values

* Remove all FCM and extra signals

* Disable Kegman lkas blinker disable for Comma's ALC

* Disable Blinker Eon screen alert in favour of Comma ALCA

* Enable Comma's Auto Lane ChangeEnable Comma's Auto Lane Change

* Reinstate devUI

* Fix GM fcw

* Fix carcontroller.py for GM and Toy
  • Loading branch information
kegman committed Dec 23, 2019
1 parent 827f479 commit eca8b2a
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 36 deletions.
6 changes: 3 additions & 3 deletions cereal/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ struct CarState {
leftBlinker @20 :Bool;
rightBlinker @21 :Bool;
genericToggle @23 :Bool;
distanceToggle @30 :Float32;
laneDepartureToggle @31 :Bool;
distanceToggle @33 :Float32;
laneDepartureToggle @34 :Bool;

# lock info
doorOpen @24 :Bool;
Expand All @@ -151,7 +151,7 @@ struct CarState {
clutchPressed @28 :Bool;

readdistancelines @32 :Float32;
lkMode @29 :Bool;
lkMode @35 :Bool;



Expand Down
1 change: 1 addition & 0 deletions panda/board/safety/safety_honda.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ static void honda_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {

int addr = GET_ADDR(to_push);
int len = GET_LEN(to_push);
int bus = GET_BUS(to_push);

// sample speed
if (addr == 0x158) {
Expand Down
3 changes: 2 additions & 1 deletion selfdrive/car/gm/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from selfdrive.config import Conversions as CV
from selfdrive.car import apply_std_steer_torque_limits
from selfdrive.car.gm import gmcan
from selfdrive.car.gm.values import DBC, SUPERCRUISE_CARS
from selfdrive.car.gm.values import DBC, AccState, SUPERCRUISE_CARS
from opendbc.can.packer import CANPacker

VisualAlert = car.CarControl.HUDControl.VisualAlert
Expand Down Expand Up @@ -77,6 +77,7 @@ def __init__(self, canbus, car_fingerprint):
self.car_fingerprint = car_fingerprint
self.lka_icon_status_last = (False, False)
self.steer_rate_limited = False
self.fcw_count = 0

# Setup detection helper. Routes commands to
# an appropriate CAN bus number.
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/honda/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def update(self, enabled, CS, frame, actuators, \
apply_brake = int(clip(self.brake_last * BRAKE_MAX, 0, BRAKE_MAX - 1))
apply_steer = int(clip(-actuators.steer * STEER_MAX, -STEER_MAX, STEER_MAX))

lkas_active = enabled and not CS.steer_not_allowed and CS.lkMode and not CS.left_blinker_on and not CS.right_blinker_on # add LKAS button to toggle steering
lkas_active = enabled and not CS.steer_not_allowed # and CS.lkMode and not CS.left_blinker_on and not CS.right_blinker_on # add LKAS button to toggle steering

# Send CAN commands.
can_sends = []
Expand Down
4 changes: 0 additions & 4 deletions selfdrive/car/honda/hondacan.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, is_metric, idx,
'IMPERIAL_UNIT': speed_units,
'SET_ME_X01_2': 1,
'SET_ME_X01': 1,
"FCM_OFF": stock_hud["FCM_OFF"],
"FCM_OFF_2": stock_hud["FCM_OFF_2"],
"FCM_PROBLEM": stock_hud["FCM_PROBLEM"],
"ICONS": stock_hud["ICONS"],
}
commands.append(packer.make_can_msg("ACC_HUD", bus_pt, acc_hud_values, idx))

Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ def update(self, c, can_strings):

if not self.CS.lkMode:
events.append(create_event('manualSteeringRequired', [ET.WARNING]))
elif self.CS.lkMode and (self.CS.left_blinker_on or self.CS.right_blinker_on):
events.append(create_event('manualSteeringRequiredBlinkersOn', [ET.WARNING]))
#elif self.CS.lkMode and (self.CS.left_blinker_on or self.CS.right_blinker_on):
# events.append(create_event('manualSteeringRequiredBlinkersOn', [ET.WARNING]))
elif self.CS.steer_error:
events.append(create_event('steerUnavailable', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE, ET.PERMANENT]))
elif self.CS.steer_warning:
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/toyota/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd, hud_alert,
if pcm_cancel_cmd and CS.CP.carFingerprint == CAR.LEXUS_IS:
can_sends.append(create_acc_cancel_command(self.packer))
elif CS.CP.openpilotLongitudinalControl:
can_sends.append(create_accel_command(self.packer, apply_accel, pcm_cancel_cmd, self.standstill_req, lead))
can_sends.append(create_accel_command(self.packer, apply_accel, pcm_cancel_cmd, self.standstill_req, lead, distance))
else:
can_sends.append(create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, distance))

Expand Down
16 changes: 9 additions & 7 deletions selfdrive/controls/lib/pathplanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
LaneChangeState = log.PathPlan.LaneChangeState
LaneChangeDirection = log.PathPlan.LaneChangeDirection

LOG_MPC = os.environ.get('LOG_MPC', True)
LOG_MPC = os.environ.get('LOG_MPC', False)

DESIRES = {
LaneChangeDirection.none: {
Expand Down Expand Up @@ -53,6 +53,7 @@ def __init__(self, CP):
self.setup_mpc()
self.solution_invalid_cnt = 0
self.path_offset_i = 0.0

self.mpc_frame = 0
self.sR_delay_counter = 0
self.steerRatio_new = 0.0
Expand All @@ -73,14 +74,15 @@ def __init__(self, CP):
self.sRBP = [float(kegman.conf['sR_BP0']), float(kegman.conf['sR_BP1'])]

self.steerRateCost_prev = self.steerRateCost
self.setup_mpc(self.steerRateCost)


def setup_mpc(self, steer_rate_cost):
self.setup_mpc()

self.lane_change_state = LaneChangeState.off
self.lane_change_timer = 0.0
self.prev_one_blinker = False



def setup_mpc(self):
self.libmpc = libmpc_py.libmpc
self.libmpc.init(MPC_COST_LAT.PATH, MPC_COST_LAT.LANE, MPC_COST_LAT.HEADING, self.steer_rate_cost)

Expand Down Expand Up @@ -118,7 +120,7 @@ def update(self, sm, pm, CP, VM):
if kegman.conf['tuneGernby'] == "1":
self.steerRateCost = float(kegman.conf['steerRateCost'])
if self.steerRateCost != self.steerRateCost_prev:
self.setup_mpc(self.steerRateCost)
self.setup_mpc()
self.steerRateCost_prev = self.steerRateCost

self.sR = [float(kegman.conf['steerRatio']), (float(kegman.conf['steerRatio']) + float(kegman.conf['sR_boost']))]
Expand Down Expand Up @@ -166,7 +168,7 @@ def update(self, sm, pm, CP, VM):

# State transitions
# off
if False: # self.lane_change_state == LaneChangeState.off and one_blinker and not self.prev_one_blinker:
if self.lane_change_state == LaneChangeState.off and one_blinker and not self.prev_one_blinker:
self.lane_change_state = LaneChangeState.preLaneChange

# pre
Expand Down
12 changes: 1 addition & 11 deletions selfdrive/controls/radard.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ def get_lead(v_ego, ready, clusters, lead_msg, low_speed_override=True):
class RadarD():
def __init__(self, radar_ts, delay=0):
self.current_time = 0
CP = car.CarParams.from_bytes(Params().get("CarParams", block=True))

if CP.radarOffCan:
self.mocked = True
else:
self.mocked = mocked

self.tracks = defaultdict(dict)
self.kalman_params = KalmanParams(radar_ts)
Expand Down Expand Up @@ -190,10 +184,6 @@ def radard_thread(sm=None, pm=None, can_sock=None):
# wait for stats about the car to come in from controls
cloudlog.info("radard is waiting for CarParams")
CP = car.CarParams.from_bytes(Params().get("CarParams", block=True))
if CP.radarOffCan:
mocked = True
else:
mocked = CP.carName == "mock"
cloudlog.info("radard got CarParams")

# import the radar from the fingerprint
Expand All @@ -215,7 +205,7 @@ def radard_thread(sm=None, pm=None, can_sock=None):
rk = Ratekeeper(1.0 / CP.radarTimeStep, print_delay_threshold=None)
RD = RadarD(CP.radarTimeStep, RI.delay)

has_radar = True
has_radar = not CP.radarOffCan

while 1:
can_strings = messaging.drain_sock_raw(can_sock, wait_for_one=True)
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def unblock_stdout():
"proclogd": ("selfdrive/proclogd", ["./proclogd"]),
"boardd": ("selfdrive/boardd", ["./boardd"]), # not used directly
"pandad": "selfdrive.pandad",
"ui": ("selfdrive/ui", ["./ui"]),
"ui": ("selfdrive/ui", ["./start.py"]),
"calibrationd": "selfdrive.locationd.calibrationd",
"paramsd": ("selfdrive/locationd", ["./paramsd"]),
"camerad": ("selfdrive/camerad", ["./camerad"]),
Expand Down
5 changes: 0 additions & 5 deletions selfdrive/ui/SConscript

This file was deleted.

Binary file modified selfdrive/ui/ui
Binary file not shown.

0 comments on commit eca8b2a

Please sign in to comment.