Subaru: convert measured angle to centigrees (#1567)

convert to centigrees
This commit is contained in:
Justin Newberry 2023-08-07 09:29:34 -07:00 committed by GitHub
parent 972b0dca94
commit 5801582baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -108,7 +108,8 @@ static int subaru_rx_hook(CANPacket_t *to_push) {
update_sample(&torque_driver, torque_driver_new);
int angle_meas_new = (GET_BYTES(to_push, 4, 2) & 0xFFFFU);
angle_meas_new = ROUND(to_signed(angle_meas_new, 16));
// convert Steering_Torque -> Steering_Angle to centidegrees, to match the ES_LKAS_ANGLE angle request units
angle_meas_new = ROUND(to_signed(angle_meas_new, 16) * 2.17);
update_sample(&angle_meas, angle_meas_new);
}

View File

@ -52,7 +52,7 @@ class TestSubaruSafetyBase(common.PandaSafetyTest, common.DriverTorqueSteeringSa
ALT_BUS = SUBARU_MAIN_BUS
DEG_TO_CAN = -46.08
DEG_TO_CAN = -100
def setUp(self):
self.packer = CANPackerPanda("subaru_global_2017_generated")