From 102c30985a2e4b0d819f8b30a28aac6c94a08d1d Mon Sep 17 00:00:00 2001 From: wirelessnet2 <37725998+wirelessnet2@users.noreply.github.com> Date: Sun, 19 Jul 2020 21:48:57 -0400 Subject: [PATCH] Base Package --- opendbc/can/parser.cc | 15 +- ...onda_clarity_hybrid_2018_can_generated.dbc | 390 ++++++++++++++++++ panda/board/drivers/harness.h | 2 +- panda/board/main.c | 6 +- panda/board/safety/safety_honda.h | 7 +- selfdrive/car/car_helpers.py | 8 +- selfdrive/car/honda/carcontroller.py | 13 +- selfdrive/car/honda/carstate.py | 21 +- selfdrive/car/honda/hondacan.py | 51 ++- selfdrive/car/honda/interface.py | 23 +- selfdrive/car/honda/values.py | 7 + 11 files changed, 507 insertions(+), 36 deletions(-) create mode 100644 opendbc/honda_clarity_hybrid_2018_can_generated.dbc diff --git a/opendbc/can/parser.cc b/opendbc/can/parser.cc index 5addd4168176e6..bc50eb83fb12fa 100644 --- a/opendbc/can/parser.cc +++ b/opendbc/can/parser.cc @@ -178,8 +178,19 @@ void CANParser::UpdateCans(uint64_t sec, const capnp::List::Rea for (int i = 0; i < msg_count; i++) { auto cmsg = cans[i]; if (cmsg.getSrc() != bus) { - // DEBUG("skip %d: wrong bus\n", cmsg.getAddress()); - continue; + //Clarity: This allows some messages to arrive on the wrong bus. -wirelessnet2 + if ((bus == 0) && (cmsg.getSrc() == 2)) { + if ((cmsg.getAddress() == 399) || (cmsg.getAddress() == 892)) { + DEBUG("%d: processing msg from bus 2\n", cmsg.getAddress()); + } else { + DEBUG("%d: not processing msg from bus 2\n", cmsg.getAddress()); + continue; + } + } + else { + DEBUG("%d: wrong bus (%d) wanted %d\n", cmsg.getAddress(), cmsg.getSrc(), bus); + continue; + } } auto state_it = message_states.find(cmsg.getAddress()); if (state_it == message_states.end()) { diff --git a/opendbc/honda_clarity_hybrid_2018_can_generated.dbc b/opendbc/honda_clarity_hybrid_2018_can_generated.dbc new file mode 100644 index 00000000000000..329d5b742eb776 --- /dev/null +++ b/opendbc/honda_clarity_hybrid_2018_can_generated.dbc @@ -0,0 +1,390 @@ +CM_ "AUTOGENERATED FILE, DO NOT EDIT" + + +CM_ "Imported file _honda_2017.dbc starts here" +VERSION "" + + +NS_ : + NS_DESC_ + CM_ + BA_DEF_ + BA_ + VAL_ + CAT_DEF_ + CAT_ + FILTER + BA_DEF_DEF_ + EV_DATA_ + ENVVAR_DATA_ + SGTYPE_ + SGTYPE_VAL_ + BA_DEF_SGTYPE_ + BA_SGTYPE_ + SIG_TYPE_REF_ + VAL_TABLE_ + SIG_GROUP_ + SIG_VALTYPE_ + SIGTYPE_VALTYPE_ + BO_TX_BU_ + BA_DEF_REL_ + BA_REL_ + BA_DEF_DEF_REL_ + BU_SG_REL_ + BU_EV_REL_ + BU_BO_REL_ + SG_MUL_VAL_ + +BU_: EBCM ADAS PCM EPS VSA SCM BDY XXX EPB EON + +BO_ 344 ENGINE_DATA: 8 PCM + SG_ XMISSION_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ XMISSION_SPEED2 : 39|16@0+ (0.01,0) [0|250] "kph" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + SG_ ODOMETER : 55|8@0+ (0.010588,0) [0|255] "km" XXX + +BO_ 380 POWERTRAIN_DATA: 8 PCM + SG_ PEDAL_GAS : 7|8@0+ (1,0) [0|255] "" EON + SG_ ENGINE_RPM : 23|16@0+ (1,0) [0|15000] "rpm" EON + SG_ GAS_PRESSED : 39|1@0+ (1,0) [0|1] "" EON + SG_ ACC_STATUS : 38|1@0+ (1,0) [0|1] "rpm" EON + SG_ BOH_17C : 37|5@0+ (1,0) [0|1] "rpm" EON + SG_ BRAKE_SWITCH : 32|1@0+ (1,0) [0|1] "rpm" EON + SG_ BOH2_17C : 47|10@0+ (1,0) [0|1] "rpm" EON + SG_ BRAKE_PRESSED : 53|1@0+ (1,0) [0|1] "" EON + SG_ BOH3_17C : 52|5@0+ (1,0) [0|1] "rpm" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + + BO_ 427 STEER_MOTOR_TORQUE: 3 EPS + SG_ CONFIG_VALID : 7|1@0+ (1,0) [0|1] "" EON + SG_ MOTOR_TORQUE : 1|10@0+ (1,0) [0|256] "" EON + SG_ OUTPUT_DISABLED : 22|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 19|4@0+ (1,0) [0|15] "" EON + +BO_ 432 STANDSTILL: 7 VSA + SG_ CONTROLLED_STANDSTILL : 0|1@0+ (1,0) [0|1] "" EON + SG_ WHEELS_MOVING : 12|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_1 : 11|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_ERROR_2 : 9|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 464 WHEEL_SPEEDS: 8 VSA + SG_ WHEEL_SPEED_FL : 7|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_FR : 8|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RL : 25|15@0+ (0.01,0) [0|250] "kph" EON + SG_ WHEEL_SPEED_RR : 42|15@0+ (0.01,0) [0|250] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 490 VEHICLE_DYNAMICS: 8 VSA + SG_ LONG_ACCEL : 23|16@0- (0.0015384,0) [-20|20] "m/s2" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 597 ROUGH_WHEEL_SPEED: 8 VSA + SG_ WHEEL_SPEED_FL : 7|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_FR : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RL : 23|8@0+ (1,0) [0|255] "mph" EON + SG_ WHEEL_SPEED_RR : 31|8@0+ (1,0) [0|255] "mph" EON + SG_ SET_TO_X55 : 39|8@0+ (1,0) [0|255] "" EON + SG_ SET_TO_X55_2 : 47|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 773 SEATBELT_STATUS: 7 BDY + SG_ SEATBELT_DRIVER_LAMP : 7|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_UNLATCHED : 10|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_PASS_LATCHED : 11|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_UNLATCHED : 12|1@0+ (1,0) [0|1] "" EON + SG_ SEATBELT_DRIVER_LATCHED : 13|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_OFF : 14|1@0+ (1,0) [0|1] "" EON + SG_ PASS_AIRBAG_ON : 15|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 777 LOCK_STATUS: 8 XXX + SG_ DOORS_UNLOCKED : 54|1@0+ (1,0) [0|1] "" EON + SG_ DOORS_LOCKED : 55|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 780 ACC_HUD: 8 ADAS + SG_ PCM_SPEED : 7|16@0+ (0.01,0) [0|250] "kph" BDY + SG_ PCM_GAS : 23|8@0+ (1,0) [0|127] "" BDY + SG_ CRUISE_SPEED : 31|8@0+ (1,0) [0|255] "" BDY + SG_ DTC_MODE : 39|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 38|1@0+ (1,0) [0|1] "" BDY + SG_ ACC_PROBLEM : 37|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_OFF : 36|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_OFF_2 : 35|1@0+ (1,0) [0|1] "" BDY + SG_ FCM_PROBLEM : 34|1@0+ (1,0) [0|1] "" BDY + SG_ RADAR_OBSTRUCTED : 33|1@0+ (1,0) [0|1] "" BDY + SG_ ENABLE_MINI_CAR : 32|1@0+ (1,0) [0|1] "" BDY + SG_ HUD_DISTANCE : 47|2@0+ (1,0) [0|3] "" BDY + SG_ HUD_LEAD : 45|2@0+ (1,0) [0|3] "" BDY + SG_ BOH_3 : 43|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_4 : 42|1@0+ (1,0) [0|3] "" BDY + SG_ BOH_5 : 41|1@0+ (1,0) [0|3] "" BDY + SG_ CRUISE_CONTROL_LABEL : 40|1@0+ (1,0) [0|3] "" BDY + SG_ SET_ME_X01_2 : 55|1@0+ (1,0) [0|1] "" BDY + SG_ IMPERIAL_UNIT : 54|1@0+ (1,0) [0|1] "" BDY + SG_ HUD_DISTANCE_3 : 52|1@0+ (1,0) [0|1] "" BDY + SG_ CHIME : 51|3@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X01 : 48|1@0+ (1,0) [0|1] "" BDY + SG_ ICONS : 63|2@0+ (1,0) [0|1] "" BDY + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" BDY + +BO_ 804 CRUISE: 8 PCM + SG_ HUD_SPEED_KPH : 7|8@0+ (1,0) [0|255] "kph" EON + SG_ HUD_SPEED_MPH : 15|8@0+ (1,0) [0|255] "mph" EON + SG_ TRIP_FUEL_CONSUMED : 23|16@0+ (1,0) [0|255] "" EON + SG_ CRUISE_SPEED_PCM : 39|8@0+ (1,0) [0|255] "" EON + SG_ BOH2 : 47|8@0- (1,0) [0|255] "" EON + SG_ BOH3 : 55|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 829 LKAS_HUD: 5 ADAS + SG_ CAM_TEMP_HIGH : 7|1@0+ (1,0) [0|255] "" BDY + SG_ SET_ME_X41 : 6|7@0+ (1,0) [0|127] "" BDY + SG_ BOH : 6|7@0+ (1,0) [0|127] "" BDY + SG_ DASHED_LANES : 14|1@0+ (1,0) [0|1] "" BDY + SG_ DTC : 13|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_PROBLEM : 12|1@0+ (1,0) [0|1] "" BDY + SG_ LKAS_OFF : 11|1@0+ (1,0) [0|1] "" BDY + SG_ SOLID_LANES : 10|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_RIGHT : 9|1@0+ (1,0) [0|1] "" BDY + SG_ STEERING_REQUIRED : 8|1@0+ (1,0) [0|1] "" BDY + SG_ BOH : 23|2@0+ (1,0) [0|4] "" BDY + SG_ LDW_PROBLEM : 21|1@0+ (1,0) [0|1] "" BDY + SG_ BEEP : 17|2@0+ (1,0) [0|1] "" BDY + SG_ LDW_ON : 28|1@0+ (1,0) [0|1] "" BDY + SG_ LDW_OFF : 27|1@0+ (1,0) [0|1] "" BDY + SG_ CLEAN_WINDSHIELD : 26|1@0+ (1,0) [0|1] "" BDY + SG_ SET_ME_X48 : 31|8@0+ (1,0) [0|255] "" BDY + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" BDY + +BO_ 892 CRUISE_PARAMS: 8 PCM + SG_ CRUISE_SPEED_OFFSET : 31|8@0- (0.1,0) [-128|127] "kph" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 1029 DOORS_STATUS: 8 BDY + SG_ DOOR_OPEN_FL : 37|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_FR : 38|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RL : 39|1@0+ (1,0) [0|1] "" EON + SG_ DOOR_OPEN_RR : 40|1@0+ (1,0) [0|1] "" EON + SG_ TRUNK_OPEN : 41|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +CM_ SG_ 490 LONG_ACCEL "wheel speed derivative, noisy and zero snapping"; +CM_ SG_ 506 AEB_REQ_1 "set for duration of suspected AEB event"; +CM_ SG_ 773 PASS_AIRBAG_ON "Might just be indicator light"; +CM_ SG_ 773 PASS_AIRBAG_OFF "Might just be indicator light"; +CM_ SG_ 780 CRUISE_SPEED "255 = no speed"; +CM_ SG_ 804 CRUISE_SPEED_PCM "255 = no speed"; +CM_ SG_ 829 BEEP "beeps are pleasant, chimes are for warnngs etc..."; + + +VAL_ 506 FCW 3 "fcw" 2 "fcw" 1 "fcw" 0 "no_fcw" ; +VAL_ 506 CHIME 4 "double_chime" 3 "single_chime" 2 "continuous_chime" 1 "repeating_chime" 0 "no_chime" ; +VAL_ 506 AEB_STATUS 3 "aeb_prepare" 2 "aeb_ready" 1 "aeb_braking" 0 "no_aeb" ; +VAL_ 780 CRUISE_SPEED 255 "no_speed" 252 "stopped" ; +VAL_ 780 HUD_LEAD 3 "acc_off" 2 "solid_car" 1 "dashed_car" 0 "no_car" ; +VAL_ 829 BEEP 3 "single_beep" 2 "triple_beep" 1 "repeated_beep" 0 "no_beep" ; + +CM_ "honda_clarity_hybrid_2018_can.dbc starts here" + + +BO_ 148 KINEMATICS: 8 XXX + SG_ LAT_ACCEL : 7|10@0+ (0.02,-512) [-20|20] "m/s2" EON + SG_ LONG_ACCEL : 24|9@0- (-0.02,0) [-20|20] "m/s2" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 228 STEERING_CONTROL: 5 ADAS + SG_ STEER_TORQUE : 7|16@0- (1,0) [-3840|3840] "" EPS + SG_ STEER_TORQUE_REQUEST : 23|1@0+ (1,0) [0|1] "" EPS + SG_ SET_ME_X00 : 22|7@0+ (1,0) [0|127] "" EPS + SG_ SET_ME_X00_2 : 31|8@0+ (1,0) [0|0] "" EPS + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EPS + SG_ CHECKSUM : 35|4@0+ (1,0) [0|15] "" EPS + +BO_ 304 GAS_PEDAL_2: 8 PCM + SG_ ENGINE_TORQUE_ESTIMATE : 7|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ ENGINE_TORQUE_REQUEST : 23|16@0- (1,0) [-1000|1000] "Nm" EON + SG_ CAR_GAS : 39|8@0+ (1,0) [0|255] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 330 STEERING_SENSORS: 8 EPS + SG_ STEER_ANGLE : 7|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-1,0) [-3000|3000] "deg/s" EON + SG_ STEER_SENSOR_STATUS_1 : 34|1@0+ (1,0) [0|1] "" EON + SG_ STEER_SENSOR_STATUS_2 : 33|1@0+ (1,0) [0|1] "" EON + SG_ STEER_SENSOR_STATUS_3 : 32|1@0+ (1,0) [0|1] "" EON + SG_ STEER_WHEEL_ANGLE : 47|16@0- (-0.1,0) [-500|500] "deg" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 399 STEER_STATUS: 7 EPS + SG_ STEER_TORQUE_SENSOR : 7|16@0- (-1,0) [-31000|31000] "tbd" EON + SG_ STEER_ANGLE_RATE : 23|16@0- (-0.1,0) [-31000|31000] "deg/s" EON + SG_ STEER_STATUS : 39|4@0+ (1,0) [0|15] "" EON + SG_ STEER_CONTROL_ACTIVE : 35|1@0+ (1,0) [0|1] "" EON + SG_ STEER_CONFIG_INDEX : 43|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 53|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 51|4@0+ (1,0) [0|3] "" EON + +BO_ 419 GEARBOX: 8 PCM + SG_ GEAR : 7|8@0+ (1,0) [0|256] "" EON + SG_ GEAR_SHIFTER : 35|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 420 VSA_STATUS: 8 VSA + SG_ USER_BRAKE : 7|16@0+ (0.015625,-1.609375) [0|1000] "" EON + SG_ COMPUTER_BRAKING : 23|1@0+ (1,0) [0|1] "" EON + SG_ ESP_DISABLED : 28|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ACTIVE : 46|1@0+ (1,0) [0|1] "" EON + SG_ BRAKE_HOLD_ENABLED : 45|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 450 EPB_STATUS: 8 EPB + SG_ EPB_ACTIVE : 3|1@0+ (1,0) [0|1] "" EON + SG_ EPB_STATE : 29|2@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|3] "" EON + +BO_ 506 BRAKE_COMMAND: 8 ADAS + SG_ ZEROS_BOH : 7|12@0+ (1,0) [0|3] "" XXX + SG_ BRAKE_PUMP_REQUEST : 11|1@0+ (1,0) [0|1] "" EBCM + SG_ ZEROS_BOH2 : 10|3@0+ (1,0) [0|7] "" XXX + SG_ CRUISE_BOH2 : 23|3@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_OVERRIDE : 20|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_BOH3 : 19|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_FAULT_CMD : 18|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_CANCEL_CMD : 17|1@0+ (1,0) [0|1] "" EBCM + SG_ COMPUTER_BRAKE_REQUEST : 16|1@0+ (1,0) [0|1] "" EBCM + SG_ SET_ME_1 : 31|8@0+ (1,0) [0|1] "" EBCM + SG_ AEB_REQ_1 : 29|1@0+ (1,0) [0|1] "" XXX + SG_ AEB_REQ_2 : 26|3@0+ (1,0) [0|7] "" XXX + SG_ BRAKE_LIGHTS : 39|1@0+ (1,0) [0|1] "" EBCM + SG_ CRUISE_STATES : 38|7@0+ (1,0) [0|1] "" EBCM + SG_ CHIME : 47|3@0+ (1,0) [0|7] "" EBCM + SG_ ZEROS_BOH6 : 44|1@0+ (1,0) [0|1] "" EBCM + SG_ FCW : 43|2@0+ (1,0) [0|3] "" EBCM + SG_ AEB_STATUS : 41|2@0+ (1,0) [0|3] "" XXX + SG_ COMPUTER_BRAKE : 55|10@0+ (1,0) [0|1] "" EBCM + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EBCM + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EBCM + +BO_ 512 GAS_COMMAND: 3 EON + SG_ GAS_COMMAND : 7|16@0+ (0.253984064,-83.3) [0|1] "" INTERCEPTOR + SG_ COUNTER : 21|2@0+ (1,0) [0|3] "" INTERCEPTOR + SG_ CHECKSUM : 19|4@0+ (1,0) [0|3] "" INTERCEPTOR + +BO_ 513 GAS_SENSOR: 5 INTERCEPTOR + SG_ INTERCEPTOR_GAS : 7|16@0+ (0.253984064,-83.3) [0|1] "" EON + SG_ INTERCEPTOR_GAS2 : 23|16@0+ (0.126992032,-83.3) [0|1] "" EON + SG_ COUNTER : 37|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 35|4@0+ (1,0) [0|3] "" EON + +BO_ 545 ECON_STATUS: 6 XXX + SG_ ECON_ON_2 : 37|2@0+ (1,0) [0|3] "" EON + SG_ ECON_ON : 23|1@0+ (1,0) [0|1] "" EON + SG_ CHECKSUM : 43|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 45|2@0+ (1,0) [0|3] "" EON + +BO_ 662 SCM_BUTTONS: 4 SCM + SG_ CRUISE_BUTTONS : 7|3@0+ (1,0) [0|7] "" EON + SG_ CRUISE_SETTING : 3|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 27|4@0+ (1,0) [0|3] "" EON + SG_ COUNTER : 29|2@0+ (1,0) [0|3] "" EON + +BO_ 768 VEHICLE_STATE: 8 ADAS + SG_ SET_ME_XF9 : 7|8@0+ (1,0) [0|255] "" Vector__XXX + SG_ VEHICLE_SPEED : 15|8@0+ (1,0) [0|255] "kph" Vector__XXX + SG_ SET_ME_X8A : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_XD0 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SALTED_WITH_IDX : 39|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 769 VEHICLE_STATE2: 8 ADAS + SG_ SET_ME_X5D : 23|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X02 : 31|8@0+ (1,0) [0|255] "" XXX + SG_ SET_ME_X5F : 39|8@0+ (1,0) [0|255] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 806 SCM_FEEDBACK: 8 SCM + SG_ CMBS_BUTTON : 22|2@0+ (1,0) [0|3] "" EON + SG_ MAIN_ON : 28|1@0+ (1,0) [0|1] "" EON + SG_ RIGHT_BLINKER : 27|1@0+ (1,0) [0|1] "" EON + SG_ LEFT_BLINKER : 26|1@0+ (1,0) [0|1] "" EON + SG_ REVERSE_LIGHT : 18|1@0+ (1,0) [0|1] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +BO_ 862 HIGHBEAM_CONTROL: 8 ADAS + SG_ ZEROS_BOH : 7|50@0+ (1,0) [0|127] "" BDY + SG_ ZEROS_BOH_2 : 48|4@1+ (1,0) [0|15] "" XXX + SG_ HIGHBEAMS_ON : 52|1@0+ (1,0) [0|1] "" XXX + SG_ AUTO_HIGHBEAMS_ACTIVE : 53|1@0+ (1,0) [0|1] "" XXX + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" XXX + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" XXX + +BO_ 884 STALK_STATUS: 8 XXX + SG_ AUTO_HEADLIGHTS : 46|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_HOLD : 47|1@0+ (1,0) [0|1] "" EON + SG_ HIGH_BEAM_FLASH : 45|1@0+ (1,0) [0|1] "" EON + SG_ HEADLIGHTS_ON : 54|1@0+ (1,0) [0|1] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 891 WIPERS: 8 XXX + SG_ WIPERS : 17|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + +BO_ 927 RADAR_HUD: 8 ADAS + SG_ ZEROS_BOH : 7|17@0+ (1,0) [0|127] "" BDY + SG_ APPLY_BRAKES_FOR_CANC : 23|1@0+ (1,0) [0|15] "" BDY + SG_ ZEROS_BOH2 : 31|8@0+ (1,0) [0|127] "" BDY + SG_ RESUME_INSTRUCTION : 21|1@0+ (1,0) [0|15] "" BDY + SG_ ACC_ALERTS : 20|5@0+ (1,0) [0|15] "" BDY + SG_ LEAD_SPEED : 39|9@0+ (1,0) [0|127] "" BDY + SG_ LEAD_STATE : 46|3@0+ (1,0) [0|127] "" BDY + SG_ LEAD_DISTANCE : 43|5@0+ (1,0) [0|31] "" BDY + SG_ ZEROS_BOH3 : 54|7@0+ (1,0) [0|127] "" BDY + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" BDY + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" BDY + +BO_ 1302 XXX_27: 8 XXX + SG_ ODOMETER : 7|24@0+ (1,0) [0|16777215] "km" EON + SG_ COUNTER : 61|2@0+ (1,0) [0|3] "" EON + SG_ CHECKSUM : 59|4@0+ (1,0) [0|15] "" EON + +CM_ SG_ 419 GEAR "10 = reverse, 11 = transition"; +CM_ SG_ 806 REVERSE_LIGHT "Might be reverse gear selected and not the lights"; + +VAL_ 399 STEER_STATUS 5 "tmp_fault" 4 "no_torque_alert_2" 2 "no_torque_alert_1" 0 "normal" ; +VAL_ 419 GEAR_SHIFTER 10 "S" 4 "D" 3 "N" 2 "R" 1 "P" ; +VAL_ 450 EPB_STATE 3 "engaged" 2 "disengaging" 1 "engaging" 0 "disengaged" ; +VAL_ 545 ECON_ON_2 0 "off" 3 "on" ; +VAL_ 662 CRUISE_BUTTONS 7 "tbd" 6 "tbd" 5 "tbd" 4 "accel_res" 3 "decel_set" 2 "cancel" 1 "main" 0 "none" ; +VAL_ 662 CRUISE_SETTING 3 "distance_adj" 2 "tbd" 1 "lkas_button" 0 "none" ; +VAL_ 806 CMBS_BUTTON 3 "pressed" 0 "released" ; +VAL_ 891 WIPERS 4 "High" 2 "Low" 0 "Off" ; +VAL_ 927 ACC_ALERTS 29 "esp_active_acc_canceled" 10 "b_pedal_applied" 9 "speed_too_low" 8 "speed_too_high" 7 "p_brake_applied" 6 "gear_no_d" 5 "seatbelt" 4 "too_steep_downhill" 3 "too_steep_uphill" 2 "too_close" 1 "no_vehicle_ahead" ; + +CM_ "CHFFR_METRIC 330 STEER_ANGLE STEER_ANGLE 0.36 180; CHFFR_METRIC 380 ENGINE_RPM ENGINE_RPM 1 0; CHFFR_METRIC 804 ENGINE_TEMPERATURE ENGINE_TEMPERATURE 1 0"; diff --git a/panda/board/drivers/harness.h b/panda/board/drivers/harness.h index 4aeb41fe6300b0..ed3d430e05151a 100644 --- a/panda/board/drivers/harness.h +++ b/panda/board/drivers/harness.h @@ -91,7 +91,7 @@ void harness_init(void) { set_gpio_mode(current_board->harness_config->GPIO_SBU2, current_board->harness_config->pin_SBU2, MODE_INPUT); // keep busses connected by default - set_intercept_relay(false); + set_intercept_relay(true); //Clarity: Under no circumstances should the relay be closed, otherwise the Clarity's FCANs are bridged together. -wirelessnet2 } else { puts("failed to detect car harness!\n"); } diff --git a/panda/board/main.c b/panda/board/main.c index 497ea5dcdcd0fb..dbae220af15647 100644 --- a/panda/board/main.c +++ b/panda/board/main.c @@ -123,21 +123,21 @@ void set_safety_mode(uint16_t mode, int16_t param) { } switch (mode_copy) { case SAFETY_SILENT: - set_intercept_relay(false); + set_intercept_relay(true); //Clarity: Under no circumstances should the relay be closed, otherwise the Clarity's FCANs are bridged together. -wirelessnet2 if (board_has_obd()) { current_board->set_can_mode(CAN_MODE_NORMAL); } can_silent = ALL_CAN_SILENT; break; case SAFETY_NOOUTPUT: - set_intercept_relay(false); + set_intercept_relay(true); //Clarity: Under no circumstances should the relay be closed, otherwise the Clarity's FCANs are bridged together. -wirelessnet2 if (board_has_obd()) { current_board->set_can_mode(CAN_MODE_NORMAL); } can_silent = ALL_CAN_LIVE; break; case SAFETY_ELM327: - set_intercept_relay(false); + set_intercept_relay(true); //Clarity: Under no circumstances should the relay be closed, otherwise the Clarity's FCANs are bridged together. -wirelessnet2 heartbeat_counter = 0U; if (board_has_obd()) { current_board->set_can_mode(CAN_MODE_OBD_CAN2); diff --git a/panda/board/safety/safety_honda.h b/panda/board/safety/safety_honda.h index 39234462424bff..d554ec9da66a5a 100644 --- a/panda/board/safety/safety_honda.h +++ b/panda/board/safety/safety_honda.h @@ -6,7 +6,7 @@ // accel rising edge // brake rising edge // brake > 0mph -const CanMsg HONDA_N_TX_MSGS[] = {{0xE4, 0, 5}, {0x194, 0, 4}, {0x1FA, 0, 8}, {0x200, 0, 6}, {0x30C, 0, 8}, {0x33D, 0, 5}}; +const CanMsg HONDA_N_TX_MSGS[] = {{0xE4, 2, 5}, {0x1FA, 2, 8}, {0x30C, 2, 8}, {0x33D, 2, 5}, {0x300, 1, 8}, {0x301, 1, 8}, {0x18DA28F1, 2, 8}, {0x18DA30F1, 2, 8}, {0x18DA53F1, 2, 8}}; //Clarity Dual-CAN Nidec Messages const CanMsg HONDA_BG_TX_MSGS[] = {{0xE4, 2, 5}, {0xE5, 2, 8}, {0x296, 0, 4}, {0x33D, 2, 5}}; // Bosch Giraffe const CanMsg HONDA_BH_TX_MSGS[] = {{0xE4, 0, 5}, {0xE5, 0, 8}, {0x296, 1, 4}, {0x33D, 0, 5}}; // Bosch Harness const CanMsg HONDA_BG_LONG_TX_MSGS[] = {{0xE4, 0, 5}, {0x1DF, 0, 8}, {0x1EF, 0, 8}, {0x1FA, 0, 8}, {0x30C, 0, 8}, {0x33D, 0, 5}, {0x39F, 0, 8}, {0x18DAB0F1, 0, 8}}; // Bosch Giraffe w/ gas and brakes @@ -323,6 +323,8 @@ static void honda_bosch_harness_init(int16_t param) { honda_bosch_long = GET_FLAG(param, HONDA_PARAM_BOSCH_LONG); } +//Clarity +/* static int honda_nidec_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { // fwd from car to camera. also fwd certain msgs from camera to car // 0xE4 is steering on all cars except CRV and RDX, 0x194 for CRV and RDX, @@ -347,6 +349,7 @@ static int honda_nidec_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { } return bus_fwd; } +*/ static int honda_bosch_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) { int bus_fwd = -1; @@ -373,7 +376,7 @@ const safety_hooks honda_nidec_hooks = { .rx = honda_rx_hook, .tx = honda_tx_hook, .tx_lin = nooutput_tx_lin_hook, - .fwd = honda_nidec_fwd_hook, + .fwd = default_fwd_hook, //Clarity: Normally OpenPilot forwards messages between the car and the factory ADAS Camera, but we don't have the factory camera connected. If we forward messages between the busses then we bridge the two car main F-CANs. -wirelessnet2 .addr_check = honda_rx_checks, .addr_check_len = sizeof(honda_rx_checks) / sizeof(honda_rx_checks[0]), }; diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py index 478db2375c1bed..a9edb6a62bd9b0 100644 --- a/selfdrive/car/car_helpers.py +++ b/selfdrive/car/car_helpers.py @@ -79,7 +79,7 @@ def fingerprint(logcan, sendcan, has_relay): fixed_fingerprint = os.environ.get('FINGERPRINT', "") skip_fw_query = os.environ.get('SKIP_FW_QUERY', False) - if has_relay and not fixed_fingerprint and not skip_fw_query: + """if has_relay and not fixed_fingerprint and not skip_fw_query: # Vin query only reliably works thorugh OBDII bus = 1 @@ -99,9 +99,9 @@ def fingerprint(logcan, sendcan, has_relay): car_fw = get_fw_versions(logcan, sendcan, bus) fw_candidates = match_fw_to_car(car_fw) - else: - vin = VIN_UNKNOWN - fw_candidates, car_fw = set(), [] + else:""" #Clarity: This makes the Black Panda/Uno take forever to begin sending messages upon Ignition ON due to fingerprinting waiting for VIN and ECU FWs. -wirelessnet2 + vin = VIN_UNKNOWN + fw_candidates, car_fw = set(), [] cloudlog.warning("VIN %s", vin) Params().put("CarVin", vin) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 0438dd76a0e444..64b424cd35e030 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -76,7 +76,7 @@ def process_hud_alert(hud_alert): class CarControllerParams(): def __init__(self, CP): - self.BRAKE_MAX = 1024//4 + self.BRAKE_MAX = 0x1E0 #Clarity: What is this magic value? -wirelessnet2 self.STEER_MAX = CP.lateralParams.torqueBP[-1] # mirror of list (assuming first item is zero) for interp of signed request values assert(CP.lateralParams.torqueBP[0] == 0) @@ -167,10 +167,10 @@ def update(self, enabled, CS, frame, actuators, else: # Send gas and brake commands. if (frame % 2) == 0: - idx = frame // 2 + idx = (frame / 2) % 4 #Clarity: Why do we need this? -wirelessnet2 ts = frame * DT_CTRL pump_on, self.last_pump_ts = brake_pump_hysteresis(apply_brake, self.apply_brake_last, self.last_pump_ts, ts) - can_sends.append(hondacan.create_brake_command(self.packer, apply_brake, pump_on, + can_sends.extend(hondacan.create_brake_command(self.packer, apply_brake, #Clarity: We don't use comma's brake pump algo because it casues jerky braking on Clarity. -wirelessnet2 pcm_override, pcm_cancel_cmd, hud.fcw, idx, CS.CP.carFingerprint, CS.CP.isPandaBlack, CS.stock_brake)) self.apply_brake_last = apply_brake @@ -179,4 +179,11 @@ def update(self, enabled, CS, frame, actuators, # This prevents unexpected pedal range rescaling can_sends.append(create_gas_command(self.packer, apply_gas, idx)) + #Clarity: This allows us to manually drive the radar since we don't have a factory ADAS camera to do so. -wirelessnet2 + # radar at 20Hz, but these msgs need to be sent at 50Hz on ilx (seems like an Acura bug) + radar_send_step = 5 + # if (frame % radar_send_step) == 0: + idx = (frame/radar_send_step) % 4 + can_sends.extend(hondacan.create_radar_commands(self.packer, CS.vEgoRawKph, idx)) + return can_sends diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 4845e482f8a61d..46a28c0b6f8b86 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -1,6 +1,6 @@ from cereal import car from collections import defaultdict -from common.numpy_fast import interp +from common.numpy_fast import interp, clip #Clarity: Clip is needed to support create_radar_commands() in hondacan. -wirelessnet2 from opendbc.can.can_define import CANDefine from opendbc.can.parser import CANParser from selfdrive.config import Conversions as CV @@ -123,6 +123,10 @@ def get_can_signals(CP): ("MAIN_ON", "SCM_FEEDBACK", 0), ("IMPERIAL_UNIT", "HUD_SETTING", 0), ("EPB_STATE", "EPB_STATUS", 0)] + elif CP.carFingerprint == CAR.CLARITY: #Clarity + signals += [("CAR_GAS", "GAS_PEDAL_2", 0), + ("MAIN_ON", "SCM_FEEDBACK", 0), + ("EPB_STATE", "EPB_STATUS", 0)] elif CP.carFingerprint == CAR.ACURA_ILX: signals += [("CAR_GAS", "GAS_PEDAL_2", 0), ("MAIN_ON", "SCM_BUTTONS", 0)] @@ -172,7 +176,7 @@ def __init__(self, CP): self.v_cruise_pcm_prev = 0 self.cruise_mode = 0 - def update(self, cp, cp_cam): + def update(self, cp): #Clarity: cp_cam is the CAN parser for the Factory Camera CAN. Since we've disconnected the factory camera, this is not needed. -wirelessnet2 ret = car.CarState.new_message() # car params @@ -206,7 +210,7 @@ def update(self, cp, cp_cam): # LOW_SPEED_LOCKOUT is not worth a warning ret.steerWarning = steer_status not in ['NORMAL', 'LOW_SPEED_LOCKOUT', 'NO_TORQUE_ALERT_2'] - if self.CP.radarOffCan: + if self.CP.carFingerprint == CAR.CLARITY: #Clarity - This Fixes The Cruise Fault Error Displayed On The EON. But what makes this necessary? -wirelessnet2 self.brake_error = 0 else: self.brake_error = cp.vl["STANDSTILL"]['BRAKE_ERROR_1'] or cp.vl["STANDSTILL"]['BRAKE_ERROR_2'] @@ -223,6 +227,7 @@ def update(self, cp, cp_cam): v_weight = interp(v_wheel, v_weight_bp, v_weight_v) ret.vEgoRaw = (1. - v_weight) * cp.vl["ENGINE_DATA"]['XMISSION_SPEED'] * CV.KPH_TO_MS * speed_factor + v_weight * v_wheel ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) + self.vEgoRawKph = clip(int((1. - v_weight) * cp.vl["ENGINE_DATA"]['XMISSION_SPEED'] * speed_factor + v_weight * v_wheel), 0, 255) #Clarity: This supports create_radar_commands() in hondacan. -wirelessnet2 ret.steeringAngle = cp.vl["STEERING_SENSORS"]['STEER_ANGLE'] ret.steeringRate = cp.vl["STEERING_SENSORS"]['STEER_ANGLE_RATE'] @@ -235,7 +240,7 @@ def update(self, cp, cp_cam): self.brake_hold = cp.vl["VSA_STATUS"]['BRAKE_HOLD_ACTIVE'] if self.CP.carFingerprint in (CAR.CIVIC, CAR.ODYSSEY, CAR.CRV_5G, CAR.ACCORD, CAR.ACCORD_15, CAR.ACCORDH, CAR.CIVIC_BOSCH, - CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT): + CAR.CIVIC_BOSCH_DIESEL, CAR.CRV_HYBRID, CAR.INSIGHT, CAR.CLARITY): #Clarity self.park_brake = cp.vl["EPB_STATUS"]['EPB_STATE'] != 0 main_on = cp.vl["SCM_FEEDBACK"]['MAIN_ON'] elif self.CP.carFingerprint == CAR.ODYSSEY_CHN: @@ -312,15 +317,15 @@ def update(self, cp, cp_cam): if self.CP.carFingerprint in HONDA_BOSCH: ret.stockAeb = bool(cp_cam.vl["ACC_CONTROL"]["AEB_STATUS"] and cp_cam.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5) else: - ret.stockAeb = bool(cp_cam.vl["BRAKE_COMMAND"]["AEB_REQ_1"] and cp_cam.vl["BRAKE_COMMAND"]["COMPUTER_BRAKE"] > 1e-5) + ret.stockAeb = bool(0) #Clarity: Since we don't have the Factory ADAS Camera connected, we will never need these. If we leave it in, it calls on cp_cam and causes errors. -wirelessnet2 if self.CP.carFingerprint in HONDA_BOSCH: self.stock_hud = False ret.stockFcw = False else: - ret.stockFcw = cp_cam.vl["BRAKE_COMMAND"]["FCW"] != 0 - self.stock_hud = cp_cam.vl["ACC_HUD"] - self.stock_brake = cp_cam.vl["BRAKE_COMMAND"] + ret.stockFcw = bool(0) #Clarity: Since we don't have the Factory ADAS Camera connected, we will never need these. If we leave it in, it calls on cp_cam and causes errors. -wirelessnet2 + self.stock_hud = 0 #Clarity: Since we don't have the Factory ADAS Camera connected, we will never need these. If we leave it in, it calls on cp_cam and causes errors. -wirelessnet2 + self.stock_brake = 0 #Clarity: Since we don't have the Factory ADAS Camera connected, we will never need these. If we leave it in, it calls on cp_cam and causes errors. -wirelessnet2 return ret diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 178a452ec63343..146e58e651dafe 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -3,19 +3,28 @@ def get_pt_bus(car_fingerprint, has_relay): - return 1 if car_fingerprint in HONDA_BOSCH and has_relay else 0 + return 1 if car_fingerprint in HONDA_BOSCH and has_relay else 2 #Clarity: We write to CAN2 to control the car. def get_lkas_cmd_bus(car_fingerprint, has_relay): - return 2 if car_fingerprint in HONDA_BOSCH and not has_relay else 0 + return 2 if car_fingerprint in HONDA_BOSCH and not has_relay else 2 #Clarity: We write to CAN2 to control the car. -def create_brake_command(packer, apply_brake, pump_on, pcm_override, pcm_cancel_cmd, fcw, idx, car_fingerprint, has_relay, stock_brake): +def create_brake_command(packer, apply_brake, pcm_override, pcm_cancel_cmd, fcw, idx, car_fingerprint, has_relay, stock_brake): # TODO: do we loose pressure if we keep pump off for long? + commands = [] #Clarity + pump_on = apply_brake > 0 #Clarity: The brake pump algo causes bad braking performance, so we just leave the pump on if the brakes are being called. -wirelessnet2 brakelights = apply_brake > 0 brake_rq = apply_brake > 0 pcm_fault_cmd = False + #Clarity + # This a bit of a hack but clarity brake msg flows into the last byte so + # rather than change the fix() function just set accordingly here. #////I never really understood this. I did not write this comment. The fix() function is old and has been removed. -wirelessnet2 + apply_brake >>= 1 + if apply_brake & 1: + idx += 0x8 + values = { "COMPUTER_BRAKE": apply_brake, "BRAKE_PUMP_REQUEST": pump_on, @@ -25,14 +34,16 @@ def create_brake_command(packer, apply_brake, pump_on, pcm_override, pcm_cancel_ "COMPUTER_BRAKE_REQUEST": brake_rq, "SET_ME_1": 1, "BRAKE_LIGHTS": brakelights, - "CHIME": stock_brake["CHIME"] if fcw else 0, # send the chime for stock fcw + "CHIME": 1 if fcw else 0, #Clarity: This calls on stock_brake[] and causes a DANGEROUS software crash during fcw. Chime = 1 is beeping, Chime = 2 is constant tone. -wirelessnet2 "FCW": fcw << 1, # TODO: Why are there two bits for fcw? "AEB_REQ_1": 0, "AEB_REQ_2": 0, "AEB_STATUS": 0, } bus = get_pt_bus(car_fingerprint, has_relay) - return packer.make_can_msg("BRAKE_COMMAND", bus, values, idx) + #return packer.make_can_msg("BRAKE_COMMAND", bus, values, idx) + commands.append(packer.make_can_msg("BRAKE_COMMAND", bus, values, idx)) + return commands def create_steering_control(packer, apply_steer, lkas_active, car_fingerprint, idx, has_relay): @@ -71,10 +82,10 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, is_metric, idx, 'IMPERIAL_UNIT': int(not is_metric), '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"], + "FCM_OFF": 0, #CLarity: This call on stock_hud[] and causes a crash. -wirelessnet2 + "FCM_OFF_2": 0, #CLarity: This call on stock_hud[] and causes a crash. -wirelessnet2 + "FCM_PROBLEM": 0, #CLarity: This call on stock_hud[] and causes a crash. -wirelessnet2 + "ICONS": 0, #CLarity: This call on stock_hud[] and causes a crash. -wirelessnet2 } commands.append(packer.make_can_msg("ACC_HUD", bus_pt, acc_hud_values, idx)) @@ -89,6 +100,28 @@ def create_ui_commands(packer, pcm_speed, hud, car_fingerprint, is_metric, idx, return commands +#Clarity: Since we don't have a factory ADAS Camera to drive the Radar, we have to create the messages ourselves. -wirelessnet2 +def create_radar_commands(packer, vEgoRawKph, idx): + """Creates an iterable of CAN messages for the radar system.""" + commands = [] + radar_bus = 1 + + msg300 = { + 'SET_ME_XF9': 0xF9, + 'VEHICLE_SPEED': vEgoRawKph, + 'SET_ME_X8A': 0x8A, + 'SET_ME_XD0': 0xD0, + 'SALTED_WITH_IDX': 0x20 if idx == 0 or idx == 3 else 0x00, + } + msg301 = { + 'SET_ME_X5D': 0x5D, #This is 1/3 of the Vehicle State MSG for Clarity. -wirelessnet2 + 'SET_ME_X02': 0x02, #This is 1/3 of the Vehicle State MSG for Clarity. -wirelessnet2 + 'SET_ME_X5F': 0x5F, #This is 1/3 of the Vehicle State MSG for Clarity. -wirelessnet2 + } + commands.append(packer.make_can_msg('VEHICLE_STATE', radar_bus, msg300, idx)) + commands.append(packer.make_can_msg('VEHICLE_STATE2', radar_bus, msg301, idx)) + #THANKS ENERGEE UR THE BEST -wirelessnet2 + return commands def spam_buttons_command(packer, button_val, idx, car_fingerprint, has_relay): values = { diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 7e5c46c895b7a7..90a58dbfa37847 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -131,7 +131,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False, ret.openpilotLongitudinalControl = False else: ret.safetyModel = car.CarParams.SafetyModel.hondaNidec - ret.enableCamera = is_ecu_disconnected(fingerprint[0], FINGERPRINTS, ECU_FINGERPRINT, candidate, Ecu.fwdCamera) or has_relay + ret.enableCamera = True #Clarity: We need to force this to True to make OpenPilot happy. -wirelessnet2 ret.enableGasInterceptor = 0x201 in fingerprint[0] ret.openpilotLongitudinalControl = ret.enableCamera @@ -212,6 +212,21 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False, ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]] else: ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] + + elif candidate == CAR.CLARITY: #Clarity + stop_and_go = True + ret.mass = 4052. * CV.LB_TO_KG + STD_CARGO_KG + ret.wheelbase = 2.75 + ret.centerToFront = ret.wheelbase * 0.4 + ret.steerRatio = 16.50 # was 17.03, 12.72 is end-to-end spec + ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]] + ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] + tire_stiffness_factor = 1. + + ret.longitudinalTuning.kpBP = [0., 5., 35.] + ret.longitudinalTuning.kpV = [3.6, 2.4, 1.5] + ret.longitudinalTuning.kiBP = [0., 35.] + ret.longitudinalTuning.kiV = [0.54, 0.36] elif candidate == CAR.ACURA_ILX: stop_and_go = False @@ -425,11 +440,11 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False, def update(self, c, can_strings): # ******************* do can recv ******************* self.cp.update_strings(can_strings) - self.cp_cam.update_strings(can_strings) + #elf.cp_cam.update_strings(can_strings) #Clarity: cp_cam is the CAN parser for the Factory Camera CAN. Since we've disconnected the factory camera, this is not needed. -wirelessnet2 - ret = self.CS.update(self.cp, self.cp_cam) + ret = self.CS.update(self.cp) #Clarity: cp_cam is the CAN parser for the Factory Camera CAN. Since we've disconnected the factory camera, this is not needed. -wirelessnet2 - ret.canValid = self.cp.can_valid and self.cp_cam.can_valid + ret.canValid = self.cp.can_valid #Clarity: cp_cam is the CAN parser for the Factory Camera CAN. Since we've disconnected the factory camera, this is not needed. -wirelessnet2 ret.yawRate = self.VM.yaw_rate(ret.steeringAngle * CV.DEG_TO_RAD, ret.vEgo) # FIXME: read sendcan for brakelights brakelights_threshold = 0.02 if self.CS.CP.carFingerprint == CAR.CIVIC else 0.1 diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 32bc2d3783014e..391f7160ec5e34 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -30,6 +30,7 @@ class CAR: CIVIC = "HONDA CIVIC 2016 TOURING" CIVIC_BOSCH = "HONDA CIVIC HATCHBACK 2017 SEDAN/COUPE 2019" CIVIC_BOSCH_DIESEL = "HONDA CIVIC SEDAN 1.6 DIESEL" + CLARITY = "HONDA CLARITY 2018 TOURING" ACURA_ILX = "ACURA ILX 2016 ACURAWATCH PLUS" CRV = "HONDA CR-V 2016 TOURING" CRV_5G = "HONDA CR-V 2017 EX" @@ -80,6 +81,9 @@ class CAR: # 2019 Civic Sedan 1.6 i-dtec Diesel European 57: 3, 148: 8, 228: 5, 308: 5, 316: 8, 330: 8, 344: 8, 380: 8, 399: 7, 419: 8, 420: 8, 426: 8, 427: 3, 432: 7, 441: 5, 450: 8, 464: 8, 470: 2, 476: 7, 477: 8, 479: 8, 490: 8, 493: 5, 495: 8, 506: 8, 507: 1, 545: 6, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 801: 3, 804: 8, 806: 8, 808: 8, 815: 8, 824: 8, 825: 4, 829: 5, 837: 5, 862: 8, 881: 8, 882: 4, 884: 8, 887: 8, 888: 8, 891: 8, 902: 8, 918: 7, 927: 8, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1036: 8, 1039: 8, 1064: 7, 1092: 1, 1108: 8, 1115: 2, 1125: 8, 1296: 8, 1302: 8, 1322: 5, 1337: 5, 1361: 5, 1365: 5, 1424: 5, 1600: 5, 1601: 8 }], + CAR.CLARITY: [{ + 57: 3, 304: 8, 312: 8, 315: 7, 330: 8, 344: 8, 380: 8, 387: 8, 388: 8, 409: 8, 419: 8, 420: 8, 427: 3, 428: 8, 432: 7, 441: 5, 450: 8, 464: 8, 476: 8, 478: 3, 506: 8, 538: 5, 545: 5, 547: 6, 559: 3, 597: 8, 662: 4, 773: 7, 777: 8, 780: 8, 795: 8, 800: 8, 804: 8, 806: 8, 808: 8, 815: 8, 829: 5, 831: 5, 832: 3, 833: 8, 856: 7, 862: 8, 884: 8, 891: 8, 900: 8, 904: 8, 905: 8, 906: 4, 923: 2, 927: 8, 929: 8, 976: 8, 983: 8, 1029: 8, 1036: 8, 1070: 8, 1072: 4, 1092: 1, 1108: 8, 1113: 8, 1114: 2, 1125: 8, 1128: 8, 1129: 8, 1302: 8, 1331: 8, 1332: 5, 1341: 5 + }], CAR.CRV: [{ 57: 3, 145: 8, 316: 8, 340: 8, 342: 6, 344: 8, 380: 8, 398: 3, 399: 6, 401: 8, 404: 4, 420: 8, 422: 8, 426: 8, 432: 7, 464: 8, 474: 5, 476: 4, 487: 4, 490: 8, 493: 3, 506: 8, 507: 1, 512: 6, 513: 6, 542: 7, 545: 4, 597: 8, 660: 8, 661: 4, 773: 7, 777: 8, 780: 8, 800: 8, 804: 8, 808: 8, 829: 5, 882: 2, 884: 7, 888: 8, 891: 8, 892: 8, 923: 2, 929: 8, 983: 8, 985: 3, 1024: 5, 1027: 5, 1029: 8, 1033: 5, 1036: 8, 1039: 8, 1057: 5, 1064: 7, 1108: 8, 1125: 8, 1296: 8, 1365: 5, 1424: 5, 1600: 5, 1601: 8, }], @@ -908,6 +912,7 @@ class CAR: CAR.CIVIC: dbc_dict('honda_civic_touring_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.CIVIC_BOSCH: dbc_dict('honda_civic_hatchback_ex_2017_can_generated', None), CAR.CIVIC_BOSCH_DIESEL: dbc_dict('honda_civic_sedan_16_diesel_2019_can_generated', None), + CAR.CLARITY: dbc_dict('honda_clarity_hybrid_2018_can_generated', 'acura_ilx_2016_nidec'), CAR.CRV: dbc_dict('honda_crv_touring_2016_can_generated', 'acura_ilx_2016_nidec'), CAR.CRV_5G: dbc_dict('honda_crv_ex_2017_can_generated', None), CAR.CRV_EU: dbc_dict('honda_crv_executive_2016_can_generated', 'acura_ilx_2016_nidec'), @@ -931,6 +936,7 @@ class CAR: CAR.CIVIC: 1200, CAR.CIVIC_BOSCH: 1200, CAR.CIVIC_BOSCH_DIESEL: 1200, + CAR.CLARITY: 1200, CAR.CRV: 1200, CAR.CRV_5G: 1200, CAR.CRV_EU: 400, @@ -954,6 +960,7 @@ class CAR: CAR.CIVIC: 1., CAR.CIVIC_BOSCH: 1., CAR.CIVIC_BOSCH_DIESEL: 1., + CAR.CLARITY: 1., CAR.CRV: 1.025, CAR.CRV_5G: 1.025, CAR.CRV_EU: 1.025,