|
|
|
@ -12,17 +12,17 @@ def create_steer_command(packer, steer, steer_req, raw_cnt): |
|
|
|
|
return packer.make_can_msg("STEERING_LKA", 0, values) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_lta_steer_command(packer, apply_steer, steer_angle, driver_torque, steer_req, raw_cnt): |
|
|
|
|
def create_lta_steer_command(packer, apply_steer, steer_angle, driver_torque, steer_req, steering_lta, raw_cnt): |
|
|
|
|
"""Creates a CAN message for the Toyota LTA Steer Command.""" |
|
|
|
|
|
|
|
|
|
percentage = interp(abs(driver_torque), [50, 100], [100, 0]) |
|
|
|
|
apply_steer = interp(percentage, [-10, 100], [steer_angle, apply_steer]) |
|
|
|
|
values = { |
|
|
|
|
"COUNTER": raw_cnt, # 0 to 62 |
|
|
|
|
"SETME_X1": 1, |
|
|
|
|
"SETME_X3": 1, # usually 1, but sometimes 3 (??) |
|
|
|
|
"SETME_X1": steering_lta["SETME_X1"], |
|
|
|
|
"SETME_X3": steering_lta["SETME_X3"], # usually 1, but sometimes 3 (??) |
|
|
|
|
"PERCENTAGE": percentage, # correlated with driver torque |
|
|
|
|
"SETME_X64": 0x64, # ramps to 0 smoothly then back on falling edge of STEER_REQUEST if BIT isn't 1 |
|
|
|
|
"SETME_X64": steering_lta["SETME_X64"], # ramps to 0 smoothly then back on falling edge of STEER_REQUEST if BIT isn't 1 |
|
|
|
|
"ANGLE": apply_steer * 1.5, # TODO: need to understand this better, it's always 1.5-2x higher than angle cmd |
|
|
|
|
"STEER_ANGLE_CMD": apply_steer, # seems to just be desired angle cmd |
|
|
|
|
"STEER_REQUEST": steer_req, # stock system turns off steering after ~20 frames of override, else torque winds up |
|
|
|
|