mirror of https://github.com/commaai/panda.git
need to use values[0]
This commit is contained in:
parent
ecd8dc86b6
commit
8f6d68345a
|
@ -178,7 +178,7 @@ static int ford_rx_hook(CANPacket_t *to_push) {
|
|||
// Disable controls if speeds from ABS and PCM ECUs are too far apart.
|
||||
// Signal: Veh_V_ActlEng
|
||||
float filtered_pcm_speed = ((GET_BYTE(to_push, 6) << 8) | GET_BYTE(to_push, 7)) * 0.01 / 3.6;
|
||||
if (ABS(filtered_pcm_speed - vehicle_speed) > FORD_MAX_SPEED_DELTA) {
|
||||
if (ABS(filtered_pcm_speed - vehicle_speed.values[0]) > FORD_MAX_SPEED_DELTA) {
|
||||
controls_allowed = 0;
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ static int ford_rx_hook(CANPacket_t *to_push) {
|
|||
if (addr == MSG_Yaw_Data_FD1) {
|
||||
// Signal: VehYaw_W_Actl
|
||||
float ford_yaw_rate = (((GET_BYTE(to_push, 2) << 8U) | GET_BYTE(to_push, 3)) * 0.0002) - 6.5;
|
||||
float current_curvature = ford_yaw_rate / MAX(vehicle_speed, 0.1);
|
||||
float current_curvature = ford_yaw_rate / MAX(vehicle_speed.values[0], 0.1);
|
||||
// convert current curvature into units on CAN for comparison with desired curvature
|
||||
int current_curvature_can = current_curvature * (float)FORD_STEERING_LIMITS.angle_deg_to_can +
|
||||
((current_curvature > 0.) ? 0.5 : -0.5);
|
||||
|
|
Loading…
Reference in New Issue