diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-11-27 22:45:27 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-11-29 17:41:37 -0500 |
commit | 8291788f40a677b11d6e0e0283411bc5f96936f7 (patch) | |
tree | fa5868f461b7232425f856a83c882ebe3340ebef /klippy | |
parent | a18c74be05ee6150c9d8b7395b5ad69fa26d444c (diff) | |
download | kutter-8291788f40a677b11d6e0e0283411bc5f96936f7.tar.gz kutter-8291788f40a677b11d6e0e0283411bc5f96936f7.tar.xz kutter-8291788f40a677b11d6e0e0283411bc5f96936f7.zip |
toolhead: Use delta_v2 when calculating centripetal force
As a minor math optimization, it's possible to calculate:
.5 * self.move_d * self.accel * tan_theta_d2
using:
self.delta_v2 * .25 * tan_theta_d2
because self.delta_v2 is "2. * self.move_d * self.accel".
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/toolhead.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 4149d53b..948ea974 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -76,10 +76,11 @@ class Move: sin_theta_d2 = math.sqrt(0.5*(1.0-junction_cos_theta)) 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 - prev_move_centripetal_v2 = (.5 * prev_move.move_d * tan_theta_d2 - * prev_move.accel) + # centripetal_v2 = .5 * self.move_d * self.accel * tan_theta_d2 + cos_theta_d2 = math.sqrt(0.5*(1.0+junction_cos_theta)) + quarter_tan_theta_d2 = .25 * sin_theta_d2 / cos_theta_d2 + move_centripetal_v2 = self.delta_v2 * quarter_tan_theta_d2 + prev_move_centripetal_v2 = prev_move.delta_v2 * quarter_tan_theta_d2 # Apply limits self.max_start_v2 = min( R_jd * self.junction_deviation * self.accel, |