Skip to content

Commit 021d1a6

Browse files
author
Kristýna Kučerová
committed
Fix selection of middle speed in speed_profile
1 parent ee152f6 commit 021d1a6

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/AcceleratedDubins.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ Caculation using plane turn
139139
# Return
140140
- `v::Float64`: Maximum speed for input radius
141141
"""
142-
function speed_by_radius(radius::Number, vr::Number, vs::Number)
142+
#=function speed_by_radius(radius::Number, vr::Number, vs::Number)
143143
return min(sqrt(radius)*vr, vs)
144-
end
144+
end=#
145145

146146
"""
147147
speed_by_radius(radius::Number)
@@ -742,7 +742,7 @@ end
742742

743743
function speed_profile(path::DubinsPathR2, v_min::Number, v_max::Number, a1::Float64, a2::Float64)
744744
# a1 = a_max, a2 = -a_min
745-
speeds = [speed_by_radius(r, v_min, v_max) for r in path.r]
745+
speeds = [speed_by_radius(r) for r in path.r]
746746
lengths = path.lengths
747747

748748
times::Vector{Float64} = []
@@ -791,7 +791,7 @@ function speed_profile(path::DubinsPathR2, v_min::Number, v_max::Number, a1::Flo
791791
return Inf, Inf
792792
end
793793

794-
vx = sqrt(det) / (2*xa) # second root is smaller than beggining speed
794+
vx = min(v_max, sqrt(det) / (2*xa)) # second root is smaller than beggining speed
795795
time += (vx - vs) / a1
796796
push_vals(time, vx)
797797
time += (vx - vs) / a2
@@ -836,7 +836,7 @@ function speed_profile(path::DubinsPathR2, v_min::Number, v_max::Number, a1::Flo
836836
return Inf, Inf
837837
end
838838

839-
vx = sqrt(det) / (2*xa) # second root is smaller than previous speed - unnecessary
839+
vx = min(v_max, sqrt(det) / (2*xa)) # second root is smaller than previous speed - unnecessary
840840
if vx < ve
841841
return Inf, Inf
842842
end
@@ -883,7 +883,7 @@ function speed_profile(path::DubinsPathR2, v_min::Number, v_max::Number, a1::Flo
883883
if det < 0
884884
return Inf, Inf
885885
end
886-
vx = sqrt(det) / (2*xa) # second root is smaller than previous speed - unnecessary
886+
vx = min(v_max, sqrt(det) / (2*xa)) # second root is smaller than previous speed - unnecessary
887887
if vx < ve
888888
return Inf, Inf
889889
end

0 commit comments

Comments
 (0)