Skip to content

Commit

Permalink
add GM
Browse files Browse the repository at this point in the history
  • Loading branch information
pd0wm committed Sep 6, 2021
1 parent 772531b commit 2510c65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion selfdrive/car/gm/interface.py
Expand Up @@ -2,14 +2,18 @@
from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.car.gm.values import CAR, CruiseButtons, \
AccState
AccState, CarControllerParams
from selfdrive.car import STD_CARGO_KG, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint
from selfdrive.car.interfaces import CarInterfaceBase

ButtonType = car.CarState.ButtonEvent.Type
EventName = car.CarEvent.EventName

class CarInterface(CarInterfaceBase):
@staticmethod
def get_pid_accel_limits(current_speed, cruise_speed):
params = CarControllerParams()
return params.ACCEL_MIN, params.ACCEL_MAX

@staticmethod
def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None):
Expand Down
12 changes: 11 additions & 1 deletion selfdrive/car/gm/values.py
Expand Up @@ -25,10 +25,20 @@ def __init__(self):
MAX_GAS = 3072 # Only a safety limit
ZERO_GAS = 2048
MAX_BRAKE = 350 # Should be around 3.5m/s^2, including regen

self.ACCEL_MAX = 2.0 # m/s^2

# Allow small margin below -3.5 m/s^2 from ISO 15622:2018 since we
# perform the closed loop control, and might need some
# to apply some more braking if we're on a downhill slope.
# Our controller should still keep the 2 second average above
# -3.5 m/s^2 as per planner limits
self.ACCEL_MIN = -4.0 # m/s^2

self.MAX_ACC_REGEN = 1404 # ACC Regen braking is slightly less powerful than max regen paddle
self.GAS_LOOKUP_BP = [-1.0, 0., 2.0]
self.GAS_LOOKUP_V = [self.MAX_ACC_REGEN, ZERO_GAS, MAX_GAS]
self.BRAKE_LOOKUP_BP = [-4., -1.0]
self.BRAKE_LOOKUP_BP = [self.ACCEL_MIN, -1.0]
self.BRAKE_LOOKUP_V = [MAX_BRAKE, 0]

class CAR:
Expand Down

0 comments on commit 2510c65

Please sign in to comment.