Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dbc refactor #1

Open
wants to merge 5 commits into
base: 0.7.4_TESTING
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 189 additions & 0 deletions opendbc/honda_clarity_2016_nidec.dbc
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
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_

BS_:

BU_: ADAS RADAR NEO XXX Vector__XXX


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

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

BO_ 1024 RADAR_DIAGNOSTIC: 8 RADAR
SG_ RADAR_STATE : 7|8@0+ (1,0) [0|255] "" NEO

BO_ 1040 XXX_101: 8 RADAR

BO_ 1041 XXX_102: 8 RADAR

BO_ 1042 XXX_103: 8 RADAR

BO_ 1043 XXX_104: 8 RADAR

BO_ 1044 XXX_105: 8 RADAR

BO_ 1045 XXX_106: 8 RADAR

BO_ 1046 XXX_107: 8 RADAR

BO_ 1047 XXX_108: 8 RADAR

BO_ 1056 XXX_109: 8 RADAR

BO_ 1057 XXX_110: 8 RADAR

BO_ 1058 XXX_111: 8 RADAR

BO_ 1059 XXX_112: 8 RADAR

BO_ 1060 XXX_113: 8 RADAR

BO_ 1072 TRACK_0: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1073 TRACK_1: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1074 TRACK_2: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1075 TRACK_3: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1076 TRACK_4: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1077 TRACK_5: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1078 TRACK_6: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1079 TRACK_7: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1080 TRACK_8: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1081 TRACK_9: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1088 TRACK_10: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1089 TRACK_11: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1090 TRACK_12: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1091 TRACK_13: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1092 TRACK_14: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1093 TRACK_15: 8 RADAR
SG_ LONG_DIST : 7|12@0+ (0.0625,0) [0|255.5] "m" NEO
SG_ NEW_TRACK : 11|1@0+ (1,0) [0|1] "" NEO
SG_ LAT_DIST : 9|10@0- (0.0625,0) [0|63.5] "m" NEO
SG_ REL_SPEED : 31|12@0- (0.03125,0) [0|127.5] "m/s" NEO

BO_ 1279 XXX_114: 8 RADAR

BO_ 1280 XXX_115: 8 RADAR

BO_ 1296 XXX_116: 8 RADAR

BO_ 1297 XXX_117: 8 RADAR

BO_TX_BU_ 768 : NEO,ADAS;
BO_TX_BU_ 769 : NEO,ADAS;


CM_ SG_ 1024 RADAR_STATE "need to find out more diagnostic values";
VAL_ 1024 RADAR_STATE 121 "ok" 110 "faulted" 105 "wrong_config" ;
2 changes: 1 addition & 1 deletion selfdrive/car/honda/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,6 @@ def update(self, enabled, CS, frame, actuators, \
radar_send_step = 5
# if (frame % radar_send_step) == 0:
idx = (frame/radar_send_step) % 4
can_sends.extend(hondacan.create_radar_commands(CS.vEgo, CS.CP.carFingerprint, self.new_radar_config, idx))
can_sends.extend(hondacan.create_radar_commands(self.packer, CS.vEgo, CS.CP.carFingerprint, self.new_radar_config, idx))

return can_sends
28 changes: 19 additions & 9 deletions selfdrive/car/honda/hondacan.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,33 @@ 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(v_ego, car_fingerprint, new_radar_config, idx):
def create_radar_commands(packer, v_ego, car_fingerprint, new_radar_config, idx):
"""Creates an iterable of CAN messages for the radar system."""
bus = 1
radar_bus = 1
commands = []
v_ego_kph = np.clip(int(round(v_ego * CV.MS_TO_KPH)), 0, 255)
speed = struct.pack('!B', v_ego_kph)

msg_0x300 = (b'\xf9' + speed + b'\x8a\xd0' +
(b'\x20' if idx == 0 or idx == 3 else b'\x00') +
b'\x00\x00')
msg_0x301 = b"\x00\x00\x5d\x02\x5f\x00\x00" #This is the VEHICLE_STATE_MSG for CAR.CLARITY -wirelessnet2
msg300 = {
'SET_ME_XF9': 0xF9,
'VEHICLE_SPEED': 0x00,
'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 the Clarity. -wirelessnet2
'SET_ME_X02': 0x02, #This is 1/3 of the VEHICLE STATE MSG for the Clarity. -wirelessnet2
'SET_ME_X5F': 0x5F, #This is 1/3 of the VEHICLE STATE MSG for the 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))
#Energee has saved our ass again. All hail energeeeeeeeeeeee -wirelessnet2

commands.append(make_can_msg(0x300, msg_0x300, idx, bus))
commands.append(make_can_msg(0x301, msg_0x301, idx, bus))
return commands


def spam_buttons_command(packer, button_val, idx, car_fingerprint, has_relay):
values = {
'CRUISE_BUTTONS': button_val,
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/honda/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,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.CLARITY: dbc_dict('honda_clarity_hybrid_2018_can_generated', 'honda_clarity_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'),
Expand Down