mirror of https://github.com/commaai/panda.git
Chrysler: match openpilot standstill check (#1065)
* match openpilot standstill, and fix ram standstill parsing * misra * cmt
This commit is contained in:
parent
788e0b5ac9
commit
19983f13b3
|
@ -28,9 +28,6 @@ const SteeringLimits CHRYSLER_RAM_HD_STEERING_LIMITS = {
|
|||
.type = TorqueMotorLimited,
|
||||
};
|
||||
|
||||
const int CHRYSLER_STANDSTILL_THRSLD = 10; // about 1m/s
|
||||
const int CHRYSLER_RAM_STANDSTILL_THRSLD = 3; // about 1m/s changed from wheel rpm to km/h
|
||||
|
||||
typedef struct {
|
||||
const int EPS_2;
|
||||
const int ESP_1;
|
||||
|
@ -204,16 +201,14 @@ static int chrysler_rx_hook(CANPacket_t *to_push) {
|
|||
}
|
||||
|
||||
// TODO: use the same message for both
|
||||
// update speed
|
||||
// update vehicle moving
|
||||
if ((chrysler_platform != CHRYSLER_PACIFICA) && (bus == 0) && (addr == chrysler_addrs->ESP_8)) {
|
||||
vehicle_speed = (((GET_BYTE(to_push, 4) & 0x3U) << 8) + GET_BYTE(to_push, 5))*0.0078125;
|
||||
vehicle_moving = (int)vehicle_speed > CHRYSLER_RAM_STANDSTILL_THRSLD;
|
||||
vehicle_moving = ((GET_BYTE(to_push, 4) << 8) + GET_BYTE(to_push, 5)) != 0U;
|
||||
}
|
||||
if ((chrysler_platform == CHRYSLER_PACIFICA) && (bus == 0) && (addr == 514)) {
|
||||
int speed_l = (GET_BYTE(to_push, 0) << 4) + (GET_BYTE(to_push, 1) >> 4);
|
||||
int speed_r = (GET_BYTE(to_push, 2) << 4) + (GET_BYTE(to_push, 3) >> 4);
|
||||
vehicle_speed = (speed_l + speed_r) / 2;
|
||||
vehicle_moving = (int)vehicle_speed > CHRYSLER_STANDSTILL_THRSLD;
|
||||
vehicle_moving = (speed_l != 0) || (speed_r != 0);
|
||||
}
|
||||
|
||||
// exit controls on rising edge of gas press
|
||||
|
|
|
@ -74,7 +74,6 @@ class TestChryslerSafety(common.PandaSafetyTest, common.MotorTorqueSteeringSafet
|
|||
|
||||
class TestChryslerRamDTSafety(TestChryslerSafety):
|
||||
TX_MSGS = [[177, 2], [166, 0], [250, 0]]
|
||||
STANDSTILL_THRESHOLD = 3
|
||||
RELAY_MALFUNCTION_ADDR = 166
|
||||
FWD_BLACKLISTED_ADDRS = {2: [166, 250]}
|
||||
|
||||
|
@ -95,7 +94,6 @@ class TestChryslerRamDTSafety(TestChryslerSafety):
|
|||
|
||||
class TestChryslerRamHDSafety(TestChryslerSafety):
|
||||
TX_MSGS = [[629, 0], [630, 0], [570, 2]]
|
||||
STANDSTILL_THRESHOLD = 3
|
||||
RELAY_MALFUNCTION_ADDR = 630
|
||||
FWD_BLACKLISTED_ADDRS = {2: [629, 630]}
|
||||
|
||||
|
|
Loading…
Reference in New Issue