Polar Kinematics (#25214)

This commit is contained in:
kadir ilkimen
2023-01-11 06:29:38 +02:00
committed by Scott Lahteine
parent 33e5aad364
commit 7717beb793
32 changed files with 376 additions and 76 deletions

View File

@@ -3161,24 +3161,75 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const_feedRate_t fr_mm_s
? xyz_pos_t(cart_dist_mm).magnitude()
: TERN0(HAS_Z_AXIS, ABS(cart_dist_mm.z));
#if ENABLED(SCARA_FEEDRATE_SCALING)
#if DISABLED(FEEDRATE_SCALING)
const feedRate_t feedrate = fr_mm_s;
#elif IS_SCARA
// For SCARA scale the feedrate from mm/s to degrees/s
// i.e., Complete the angular vector in the given time.
const float duration_recip = hints.inv_duration ?: fr_mm_s / ph.millimeters;
const xyz_pos_t diff = delta - position_float;
const feedRate_t feedrate = diff.magnitude() * duration_recip;
#else
const feedRate_t feedrate = fr_mm_s;
#endif
#elif ENABLED(POLAR)
/**
* Motion problem for Polar axis near center / origin:
*
* 3D printing:
* Movements very close to the center of the polar axis take more time than others.
* This brief delay results in more material deposition due to the pressure in the nozzle.
*
* Current Kinematics and feedrate scaling deals with this by making the movement as fast
* as possible. It works for slow movements but doesn't work well with fast ones. A more
* complicated extrusion compensation must be implemented.
*
* Ideally, it should estimate that a long rotation near the center is ahead and will cause
* unwanted deposition. Therefore it can compensate the extrusion beforehand.
*
* Laser cutting:
* Same thing would be a problem for laser engraving too. As it spends time rotating at the
* center point, more likely it will burn more material than it should. Therefore similar
* compensation would be implemented for laser-cutting operations.
*
* Milling:
* This shouldn't be a problem for cutting/milling operations.
*/
feedRate_t calculated_feedrate = fr_mm_s;
const xyz_pos_t diff = delta - position_float;
if (!NEAR_ZERO(diff.b)) {
if (delta.a <= POLAR_FAST_RADIUS )
calculated_feedrate = settings.max_feedrate_mm_s[Y_AXIS];
else {
// Normalized vector of movement
const float diffBLength = ABS((2.0f * PI * diff.a) * (diff.b / 360.0f)),
diffTheta = DEGREES(ATAN2(diff.a, diffBLength)),
normalizedTheta = 1.0f - (ABS(diffTheta > 90.0f ? 180.0f - diffTheta : diffTheta) / 90.0f);
// Normalized position along the radius
const float radiusRatio = PRINTABLE_RADIUS/delta.a;
calculated_feedrate += (fr_mm_s * radiusRatio * normalizedTheta);
}
}
const feedRate_t feedrate = calculated_feedrate;
#endif // POLAR && FEEDRATE_SCALING
TERN_(HAS_EXTRUDERS, delta.e = machine.e);
if (buffer_segment(delta OPTARG(HAS_DIST_MM_ARG, cart_dist_mm), feedrate, extruder, ph)) {
position_cart = cart;
return true;
}
return false;
#else
#else // !IS_KINEMATIC
return buffer_segment(machine, fr_mm_s, extruder, hints);
#endif
} // buffer_line()
#if ENABLED(DIRECT_STEPPING)