Commit 2a20f67e authored by Kliment Yanev's avatar Kliment Yanev

Avoid division by zero during estimation

parent 9274f056
...@@ -142,7 +142,7 @@ def estimate_duration(g): ...@@ -142,7 +142,7 @@ def estimate_duration(g):
currenttravel = hypot3d(x, y, z, lastx, lasty, lastz) currenttravel = hypot3d(x, y, z, lastx, lasty, lastz)
distance = 2* ((lastf+f) * (f-lastf) * 0.5 ) / acceleration #2x because we have to accelerate and decelerate distance = 2* ((lastf+f) * (f-lastf) * 0.5 ) / acceleration #2x because we have to accelerate and decelerate
if distance <= currenttravel: if distance <= currenttravel and ( lastf + f )!=0 and f!=0:
moveduration = 2 * distance / ( lastf + f ) moveduration = 2 * distance / ( lastf + f )
currenttravel -= distance currenttravel -= distance
moveduration += currenttravel/f moveduration += currenttravel/f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment