Last active
August 29, 2015 14:26
-
-
Save harmishhk/203a95052a9d0a405e86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment