Skip to content

Commit

Permalink
Toyota: AEB actuation setup (#1227)
Browse files Browse the repository at this point in the history
* try this

* cleanup

* lil more

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
  • Loading branch information
adeebshihadeh and sshane authored Sep 7, 2024
1 parent c0a9ab5 commit ef7102a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
23 changes: 23 additions & 0 deletions opendbc/car/toyota/toyotacan.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_ty
return packer.make_can_msg("ACC_CONTROL", 0, values)


def create_pcs_commands(packer, accel, active, mass):
values1 = {
"COUNTER": 0,
"FORCE": round(min(accel, 0) * mass * 2),
"STATE": 3 if active else 0,
"BRAKE_STATUS": 0,
"PRECOLLISION_ACTIVE": 1 if active else 0,
}
msg1 = packer.make_can_msg("PRE_COLLISION", 0, values1)

values2 = {
"DSS1GDRV": min(accel, 0), # accel
"PCSALM": 1 if active else 0, # goes high same time as PRECOLLISION_ACTIVE
"IBTRGR": 1 if active else 0, # unknown
"PBATRGR": 1 if active else 0, # noisy actuation bit?
"PREFILL": 1 if active else 0, # goes on and off before DSS1GDRV
"AVSTRGR": 1 if active else 0,
}
msg2 = packer.make_can_msg("PRE_COLLISION_2", 0, values2)

return [msg1, msg2]


def create_acc_cancel_command(packer):
values = {
"GAS_RELEASED": 0,
Expand Down
6 changes: 6 additions & 0 deletions opendbc/dbc/generator/toyota/_toyota_2017.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX

BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX

BO_ 865 CLUTCH: 8 XXX
Expand Down
6 changes: 6 additions & 0 deletions opendbc/dbc/toyota_new_mc_pt_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX

BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX

BO_ 865 CLUTCH: 8 XXX
Expand Down
6 changes: 6 additions & 0 deletions opendbc/dbc/toyota_nodsu_pt_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX

BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX

BO_ 865 CLUTCH: 8 XXX
Expand Down
6 changes: 6 additions & 0 deletions opendbc/dbc/toyota_tnga_k_pt_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX

BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX

BO_ 865 CLUTCH: 8 XXX
Expand Down

0 comments on commit ef7102a

Please sign in to comment.