Improve G2 / G3 motion accuracy (#18144)

This commit is contained in:
Eyal 2020-05-30 23:26:15 -06:00 committed by GitHub
parent 46112b9d50
commit 815c8d2b55
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,8 +117,8 @@ void plan_arc(
uint16_t segments = FLOOR(mm_of_travel / seg_length); uint16_t segments = FLOOR(mm_of_travel / seg_length);
if (segments < min_segments) { // Too few segments? if (segments < min_segments) { // Too few segments?
segments = min_segments; // More segments segments = min_segments; // More segments
seg_length = mm_of_travel / segments; // but also shorter
} }
seg_length = mm_of_travel / segments;
/** /**
* Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector, * Vector rotation by transformation matrix: r is the original vector, r_T is the rotated vector,
@ -151,8 +151,9 @@ void plan_arc(
const float theta_per_segment = angular_travel / segments, const float theta_per_segment = angular_travel / segments,
linear_per_segment = linear_travel / segments, linear_per_segment = linear_travel / segments,
extruder_per_segment = extruder_travel / segments, extruder_per_segment = extruder_travel / segments,
sin_T = theta_per_segment, sq_theta_per_segment = sq(theta_per_segment),
cos_T = 1 - 0.5f * sq(theta_per_segment); // Small angle approximation sin_T = theta_per_segment - sq_theta_per_segment*theta_per_segment/6,
cos_T = 1 - 0.5f * sq_theta_per_segment; // Small angle approximation
// Initialize the linear axis // Initialize the linear axis
raw[l_axis] = current_position[l_axis]; raw[l_axis] = current_position[l_axis];
@ -218,7 +219,7 @@ void plan_arc(
planner.apply_leveling(raw); planner.apply_leveling(raw);
#endif #endif
if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, seg_length if (!planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, 0
#if ENABLED(SCARA_FEEDRATE_SCALING) #if ENABLED(SCARA_FEEDRATE_SCALING)
, inv_duration , inv_duration
#endif #endif