Avoid division by zero during estimation
parent
9274f05694
commit
2a20f67eba
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue