Skip to content

Subaru longitudinal control

martinl edited this page Apr 25, 2023 · 11 revisions

Overview

The project is currently proof of concept in early experimental stages and not safe for testing in public roads.

Openpilot longitudinal control for Subaru global platform works by controlling engine power request (rpm), cruise throttle and cruise brake signals:

  • [ES_Status][Cruise_RPM] - (0...4000) Cruise RPM output for ECM/TCM
  • [ES_Distance][Cruise_Throttle] - (0..4000) output, related to [Throttle][Throttle_Cruise]
  • [ES_Brake][Brake_Pressure] (0..400) - Cruise brake pressure

With openpilot longitudinal control activated, Eyesight remains in ready state, so PCB/AEB and FCW safety features signals are passed through.

It is currently possible to do basic acceleration and braking control by linearly scaling openpilot gas and brake actuators outputs.

TODO

  • acceleration control modeled after stock acc outputs (rpm and throttle output signals) - current implementation is close enough to be usable
  • acceleration limits enforcement (min -3.5 m/s2, max 2.0 m/s2) - using openpilot imu or can ecu signals?
  • longitudinal PID tuning

Details

Openpilot model acceleration outputs (m/s2)

  • actuators.gas (0..1)
  • actuators.brake (0..1)

Related brake signals

  • [Brake_Pedal][Brake_Lights] (0/1) - 1 when brake pedal is pressed or cruise brake active

  • [Brake_Pedal][Brake_Pedal] (0..500) - brake pedal pressure

  • [ES_Brake][Brake_Pressure] - (0..400) Hold: 394 - electric brake pressure

  • [ES_Brake][Cruise_Brake_Lights] - switch on brake lights

  • [ES_Brake][Cruise_Brake_Active] - cruise brake on

  • [ES_Brake][Cruise_Activated] - cruise control activated

  • [ES_Status][Brake_Lights] (0/1) - 1 when brake pedal or electronic brake on

  • [ES_DashStatus][Brake_Lights] (0/1) - 1 when brake pedal or electronic brake on

Related gas/acceleration signals

  • [Throttle][Throttle_Cruise] (0..140)

  • [Throttle][Throttle_Pedal]

  • [Throttle][Throttle_Combo]

  • [Throttle][Engine_RPM]

  • [Transmission][RPM]

  • [ES_Distance][Cruise_Throttle] (0..4000) input for [Throttle][Throttle_Cruise]

  • [ES_Status][Cruise_RPM] - Eyesight RPM output for ECM/TCM

  • [ES_DashStatus][Cruise_State] (0 = normal, 1 = hold+driver brake, 2 = ready, 3 = hold)

Related Eyesight distance outputs

  • [ES_DashStatus][Far_Distance] (0..15) medium distance to object in front @ 10Hz ( Far_Distance Scaling )
  • [ES_Distance][Close_Distance] (0..255) 20Hz close distance to object in front (0..255 = 0..6m) @ 20Hz
  • [ES_Distance][Distance_Swap] (0/1) close distance trigger

GEN2 longitudinal RX signals when using second external panda

panda1 bus0: can0 (car side1, cp)

  • Throttle
  • Brake_Pedal
  • Dashlights
  • BSD_RCTA
  • Transmission
  • Steering_Torque
  • BodyInfo

panda1 bus2: can2 (camera side1, cp_cam)

  • ES_LKAS
  • ES_DashStatus
  • ES_LKAS_State
  • Infotainment_Status

panda2 bus0: can4 (car side2, cp_body)

  • Brake_Status
  • Wheel_Speeds
  • CruiseControl

panda2 bus2: can6 (camera side2, cp_adas)

  • ES_Brake
  • ES_Status
  • ES_Distance

GEN2 longitudinal TX signals when using second external panda

panda1 bus0: can0 (car side1, cp)

  • ES_LKAS
  • ES_LKAS_State
  • ES_DashStatus
  • Infotainment_Status

panda1 bus2: can2 (camera side1, cp_cam)

panda2 bus0: can4 (car side2, cp_body)

  • ES_Brake
  • ES_Status
  • ES_Distance

panda2 bus2: can6 (camera side2, cp_adas)

  • CruiseControl
  • Brake_Status