diff --git a/panda/board/drivers/can.h b/panda/board/drivers/can.h index 233b99027b231c..db9f41ee715a29 100644 --- a/panda/board/drivers/can.h +++ b/panda/board/drivers/can.h @@ -84,7 +84,7 @@ int can_err_cnt = 0; CAN_TypeDef *cans[] = {CAN1, CAN2, CAN3}; uint8_t bus_lookup[] = {0,1,2}; uint8_t can_num_lookup[] = {0,1,2,-1}; - int8_t can_forwarding[] = {1,-1,-1,-1}; + int8_t can_forwarding[] = {2,-1,-1,-1}; uint32_t can_speed[] = {5000, 5000, 5000, 333}; bool can_autobaud_enabled[] = {false, false, false, false}; #define CAN_MAX 3 diff --git a/selfdrive/car/hyundai/camstate.py b/selfdrive/car/hyundai/camstate.py index 8d9e56b5d3333b..babda7cf5c35d8 100644 --- a/selfdrive/car/hyundai/camstate.py +++ b/selfdrive/car/hyundai/camstate.py @@ -27,7 +27,7 @@ def get_can_parser2(CP): ("LKAS12", 10) # LKAS12 = 10Hz ] - return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 1) + return CANParser(DBC[CP.carFingerprint]['pt'], signals, checks, 2) class CamState(object): diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index a0580e25f9d939..747d5a87880b46 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -136,13 +136,13 @@ def update(self, sendcan, enabled, CS, frame, actuators, CamS): lkas11_byte3 = CamS.lkas11_b3 # When LKAS Forward is disabled, we generate the entire LKAS message else: - lkas11_byte0 = self.lanes + 0x2 + lkas11_byte0 = self.lanes + 0x06 lkas11_byte1 = 0x00 lkas11_byte2 = apply_steer_a lkas11_byte3 = apply_steer_b lkas11_byte4 = (self.idx * 16) + 0x04 lkas11_byte5 = 0x00 - lkas11_byte7 = 0x18 + lkas11_byte7 = 0x02 diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 88619ea68ff5c5..cd9eaf8d73ffee 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -132,8 +132,8 @@ def update(self, cp): # There is a 2% error on Sorento GT due to slightly larger wheel diameter compared to poverty packs. # Dash assumes about 4% which is excessive. Using 3% to be safe - if self.car_fingerprint == CAR.SORENTO: - self.v_wheel = self.v_wheel * 1.03 + if self.car_fingerprint == CAR.GENESIS: + self.v_wheel = self.v_wheel * 1.075 self.low_speed_lockout = self.v_wheel < 1.0 # Kalman filter diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 308e6c8d6284ed..101693fa568876 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -63,6 +63,16 @@ def get_params(candidate, fingerprint): ret.safetyModel = car.CarParams.SafetyModels.hyundai # pedal + # FIXME: hardcoding honda civic 2016 touring params so they can be used to + # scale unknown params for other cars + mass_civic = 2923 * CV.LB_TO_KG + std_cargo + wheelbase_civic = 2.70 + centerToFront_civic = wheelbase_civic * 0.4 + centerToRear_civic = wheelbase_civic - centerToFront_civic + rotationalInertia_civic = 2500 + tireStiffnessFront_civic = 192150 + tireStiffnessRear_civic = 202500 + ret.enableCruise = False rotationalInertia = 2500 @@ -74,21 +84,22 @@ def get_params(candidate, fingerprint): ret.steerActuatorDelay = 0.1 # Default delay, Prius has larger delay #borrowing a lot from corolla, given similar car size - ret.steerKf = 0.00008 # full torque for 20 deg at 80mph means 0.00007818594 - ret.steerRateCost = 1. + ret.steerKf = 0.00004 # full torque for 20 deg at 80mph means 0.00007818594 + ret.steerRateCost = 0.5 stop_and_go = True - ret.mass = 1985 + std_cargo - ret.wheelbase = 2.78 - ret.steerRatio = 15.0 - ret.steerKpV, ret.steerKiV = [[0.20], [0.007]] + ret.mass = 2060 + std_cargo + ret.wheelbase = 3.01 + ret.steerRatio = 16.5 + ret.steerKpV, ret.steerKiV = [[0.16], [0.007]] ret.centerToFront = ret.wheelbase * 0.4 + tire_stiffness_factor = 1. ret.longPidDeadzoneBP = [0., 9.] ret.longPidDeadzoneV = [0., .15] # 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. - ret.minEnableSpeed = -1. + ret.minEnableSpeed = 56 * CV.KPH_TO_MS centerToRear = ret.wheelbase - ret.centerToFront # TODO: get actual value, for now starting with reasonable value for @@ -97,8 +108,12 @@ def get_params(candidate, fingerprint): # TODO: start from empirically derived lateral slip stiffness for the civic and scale by # mass and CG position, so all cars will have approximately similar dyn behaviors - ret.tireStiffnessFront = tireStiffnessFront * ret.mass * (centerToRear / ret.wheelbase) - ret.tireStiffnessRear = tireStiffnessRear * ret.mass * (ret.centerToFront / ret.wheelbase) + ret.tireStiffnessFront = (tireStiffnessFront_civic * tire_stiffness_factor) * \ + ret.mass / mass_civic * \ + (centerToRear / ret.wheelbase) / (centerToRear_civic / wheelbase_civic) + ret.tireStiffnessRear = (tireStiffnessRear_civic * tire_stiffness_factor) * \ + ret.mass / mass_civic * \ + (ret.centerToFront / ret.wheelbase) / (centerToFront_civic / wheelbase_civic) # no rear steering, at least on the listed cars above ret.steerRatioRear = 0.