Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
ebe96bf4
Commit
ebe96bf4
authored
Jun 28, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix g-code duration estimator when move duration is faster than acceleration
parent
d56973d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
gcoder.py
printrun/gcoder.py
+13
-10
No files found.
printrun/gcoder.py
View file @
ebe96bf4
...
@@ -382,17 +382,20 @@ class GCode(object):
...
@@ -382,17 +382,20 @@ class GCode(object):
# then calculate the time taken to complete the remaining distance
# then calculate the time taken to complete the remaining distance
currenttravel
=
math
.
hypot
(
x
-
lastx
,
y
-
lasty
)
currenttravel
=
math
.
hypot
(
x
-
lastx
,
y
-
lasty
)
# FIXME: review this better
if
f
==
lastf
:
# Feedrate hasn't changed, no acceleration/decceleration planned
# this looks wrong : there's little chance that the feedrate we'll decelerate to is the previous feedrate
moveduration
=
currenttravel
/
f
# shouldn't we instead look at three consecutive moves ?
distance
=
2
*
abs
(((
lastf
+
f
)
*
(
f
-
lastf
)
*
0.5
)
/
acceleration
)
# multiply by 2 because we have to accelerate and decelerate
if
distance
<=
currenttravel
and
lastf
+
f
!=
0
and
f
!=
0
:
# Unsure about this formula -- iXce reviewing this code
moveduration
=
2
*
distance
/
(
lastf
+
f
)
currenttravel
-=
distance
moveduration
+=
currenttravel
/
f
else
:
else
:
moveduration
=
math
.
sqrt
(
2
*
distance
/
acceleration
)
# probably buggy : not taking actual travel into account
# FIXME: review this better
# this looks wrong : there's little chance that the feedrate we'll decelerate to is the previous feedrate
# shouldn't we instead look at three consecutive moves ?
distance
=
2
*
abs
(((
lastf
+
f
)
*
(
f
-
lastf
)
*
0.5
)
/
acceleration
)
# multiply by 2 because we have to accelerate and decelerate
if
distance
<=
currenttravel
and
lastf
+
f
!=
0
and
f
!=
0
:
moveduration
=
2
*
distance
/
(
lastf
+
f
)
# This is distance / mean(lastf, f)
moveduration
+=
(
currenttravel
-
distance
)
/
f
else
:
moveduration
=
2
*
currenttravel
/
(
lastf
+
f
)
# This is currenttravel / mean(lastf, f)
# FIXME: probably a little bit optimistic, but probably a much better estimate than the previous one:
# moveduration = math.sqrt(2 * distance / acceleration) # probably buggy : not taking actual travel into account
totalduration
+=
moveduration
totalduration
+=
moveduration
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment