Skip to content

Instantly share code, notes, and snippets.

@harmishhk
Last active August 29, 2015 14:26
Show Gist options
  • Save harmishhk/203a95052a9d0a405e86 to your computer and use it in GitHub Desktop.
Save harmishhk/203a95052a9d0a405e86 to your computer and use it in GitHub Desktop.
using Gadfly
using Cairo
max_wheel_vel = 1.6
wheel_base = 0.78
calc_step = 0.01
arcs = Array(Float64, 0, 2)
data = Array(Float64, 0, 2)
r = wheel_base / 2
max_ang_vel = max_wheel_vel / r
for ang = -max_ang_vel:calc_step:max_ang_vel
for lin = 0:calc_step:(max_wheel_vel+calc_step)
vr = lin - r * ang
vl = lin + r * ang
if (abs(vr) > max_wheel_vel || abs(vl) > max_wheel_vel)
data = vcat(data, [lin ang])
arcs = vcat(arcs, [lin*cos(ang) lin*sin(ang)])
break
end
end
end
draw(SVGJS("dynamic-window.svg", 40cm, 16cm), plot(x=data[:,2], y=data[:,1], Geom.path()))
draw(SVGJS("possible-trajectories.svg", 30cm, 30cm), plot(x=arcs[:,2], y=arcs[:,1], Geom.path()))
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment