Skip to content

Commit

Permalink
Car docs: add auto-resume column (commaai#25572)
Browse files Browse the repository at this point in the history
* Move auto resume in sng to car interface

* Update docs

* shorter name, star

* order

* resumes?

* add hidden detail sentence

* good to know this works, but revert

* VW auto resume

* bump cereal to master

* Update ref_commit

* match cereal

* try this

* ?

?

* like this
  • Loading branch information
sshane authored Aug 31, 2022
1 parent c6b749f commit 452d5e4
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 215 deletions.
2 changes: 1 addition & 1 deletion cereal
414 changes: 207 additions & 207 deletions docs/CARS.md

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions selfdrive/car/docs_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
GOOD_TORQUE_THRESHOLD = 1.0 # m/s^2
MODEL_YEARS_RE = r"(?<= )((\d{4}-\d{2})|(\d{4}))(,|$)"

# Makes that lack auto-resume with stock long, and auto resume in any configuration
NO_AUTO_RESUME_STOCK_LONG = {"toyota", "gm"}
NO_AUTO_RESUME = NO_AUTO_RESUME_STOCK_LONG | {"nissan", "subaru"}


class Column(Enum):
MAKE = "Make"
Expand All @@ -23,6 +19,7 @@ class Column(Enum):
FSR_LONGITUDINAL = "No ACC accel below"
FSR_STEERING = "No ALC below"
STEERING_TORQUE = "Steering Torque"
AUTO_RESUME = "Resume from stop"
HARNESS = "Harness"


Expand Down Expand Up @@ -139,6 +136,7 @@ def init(self, CP: car.CarParams, all_footnotes: Dict[Enum, int]):
Column.FSR_LONGITUDINAL: f"{max(self.min_enable_speed * CV.MS_TO_MPH, 0):.0f} mph",
Column.FSR_STEERING: f"{max(self.min_steer_speed * CV.MS_TO_MPH, 0):.0f} mph",
Column.STEERING_TORQUE: Star.EMPTY,
Column.AUTO_RESUME: Star.FULL if CP.autoResumeSng else Star.EMPTY,
Column.HARNESS: self.harness.value,
}

Expand Down Expand Up @@ -166,7 +164,7 @@ def get_detail_sentence(self, CP):
acc = ""
if self.min_enable_speed > 0:
acc = f" <strong>while driving above {self.min_enable_speed * CV.MS_TO_MPH:.0f} mph</strong>"
elif CP.carName not in NO_AUTO_RESUME or (CP.carName in NO_AUTO_RESUME_STOCK_LONG and CP.openpilotLongitudinalControl):
elif CP.autoResumeSng:
acc = " <strong>that automatically resumes from a stop</strong>"

if self.row[Column.STEERING_TORQUE] != Star.FULL:
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
ret = CarInterfaceBase.get_std_params(candidate, fingerprint)
ret.carName = "gm"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)]
ret.autoResumeSng = False

if candidate in EV_CAR:
ret.transmissionType = TransmissionType.direct
Expand Down
5 changes: 4 additions & 1 deletion selfdrive/car/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ def get_std_params(candidate, fingerprint):
ret = car.CarParams.new_message()
ret.carFingerprint = candidate

# Car docs fields
ret.maxLateralAccel = get_torque_params(candidate)['MAX_LAT_ACCEL_MEASURED']
ret.autoResumeSng = True # describes whether car can resume from a stop automatically

# standard ALC params
ret.steerControlType = car.CarParams.SteerControlType.torque
ret.minSteerSpeed = 0.
ret.wheelSpeedFactor = 1.0
ret.maxLateralAccel = get_torque_params(candidate)['MAX_LAT_ACCEL_MEASURED']

ret.pcmCruise = True # openpilot's state is tied to the PCM's cruise state on most cars
ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/nissan/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
ret = CarInterfaceBase.get_std_params(candidate, fingerprint)
ret.carName = "nissan"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.nissan)]
ret.autoResumeSng = False

ret.steerLimitTimer = 1.0

Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/subaru/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
ret.carName = "subaru"
ret.radarOffCan = True
ret.dashcamOnly = candidate in PREGLOBAL_CARS
ret.autoResumeSng = False

if candidate in PREGLOBAL_CARS:
ret.enableBsm = 0x25c in fingerprint[0]
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
ret.openpilotLongitudinalControl = smartDsu or ret.enableDsu or candidate in (TSS2_CAR - RADAR_ACC_CAR)

if not ret.openpilotLongitudinalControl:
ret.autoResumeSng = False
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_STOCK_LONGITUDINAL

# we can't use the fingerprint to detect this reliably, since
Expand Down
1 change: 1 addition & 0 deletions selfdrive/car/volkswagen/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
else:
raise ValueError(f"unsupported car {candidate}")

ret.autoResumeSng = ret.minEnableSpeed == -1
ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase)
ret.centerToFront = ret.wheelbase * 0.45
ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront,
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
656daeb9de3680258527500ecae4ddff323b2e59
af74c25e869d1128c0277f789e8f88bb95c5be1b

0 comments on commit 452d5e4

Please sign in to comment.