Skip to content

Commit

Permalink
Merge pull request commaai#119 from arne182/release2
Browse files Browse the repository at this point in the history
Update to latest release2
  • Loading branch information
arne182 authored Mar 26, 2019
2 parents ec10140 + d547447 commit bf2b609
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 28 deletions.
8 changes: 2 additions & 6 deletions selfdrive/car/gm/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,9 @@ def parse_gear_shifter(can_gear):
190: 8, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 8, 241: 6, 249: 8, 288: 5, 298: 8, 304: 1, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 386: 8, 388: 8, 393: 8, 398: 8, 401: 8, 413: 8, 417: 8, 419: 8, 422: 1, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 8, 455: 7, 456: 8, 458: 5, 479: 8, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 8, 501: 8, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 647: 5, 707: 8, 723: 8, 753: 5, 761: 7, 806: 1, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 961: 8, 969: 8, 977: 8, 979: 8, 985: 5, 1001: 8, 1009: 8, 1011: 6, 1017: 8, 1019: 3, 1020: 8, 1105: 6, 1217: 8, 1221: 5, 1225: 8, 1233: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 8, 1280: 4, 1300: 8, 1328: 4, 1417: 8, 1906: 7, 1907: 7, 1908: 7, 1912: 7, 1919: 7,
}],
CAR.VOLT: [
# Volt Premier w/ ACC 2017
# Volt Premier w/ ACC 2017/2018
{
170: 8, 171: 8, 189: 7, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 288: 5, 289: 8, 298: 8, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 386: 8, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 479: 3, 481: 7, 485: 8, 489: 8, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 4, 532: 6, 546: 7, 550: 8, 554: 3, 558: 8, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 577: 8, 647: 3, 707: 8, 711: 6, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 961: 8, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7, 1928: 7, 2016: 8, 2020: 8, 2024: 8, 2028: 8
},
# Volt Premier w/ ACC 2018
{
170: 8, 171: 8, 189: 7, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 288: 5, 298: 8, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 479: 3, 481: 7, 485: 8, 489: 8, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 4, 532: 6, 546: 7, 550: 8, 554: 3, 558: 8, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 577: 8, 578: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 3, 707: 8, 711: 6, 715: 8, 717: 5, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 967: 4, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7, 1930: 7, 2016: 8, 2020: 8, 2024: 8, 2028: 8
170: 8, 171: 8, 189: 7, 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 288: 5, 289: 8, 298: 8, 304: 1, 308: 4, 309: 8, 311: 8, 313: 8, 320: 3, 328: 1, 352: 5, 381: 6, 384: 4, 386: 8, 388: 8, 389: 2, 390: 7, 417: 7, 419: 1, 426: 7, 451: 8, 452: 8, 453: 6, 454: 8, 456: 8, 479: 3, 481: 7, 485: 8, 489: 8, 493: 8, 495: 4, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 528: 4, 532: 6, 546: 7, 550: 8, 554: 3, 558: 8, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 566: 5, 567: 3, 568: 1, 573: 1, 577: 8, 578: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 3, 707: 8, 711: 6, 715: 8, 717: 5, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 880: 6, 961: 8, 967: 4, 969: 8, 977: 8, 979: 7, 988: 6, 989: 8, 995: 7, 1001: 8, 1005: 6, 1009: 8, 1017: 8, 1019: 2, 1020: 8, 1033: 7, 1034: 7, 1105: 6, 1187: 4, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1227: 4, 1233: 8, 1249: 8, 1257: 6, 1265: 8, 1267: 1, 1273: 3, 1275: 3, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1516: 8, 1601: 8, 1618: 8, 1905: 7, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1922: 7, 1927: 7, 1928: 7, 1930: 7, 2016: 8, 2018: 8, 2020: 8, 2024: 8, 2028: 8
}],
CAR.BUICK_REGAL : [
# Regal TourX Essence w/ ACC 2018
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def get_params(candidate, fingerprint):
tire_stiffness_factor = 0.444 # not optimized yet
ret.mass = 4607 * CV.LB_TO_KG + std_cargo #mean between normal and hybrid limited
ret.steerKpV, ret.steerKiV = [[0.18], [0.0075]]
ret.steerKf = 0.00030
ret.steerKf = 0.00015
if ret.enableGasInterceptor:
ret.gasMaxV = [0.2, 0.5, 0.7]
ret.longitudinalKpV = [1.2, 0.8, 0.5]
Expand Down
32 changes: 21 additions & 11 deletions selfdrive/controls/lib/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,33 @@ def __init__(self, mpc_id, live_longitudinal_mpc):
self.last_cost = 0
self.velocity_list = []

def calculate_tr(self, v_ego, read_distance_lines):
def calculate_tr(self, v_ego, car_state):
"""
Returns a follow time gap in seconds based on car state values
Parameters:
v_ego: Vehicle speed [m/s]
read_distance_lines: ACC setting showing how much follow distance the user has set [1|2|3]
"""

read_distance_lines = car_state.readdistancelines

if v_ego < 2.0:
return 1.8 # under 7km/hr use a TR of 1.8 seconds

if (read_distance_lines == 2 or read_distance_lines == 3) and (car_state.leftBlinker or car_state.rightBlinker): # if car is changing lanes and not already .9s
if self.last_cost != 1.0:
self.libmpc.init(MPC_COST_LONG.TTC, 1.0, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
self.last_cost = 1.0
return 0.9

if read_distance_lines == 1:
if read_distance_lines != self.lastTR or self.last_cost != 1.0:
self.libmpc.init(MPC_COST_LONG.TTC, 1.0, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
self.lastTR = read_distance_lines
self.last_cost = 1.0
return 0.9 # 10m at 40km/hr

if read_distance_lines == 2:
if len(self.velocity_list) > 200 and len(self.velocity_list) != 0: #100hz, so 200 items is 2 seconds
self.velocity_list.pop(0)
Expand All @@ -179,22 +195,16 @@ def calculate_tr(self, v_ego, read_distance_lines):
self.libmpc.init(MPC_COST_LONG.TTC, generated_cost, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
self.last_cost = generated_cost
return generatedTR

if read_distance_lines == 1:
if read_distance_lines != self.lastTR:
self.libmpc.init(MPC_COST_LONG.TTC, 1.0, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
self.lastTR = read_distance_lines
return 0.9 # 10m at 40km/hr

if read_distance_lines == 3:
if read_distance_lines != self.lastTR:
if read_distance_lines != self.lastTR or self.last_cost != 0.05:
self.libmpc.init(MPC_COST_LONG.TTC, 0.05, MPC_COST_LONG.ACCELERATION, MPC_COST_LONG.JERK)
self.lastTR = read_distance_lines
return 2.7 # 30m at 40km/hr
self.last_cost = 0.05
return 2.7 # 30m at 40km/hr

return 1.8 # if readdistancelines = 0


def send_mpc_solution(self, qp_iterations, calculation_time):
qp_iterations = max(0, qp_iterations)
dat = messaging.new_message()
Expand Down Expand Up @@ -296,7 +306,7 @@ def update(self, CS, lead, v_cruise_setpoint):

# Calculate mpc
t = sec_since_boot()
TR = self.calculate_tr(v_ego, CS.carState.readdistancelines)
TR = self.calculate_tr(v_ego, CS.carState)
n_its = self.libmpc.run_mpc(self.cur_state, self.mpc_solution, self.a_lead_tau, a_lead, TR)
duration = int((sec_since_boot() - t) * 1e9)
self.send_mpc_solution(n_its, duration)
Expand Down
9 changes: 5 additions & 4 deletions selfdrive/crash.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def install():
auth = json.loads(f.read())

auth = json.loads(auth['commaUser'])

client = Client('https://137e8e621f114f858f4c392c52e18c6d:8aba82f49af040c8aac45e95a8484970@sentry.io/1404547',
install_sys_hook=False, transport=HTTPTransport, release=version, tags={'dirty': dirty, 'email': auth['email'], 'username': auth['username']})

try:
client = Client('https://137e8e621f114f858f4c392c52e18c6d:8aba82f49af040c8aac45e95a8484970@sentry.io/1404547',install_sys_hook=False, transport=HTTPTransport, release=version, tags={'dirty': dirty, 'email': auth['email'], 'username': auth['username']})
except TypeError:
client = Client('https://137e8e621f114f858f4c392c52e18c6d:8aba82f49af040c8aac45e95a8484970@sentry.io/1404547',install_sys_hook=False, transport=HTTPTransport, release=version, tags={'dirty': dirty})
pass
def capture_exception(*args, **kwargs):
client.captureException(*args, **kwargs)
cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1))
Expand Down
14 changes: 8 additions & 6 deletions selfdrive/kegman_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def read_config(self):
self.config.update({"battPercOff":"25"})
self.element_updated = True
if "carVoltageMinEonShutdown" not in self.config:
self.config.update({"carVoltageMinEonShutdown":"11800"})
self.config.update({"carVoltageMinEonShutdown":"11200"})
self.element_updated = True
if "brakeStoppingTarget" not in self.config:
self.config.update({"brakeStoppingTarget":"0.25"})
Expand All @@ -30,11 +30,13 @@ def read_config(self):
self.config.update({"lastALCAMode":"1"})
self.element_updated = True

# Force update battery charge limits to higher values for Big Model
#if self.config['battChargeMin'] != "75":
# self.config.update({"battChargeMin":"75"})
# self.config.update({"battChargeMax":"80"})
# self.element_updated = True
# force update
if self.config['carVoltageMinEonShutdown'] == "11800":
self.config.update({"carVoltageMinEonShutdown":"11200"})
self.element_updated = True
if int(self.config['wheelTouchSeconds']) < 200:
self.config.update({"wheelTouchSeconds":"1800"})
self.element_updated = True

if self.element_updated:
self.write_config(self.config)
Expand Down

0 comments on commit bf2b609

Please sign in to comment.