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

Subaru: driver torque sensor Nm scaling factor and unit #1198

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion opendbc/car/subaru/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def update(self, cp, cp_cam, _, cp_body, __) -> structs.CarState:
# ideally we get this from the car, but unclear if it exists. diagnostic software doesn't even have it
ret.steeringRateDeg = self.angle_rate_calulator.update(ret.steeringAngleDeg, cp.vl["Steering_Torque"]["COUNTER"])

ret.steeringTorque = cp.vl["Steering_Torque"]["Steer_Torque_Sensor"]
ret.steeringTorque = cp.vl["Steering_Torque_2"]["Steer_Torque_Sensor"]
ret.steeringTorqueEps = cp.vl["Steering_Torque"]["Steer_Torque_Output"]

steer_threshold = 75 if self.CP.flags & SubaruFlags.PREGLOBAL else 80
Expand Down Expand Up @@ -169,6 +169,7 @@ def get_can_parser(CP):
# sig_address, frequency
("Dashlights", 10),
("Steering_Torque", 50),
("Steering_Torque_2", 50),
("BodyInfo", 1),
("Brake_Pedal", 50),
]
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/subaru/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, CP):
self.STEER_DELTA_DOWN = 70 # torque decrease per refresh
self.STEER_DRIVER_ALLOWANCE = 60 # allowed driver torque before start limiting
self.STEER_DRIVER_MULTIPLIER = 50 # weight driver torque heavily
self.STEER_DRIVER_FACTOR = 1 # from dbc
self.STEER_DRIVER_FACTOR = 0.012 # from dbc

if CP.flags & SubaruFlags.GLOBAL_GEN2:
self.STEER_MAX = 1000
Expand Down
2 changes: 1 addition & 1 deletion opendbc/dbc/generator/subaru/_subaru_global.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ BO_ 280 Steering_Torque_2: 8 XXX
SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX
SG_ Steer_Torque_Output : 13|11@1- (-10,0) [0|255] "" XXX
SG_ Signal1 : 24|8@1+ (1,0) [0|511] "" XXX
SG_ Steer_Torque_Sensor : 45|11@1- (-1,0) [0|255] "" XXX
SG_ Steer_Torque_Sensor : 45|11@1- (-0.012,0) [0|255] "Nm" XXX
SG_ Steering_Active : 61|1@0+ (1,0) [0|1] "" XXX
SG_ Steering_Disabled : 63|1@1+ (1,0) [0|1] "" XXX

Expand Down
2 changes: 1 addition & 1 deletion opendbc/dbc/subaru_global_2017_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ BO_ 280 Steering_Torque_2: 8 XXX
SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX
SG_ Steer_Torque_Output : 13|11@1- (-10,0) [0|255] "" XXX
SG_ Signal1 : 24|8@1+ (1,0) [0|511] "" XXX
SG_ Steer_Torque_Sensor : 45|11@1- (-1,0) [0|255] "" XXX
SG_ Steer_Torque_Sensor : 45|11@1- (-0.012,0) [0|255] "Nm" XXX
SG_ Steering_Active : 61|1@0+ (1,0) [0|1] "" XXX
SG_ Steering_Disabled : 63|1@1+ (1,0) [0|1] "" XXX

Expand Down
2 changes: 1 addition & 1 deletion opendbc/dbc/subaru_global_2020_hybrid_generated.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ BO_ 280 Steering_Torque_2: 8 XXX
SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" XXX
SG_ Steer_Torque_Output : 13|11@1- (-10,0) [0|255] "" XXX
SG_ Signal1 : 24|8@1+ (1,0) [0|511] "" XXX
SG_ Steer_Torque_Sensor : 45|11@1- (-1,0) [0|255] "" XXX
SG_ Steer_Torque_Sensor : 45|11@1- (-0.012,0) [0|255] "Nm" XXX
SG_ Steering_Active : 61|1@0+ (1,0) [0|1] "" XXX
SG_ Steering_Disabled : 63|1@1+ (1,0) [0|1] "" XXX

Expand Down
Loading