Skip to content

Commit

Permalink
Merge pull request #52 from mattuntergassmair/master
Browse files Browse the repository at this point in the history
LaneFollowingAction no negative velocities
  • Loading branch information
mattuntergassmair authored Nov 26, 2019
2 parents 32132e1 + b8abe43 commit 62fe410
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AutomotiveDrivingModels"
uuid = "99497e54-f3d6-53d3-a3a9-fa9315a7f1ba"
repo = "https://github.com/sisl/AutomotiveDrivingModels.jl.git"
version = "0.7.10"
version = "0.7.11"

[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
7 changes: 4 additions & 3 deletions src/actions/lane_following_accel.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
LaneFollowingAccel
Longitudinal acceleration
Longitudinal acceleration.
The resulting vehicle velocity is capped below at 0 (i.e. standstill). Negative velocities are not allowed.
# Fields
- `a::Float64` longitudinal acceleration [m/s^2]
Expand All @@ -15,7 +16,7 @@ function propagate(veh::Vehicle1D, action::LaneFollowingAccel, roadway::Straight
s, v = veh.state.s, veh.state.v

s′ = s + v*Δt + a*Δt*Δt/2
v′ = v + a*Δt
v′ = max(v + a*Δt, 0.) # no negative velocities

s′ = mod_position_to_roadway(s′, roadway)

Expand All @@ -31,7 +32,7 @@ function propagate(veh::Entity{VehicleState,D,I}, action::LaneFollowingAccel, ro
ΔT² = ΔT*ΔT
Δs = ds*ΔT + 0.5*a_lon*ΔT²

v₂ = ds + a_lon*ΔT
v₂ = max(ds + a_lon*ΔT, 0.) # no negative velocities

roadind = move_along(posf(veh.state).roadind, roadway, Δs)
posG = roadway[roadind].pos
Expand Down

0 comments on commit 62fe410

Please sign in to comment.