Skip to content

Commit

Permalink
Merge pull request commaai#64 from arne182/release2
Browse files Browse the repository at this point in the history
update to latest
  • Loading branch information
sshane authored Apr 27, 2019
2 parents 2c1537f + 9457df0 commit 07f7447
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions selfdrive/controls/lib/longcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ def dynamic_gas(self, v_ego, v_rel, d_rel, gasinterceptor, gasbuttonstatus):
if gasbuttonstatus == 0:
dynamic = True
x = [0.0, 1.4082, 2.80311, 4.22661, 5.38271, 6.16561, 7.24781, 8.28308, 10.24465, 12.96402, 15.42303, 18.11903, 20.11703, 24.46614, 29.05805, 32.71015, 35.76326]
y = [0.5, 0.47, 0.43, 0.35, 0.3, 0.3, 0.3229, 0.34784, 0.36765, 0.38, 0.396, 0.409, 0.425, 0.478, 0.55, 0.621, 0.7]
y = [0.35, 0.47, 0.43, 0.35, 0.3, 0.3, 0.3229, 0.34784, 0.36765, 0.38, 0.396, 0.409, 0.425, 0.478, 0.55, 0.621, 0.7]
elif gasbuttonstatus == 1:
y = [0.9, 0.95, 0.99]
elif gasbuttonstatus == 2:
y = [0.35, 0.2, 0.2]
y = [0.25, 0.2, 0.2]

if not dynamic:
x = [0., 9., 35.] # default BP values
Expand Down
6 changes: 3 additions & 3 deletions selfdrive/controls/lib/planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

# lookup tables VS speed to determine min and max accels in cruise
# make sure these accelerations are smaller than mpc limits
_A_CRUISE_MIN_V = [-1.0, -.8, -.67, -.5, -.30]
_A_CRUISE_MIN_V = [-.8, -.7, -.6, -.5, -.3]
_A_CRUISE_MIN_BP = [ 0., 5., 10., 20., 55.]

# need fast accel at very low speed for stop and go
# make sure these accelerations are smaller than mpc limits
_A_CRUISE_MAX_V = [3.5, 3.0, 1.5, .5, .3]
_A_CRUISE_MAX_V_ECO = [1.6, 1.5, 1.0, 0.3, 0.1]
_A_CRUISE_MAX_V_ECO = [1.0, 1.5, 1.0, 0.3, 0.1]
_A_CRUISE_MAX_V_SPORT = [3.5, 3.5, 3.5, 3.5, 3.5]
_A_CRUISE_MAX_V_FOLLOWING = [1.6, 1.6, 1.2, .7, .3]
_A_CRUISE_MAX_V_FOLLOWING = [1.3, 1.6, 1.2, .7, .3]
_A_CRUISE_MAX_BP = [0., 5., 10., 20., 55.]

# Lookup table for turns
Expand Down
30 changes: 17 additions & 13 deletions selfdrive/mapd/mapd.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def mapsd_thread():
road_points = None
speedLimittraffic = 0
speedLimittraffic_prev = 0
max_speed = None
max_speed_prev = 0
speedLimittrafficvalid = False

Expand All @@ -160,6 +161,9 @@ def mapsd_thread():
if traffic is not None:
if traffic.liveTrafficData.speedLimitValid:
speedLimittraffic = traffic.liveTrafficData.speedLimit
if speedLimittraffic_prev is not speedLimittraffic:
speedLimittrafficvalid = True
speedLimittraffic_prev = speedLimittraffic
if traffic.liveTrafficData.speedAdvisoryValid:
speedLimittrafficAdvisory = traffic.liveTrafficData.speedAdvisory
speedLimittrafficAdvisoryvalid = True
Expand Down Expand Up @@ -266,20 +270,9 @@ def mapsd_thread():
if max_speed is not None:
if max_speed is not max_speed_prev:
speedLimittrafficvalid = False
if speedLimittraffic_prev is not speedLimittraffic:
speedLimittrafficvalid = True

if speedLimittrafficvalid:
if speedLimittraffic is not 0: # Should not occur but check anyway
dat.liveMapData.speedLimitValid = True
dat.liveMapData.speedLimit = speedLimittraffic / 3.6
speedLimittraffic_prev = speedLimittraffic
else:
if max_speed is not None:
dat.liveMapData.speedLimitValid = True
dat.liveMapData.speedLimit = max_speed
max_speed_prev = max_speed




# TODO: use the function below to anticipate upcoming speed limits
#max_speed_ahead, max_speed_ahead_dist = cur_way.max_speed_ahead(max_speed, lat, lon, heading, MAPS_LOOKAHEAD_DISTANCE)
Expand Down Expand Up @@ -308,6 +301,17 @@ def mapsd_thread():
dat.liveMapData.roadCurvatureX = map(float, dists)
dat.liveMapData.roadCurvature = map(float, curvature)

if speedLimittrafficvalid:
if speedLimittraffic is not 0: # Should not occur but check anyway
dat.liveMapData.speedLimitValid = True
dat.liveMapData.speedLimit = speedLimittraffic / 3.6
#map_valid = True
else:
if max_speed is not None:
dat.liveMapData.speedLimitValid = True
dat.liveMapData.speedLimit = max_speed


dat.liveMapData.mapValid = map_valid

map_data_sock.send(dat.to_bytes())
Expand Down

0 comments on commit 07f7447

Please sign in to comment.