aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorDmitry Butyugin <dmbutyugin@google.com>2022-10-10 01:07:04 +0200
committerKevinOConnor <kevin@koconnor.net>2022-10-17 11:08:56 -0400
commit0d9b2cc1fa297b9adedb14be31a8d5c8d7868681 (patch)
tree19cda0618e3f14cd4d5fa38ee748d28b842cbd0c /klippy
parente4c8a24711b575e42e5a020c5684f61c19fac52d (diff)
downloadkutter-0d9b2cc1fa297b9adedb14be31a8d5c8d7868681.tar.gz
kutter-0d9b2cc1fa297b9adedb14be31a8d5c8d7868681.tar.xz
kutter-0d9b2cc1fa297b9adedb14be31a8d5c8d7868681.zip
toolhead: Capture current junction_deviation in a Move class
If a maximum acceleration is changed between two consecutive moves, this allows to correctly compute the junction velocity between them. Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/toolhead.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py
index b7285420..2398d7ca 100644
--- a/klippy/toolhead.py
+++ b/klippy/toolhead.py
@@ -17,6 +17,7 @@ class Move:
self.start_pos = tuple(start_pos)
self.end_pos = tuple(end_pos)
self.accel = toolhead.max_accel
+ self.junction_deviation = toolhead.junction_deviation
self.timing_callbacks = []
velocity = min(speed, toolhead.max_velocity)
self.is_kinematic_move = True
@@ -73,8 +74,7 @@ class Move:
return
junction_cos_theta = max(junction_cos_theta, -0.999999)
sin_theta_d2 = math.sqrt(0.5*(1.0-junction_cos_theta))
- R = (self.toolhead.junction_deviation * sin_theta_d2
- / (1. - sin_theta_d2))
+ R_jd = sin_theta_d2 / (1. - sin_theta_d2)
# Approximated circle must contact moves no further away than mid-move
tan_theta_d2 = sin_theta_d2 / math.sqrt(0.5*(1.0+junction_cos_theta))
move_centripetal_v2 = .5 * self.move_d * tan_theta_d2 * self.accel
@@ -82,7 +82,8 @@ class Move:
* prev_move.accel)
# Apply limits
self.max_start_v2 = min(
- R * self.accel, R * prev_move.accel,
+ R_jd * self.junction_deviation * self.accel,
+ R_jd * prev_move.junction_deviation * prev_move.accel,
move_centripetal_v2, prev_move_centripetal_v2,
extruder_v2, self.max_cruise_v2, prev_move.max_cruise_v2,
prev_move.max_start_v2 + prev_move.delta_v2)