diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-12-04 19:30:35 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-12-05 14:36:02 -0500 |
commit | 9c932ad514cbf5d8ab9573b16aeceabb11ecfebf (patch) | |
tree | bcd31d5d15872f6fbb90d43da6a1c45d61428e9f /klippy/chelper.py | |
parent | 5458f3cbd20678ad7db1005e3abf7d01e2099820 (diff) | |
download | kutter-9c932ad514cbf5d8ab9573b16aeceabb11ecfebf.tar.gz kutter-9c932ad514cbf5d8ab9573b16aeceabb11ecfebf.tar.xz kutter-9c932ad514cbf5d8ab9573b16aeceabb11ecfebf.zip |
delta: Rework delta math to avoid using inv_movexy_r
Taking the inverse of the XY move distance can lead to extremely large
values when the XY distance is very small. This can lead to
saturation of the double precision variables and incorrect results.
Rework the delta kinematic math to avoid using this inverse. Pass the
closestxy_d value directly to the C functions so that the C code can
calculate its intermediate constants.
After this change the move_z special case is no longer necessary as
the regular delta functions now work with movexy_r=0 and movez_r=1.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper.py')
-rw-r--r-- | klippy/chelper.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/klippy/chelper.py b/klippy/chelper.py index 58049582..4384fe28 100644 --- a/klippy/chelper.py +++ b/klippy/chelper.py @@ -24,14 +24,14 @@ defs_stepcompress = """ int32_t stepcompress_push_sqrt(struct stepcompress *sc , double steps, double step_offset , double clock_offset, double sqrt_offset, double factor); - int32_t stepcompress_push_delta_const( - struct stepcompress *sc, double clock_offset, double dist - , double step_dist, double start_pos, double closest_height2 - , double height, double movez_r, double inv_velocity); - int32_t stepcompress_push_delta_accel( - struct stepcompress *sc, double clock_offset, double dist - , double step_dist, double start_pos, double closest_height2 - , double height, double movez_r, double accel_multiplier); + int32_t stepcompress_push_delta_const(struct stepcompress *sc + , double clock_offset, double dist, double start_pos + , double inv_velocity, double step_dist, double height + , double closestxy_d, double closest_height2, double movez_r); + int32_t stepcompress_push_delta_accel(struct stepcompress *sc + , double clock_offset, double dist, double start_pos + , double accel_multiplier, double step_dist, double height + , double closestxy_d, double closest_height2, double movez_r); void stepcompress_reset(struct stepcompress *sc, uint64_t last_step_clock); void stepcompress_queue_msg(struct stepcompress *sc , uint32_t *data, int len); |