Skip to content

Commit

Permalink
increase steer rate limits and use filtered steer rate signal
Browse files Browse the repository at this point in the history
  • Loading branch information
dzid26 committed Aug 20, 2024
1 parent 732980d commit 8174df6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions board/safety/safety_bmw.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define BMW_EngineAndBrake 0xA8
#define BMW_AccPedal 0xAA
#define BMW_Speed 0x1A0
#define BMW_SteeringWheelAngle 0xC4
#define BMW_SteeringWheelAngl_slow 0xC8
#define BMW_CruiseControlStatus 0x200
#define BMW_DynamicCruiseControlStatus 0x193
#define BMW_CruiseControlStalk 0x194
Expand All @@ -17,7 +17,7 @@ RxCheck bmw_rx_checks[] = { // todo add .check_checksum and .max_counter
{.msg = {{BMW_EngineAndBrake, BMW_PT_CAN, 8, .frequency = 100U}, { 0 }, { 0 }}},
{.msg = {{BMW_AccPedal, BMW_PT_CAN, 8, .frequency = 100U}, { 0 }, { 0 }}},
{.msg = {{BMW_Speed, BMW_PT_CAN, 8, .frequency = 50U}, { 0 }, { 0 }}},
{.msg = {{BMW_SteeringWheelAngle, BMW_PT_CAN, 7, .frequency = 100U}, { 0 }, { 0 }}},
{.msg = {{BMW_SteeringWheelAngl_slow, BMW_PT_CAN, 6, .frequency = 5U}, { 0 }, { 0 }}},
{.msg = {{BMW_TransmissionDataDisplay, BMW_PT_CAN, 6, .frequency = 5U}, { 0 }, { 0 }}},
// todo cruise control type dependant, use param:
// {.msg = {{BMW_CruiseControlStatus, BMW_PT_CAN, 8, .frequency = 5U}, { 0 }, { 0 }}},
Expand Down Expand Up @@ -55,12 +55,12 @@ const struct lookup_t BMW_LOOKUP_MAX_ANGLE = {


const struct lookup_t BMW_ANGLE_RATE_WINDUP = { // deg/s windup rate limit
{0., 5., 15.}, // m/s
{500., 80., 15.}}; // deg/s
{0., 5., 25.}, // m/s
{500., 80., 40.}}; // deg/s

const struct lookup_t BMW_ANGLE_RATE_UNWIND = { // deg/s unwind rate limit
{0., 5., 15.}, // m/s
{500., 350., 40.}}; // deg/s
{0., 5., 25.}, // m/s
{500., 350., 50.}}; // deg/s

const struct lookup_t BMW_MAX_TQ_RATE = {
{0., 5., 15.}, // m/s
Expand Down Expand Up @@ -133,7 +133,7 @@ static void bmw_rx_hook(const CANPacket_t *to_push) {
}

//get latest steering wheel angle rate
if ((addr == BMW_SteeringWheelAngle) && (bus == BMW_PT_CAN)) {
if ((addr == BMW_SteeringWheelAngl_slow) && (bus == BMW_PT_CAN)) {
float meas_angle = to_signed((GET_BYTE(to_push, 1) << 8) | GET_BYTE(to_push, 0), 16) * CAN_BMW_ANGLE_FAC; // deg
float angle_rate = to_signed((GET_BYTE(to_push, 4) << 8) | GET_BYTE(to_push, 3), 16) * CAN_BMW_ANGLE_FAC; // deg/s
// todo use common steer_angle_cmd_checks()
Expand Down

0 comments on commit 8174df6

Please sign in to comment.