parent
0bc864b3d5
commit
3517306113
|
@ -70,10 +70,11 @@ static int subaru_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
|
||||||
int torque_driver_new;
|
int torque_driver_new;
|
||||||
if (subaru_global) {
|
if (subaru_global) {
|
||||||
torque_driver_new = ((GET_BYTES_04(to_push) >> 16) & 0x7FF);
|
torque_driver_new = ((GET_BYTES_04(to_push) >> 16) & 0x7FF);
|
||||||
|
torque_driver_new = -1 * to_signed(torque_driver_new, 11);
|
||||||
} else {
|
} else {
|
||||||
torque_driver_new = (GET_BYTE(to_push, 3) >> 5) + (GET_BYTE(to_push, 4) << 3);
|
torque_driver_new = (GET_BYTE(to_push, 3) >> 5) + (GET_BYTE(to_push, 4) << 3);
|
||||||
|
torque_driver_new = to_signed(torque_driver_new, 11);
|
||||||
}
|
}
|
||||||
torque_driver_new = to_signed(torque_driver_new, 11);
|
|
||||||
update_sample(&torque_driver, torque_driver_new);
|
update_sample(&torque_driver, torque_driver_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ static int subaru_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
|
||||||
int desired_torque = ((GET_BYTES_04(to_send) >> bit_shift) & 0x1FFF);
|
int desired_torque = ((GET_BYTES_04(to_send) >> bit_shift) & 0x1FFF);
|
||||||
bool violation = 0;
|
bool violation = 0;
|
||||||
uint32_t ts = TIM2->CNT;
|
uint32_t ts = TIM2->CNT;
|
||||||
desired_torque = to_signed(desired_torque, 13);
|
desired_torque = -1 * to_signed(desired_torque, 13);
|
||||||
|
|
||||||
if (controls_allowed) {
|
if (controls_allowed) {
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class TestSubaruSafety(common.PandaSafetyTest):
|
||||||
self.safety.set_rt_torque_last(t)
|
self.safety.set_rt_torque_last(t)
|
||||||
|
|
||||||
def _torque_driver_msg(self, torque):
|
def _torque_driver_msg(self, torque):
|
||||||
values = {"Steer_Torque_Sensor": -torque, "counter": self.cnt_torque_driver % 4}
|
values = {"Steer_Torque_Sensor": torque, "counter": self.cnt_torque_driver % 4}
|
||||||
self.__class__.cnt_torque_driver += 1
|
self.__class__.cnt_torque_driver += 1
|
||||||
return self.packer.make_can_msg_panda("Steering_Torque", 0, values)
|
return self.packer.make_can_msg_panda("Steering_Torque", 0, values)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class TestSubaruSafety(common.PandaSafetyTest):
|
||||||
return self.packer.make_can_msg_panda("Brake_Pedal", 0, values)
|
return self.packer.make_can_msg_panda("Brake_Pedal", 0, values)
|
||||||
|
|
||||||
def _torque_msg(self, torque):
|
def _torque_msg(self, torque):
|
||||||
values = {"LKAS_Output": -torque}
|
values = {"LKAS_Output": torque}
|
||||||
return self.packer.make_can_msg_panda("ES_LKAS", 0, values)
|
return self.packer.make_can_msg_panda("ES_LKAS", 0, values)
|
||||||
|
|
||||||
def _gas_msg(self, gas):
|
def _gas_msg(self, gas):
|
||||||
|
@ -194,7 +194,7 @@ class TestSubaruLegacySafety(TestSubaruSafety):
|
||||||
return self.packer.make_can_msg_panda("Steering_Torque", 0, values)
|
return self.packer.make_can_msg_panda("Steering_Torque", 0, values)
|
||||||
|
|
||||||
def _torque_msg(self, torque):
|
def _torque_msg(self, torque):
|
||||||
values = {"LKAS_Command": -torque}
|
values = {"LKAS_Command": torque}
|
||||||
return self.packer.make_can_msg_panda("ES_LKAS", 0, values)
|
return self.packer.make_can_msg_panda("ES_LKAS", 0, values)
|
||||||
|
|
||||||
def _gas_msg(self, gas):
|
def _gas_msg(self, gas):
|
||||||
|
|
Loading…
Reference in New Issue