Skip to content

Commit

Permalink
Update model_documentation.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Palazzi authored Aug 26, 2017
1 parent 0e3495e commit cfd3a65
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions project_11_path_planning/model_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ Here's a bullet list of rubric points along with an explanation of how constrain
Notice that these waypoints are created [using the `lane` variable](https://github.com/ndrplz/self-driving-car/blob/50adb2c54ac2e0d5c0878f4c3c73894275ab20c3/project_11_path_planning/src/main.cpp#L215-L218) to make sure that the `d` coordinate is just in the middle of the lane the car is currently on. In case a lane change is needed, the `lane` variable will already contain the coordinate of the future lane (see below).

- **The car is able to change lanes**

When it makes sense to do, the vehicle will try to change lane. This will happens if a slower moving car obstructs traffic lane. A simple **FSM** (Finite State Machine) able to deal with safe lane changing is implemented at [these lines](https://github.com/ndrplz/self-driving-car/blob/611428a30cc28b958dd38a2b3a837897b2a0c0b7/project_11_path_planning/src/main.cpp#L119-L182) of `main.cpp`.

Basically, our car uses sensor fusion data to collect information about nearby vehicles. Vehicles which travel on our same lane are of [particular interest](https://github.com/ndrplz/self-driving-car/blob/611428a30cc28b958dd38a2b3a837897b2a0c0b7/project_11_path_planning/src/main.cpp#L133-L139), in particular when they get dangerously close. In this latter case, the vehicle attempts a lane change maneuver.

The car has now entered the state `prepare_for_lane_change`. However, in order to safely change lane, the car has to check if at least another lane is sufficiently clear of traffic for allowing a safe lane change. This controls are implemented [here](https://github.com/ndrplz/self-driving-car/blob/611428a30cc28b958dd38a2b3a837897b2a0c0b7/project_11_path_planning/src/main.cpp#L143-L170). If at least one lane free is found, the flag [`ready_for_lane_change` is set](https://github.com/ndrplz/self-driving-car/blob/611428a30cc28b958dd38a2b3a837897b2a0c0b7/project_11_path_planning/src/main.cpp#L166-L167) to signal that a safe lane changing is now possible.

The actual lane change happen by changing the `lane` variable to the new value. This takes place [here](https://github.com/ndrplz/self-driving-car/blob/611428a30cc28b958dd38a2b3a837897b2a0c0b7/project_11_path_planning/src/main.cpp#L172-L176). As we saw before, the `lane` variable is used for computing the next waypoints. This implies that the future trajectory will drive the car in the new lane.

0 comments on commit cfd3a65

Please sign in to comment.