Skip to content

Commit

Permalink
Dynamic follow: roadtrip is now stock (commaai#349)
Browse files Browse the repository at this point in the history
* 'Stock' profile is replacing 'roadtrip'

* Reduce max accel with speed, inspired by Erich

* Revert temp

* Revert revert

* revert gas
  • Loading branch information
sshane authored Mar 10, 2021
1 parent bf6ce4c commit 80690bb
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Dynamic follow works if openpilot can control your vehicle's gas and brakes (lon
Just use the button on the button right of the screen while driving to change between these profiles:
* [`traffic`](#Videos) - Meant to keep you a bit closer in traffic, hopefully reducing cut-ins. Always be alert, as you are with any driving assistance software.
* `relaxed` - This is the default dynamic follow profile for casual driving.
* `roadtrip` - This profile is for road trips where you're mainly on two lane highways and don't want to be following particularly closely; at night for example.
* `stock` - This is the stock 1.8 second profile default in stock openpilot, with no dynamic follow mods. The previous roadtrip profile was closer than a *true road trip* profile, this is more in line with that intention.
* [`auto`](#Automatic-DF-profile-switching) - The auto dynamic follow model was trained on about an hour of me manually cycling through the different profiles based on driving conditions, this profile tries to replicate those decisions entirely on its own.

<p align="center">
Expand All @@ -66,7 +66,7 @@ Resources:
### Lane Speed alerts
This feature alerts you of faster-travelling adjacent lanes and can be configured using the on-screen *LS* button on the bottom right to either be disabled, audible, or silent.

The idea behind this feature is since we often become very relaxed behind the wheel when being driven by openpilot, we don't always notice when we've become stuck behind a slower-moving vehicle. When either the left or right adjacent lane is moving faster than your current lane, LaneSpeed alerts the user that a faster lane is available so that they can make a lane change, overtaking the slower current lane. Thus saving time in the long run on long roadtrips or in general highway driving!
The idea behind this feature is since we often become very relaxed behind the wheel when being driven by openpilot, we don't always notice when we've become stuck behind a slower-moving vehicle. When either the left or right adjacent lane is moving faster than your current lane, LaneSpeed alerts the user that a faster lane is available so that they can make a lane change, overtaking the slower current lane. Thus saving time in the long run on long road trips or in general highway driving!

The original idea is thanks to [Greengree#5537](https://github.com/greengree) on Discord. This feature is available at 35 mph and up.

Expand Down
2 changes: 2 additions & 0 deletions SA_RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Stock Additions v0.6.6 - 2020-02-27 (0.8.2)
* Temporary removal of LaneSpeed and DynamicCameraOffset features
* They used the now-removed lane line polys
* Remove slowdown_for_curves param
* Roadtrip profile is now stock longitudinal for smoother road trips
* No dynamic follow distance modiciations, all stock

Stock Additions v0.6.5 - 2020-12-07 (0.8)
===
Expand Down
4 changes: 2 additions & 2 deletions common/op_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def __init__(self):
"""

self.fork_params = {'camera_offset': Param(0.06, NUMBER, 'Your camera offset to use in lane_planner.py', live=True),
'dynamic_follow': Param('auto', str, 'Can be: (\'traffic\', \'relaxed\', \'roadtrip\'): Left to right increases in following distance.\n'
'All profiles support dynamic follow so you\'ll get your preferred distance while\n'
'dynamic_follow': Param('auto', str, 'Can be: (\'traffic\', \'relaxed\', \'stock\'): Left to right increases in following distance.\n'
'All profiles support dynamic follow except stock so you\'ll get your preferred distance while\n'
'retaining the smoothness and safety of dynamic follow!'),
'global_df_mod': Param(1.0, NUMBER, 'The multiplier for the current distance used by dynamic follow. The range is limited from 0.85 to 2.5\n'
'Smaller values will get you closer, larger will get you farther\n'
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/controls/lib/dynamic_follow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def _get_TR(self):
self.last_effective_profile = df_profile

x_vel = [0.0, 1.8627, 3.7253, 5.588, 7.4507, 9.3133, 11.5598, 13.645, 22.352, 31.2928, 33.528, 35.7632, 40.2336] # velocities
if df_profile == self.df_profiles.roadtrip:
y_dist = [1.6428, 1.646, 1.6514, 1.6591, 1.6744, 1.6992, 1.7422, 1.7739, 1.8335, 1.8687, 1.8755, 1.8833, 1.8961] # TRs
if df_profile == self.df_profiles.stock:
return 1.8
elif df_profile == self.df_profiles.traffic: # for in congested traffic
x_vel = [0.0, 1.892, 3.7432, 5.8632, 8.0727, 10.7301, 14.343, 17.6275, 22.4049, 28.6752, 34.8858, 40.35]
y_dist = [1.3781, 1.3791, 1.3457, 1.3134, 1.3145, 1.318, 1.3485, 1.257, 1.144, 0.979, 0.9461, 0.9156]
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/controls/lib/dynamic_follow/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class dfData:
class dfProfiles:
traffic = 0
relaxed = 1
roadtrip = 2
stock = 2
auto = 3
to_profile = {0: 'traffic', 1: 'relaxed', 2: 'roadtrip', 3: 'auto'}
to_profile = {0: 'traffic', 1: 'relaxed', 2: 'stock', 3: 'auto'}
to_idx = {v: k for k, v in to_profile.items()}

default = relaxed
2 changes: 1 addition & 1 deletion selfdrive/ui/ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


std::map<std::string, int> LS_TO_IDX = {{"off", 0}, {"audible", 1}, {"silent", 2}};
std::map<std::string, int> DF_TO_IDX = {{"traffic", 0}, {"relaxed", 1}, {"roadtrip", 2}, {"auto", 3}};
std::map<std::string, int> DF_TO_IDX = {{"traffic", 0}, {"relaxed", 1}, {"stock", 2}, {"auto", 3}};


int write_param_float(float param, const char* param_name, bool persistent_param) {
Expand Down

0 comments on commit 80690bb

Please sign in to comment.