Hello to all
Building an helical interpolation under MultiStepper.h using XA axes:
// Steppers
AccelStepper xAxis(1, xStepPin, xDirPin);
AccelStepper aAxis(1, aStepPin, aDirPin);
MultiStepper XAaxes;
Based on a 105 milimeters distance for X and -64,7º for A, that results on the following target positions based on real steps:
// Array with axis values for multi stepper function
long xDist = -21000L; // Steps for x axis
long aDist = -40747L; // Steps for a axis
long posXA[2] = {xDist, aDist};
And the following motion function:
XAaxes.moveTo(posXA);
// Interpolate until all axes reaches its targets positions
while(xAxis.currentPosition() != posXA[0] || aAxis.currentPosition() != posXA[1]){
XAaxes.run();
}
A problem arises:
Helical motion is executed until the following XA position:
X pos at end of interpolation: -20374 (but target is -21000)
A pos at end of interpolation: -40747 (= target position)
And then moves X axis alone, breaking the helix, until their target pos (-21000).
I can fix this last not interpolated X motion, changing “||” condition by “&&” inside motion function, making steppers stop when interpolation ends at X(-20374) A(-40747):
XAaxes.moveTo(posXA);
// Interpolate only while any axis reaches its end
while(xAxis.currentPosition() != posXA[0] && aAxis.currentPosition() != posXA[1]){
XAaxes.run();
}
But even though this avoid the non interpolation motion, the executed helicoidal motion from XA {0,0} to XA {-20374, -40474} does not generate the correct helix, because interpolation must execute -40474 A axis steps for -21000 X axis steps, not -20374.
So my question is:
Why MultiStepper.cpp does not interpolate A through all X travel? Have MultiStepper some kind of error? Does anyone know how to fix this?
I leave the full test program in a file below, if anyone want to test it. It use serial monitor. These are the serial monitor prints
***************
moveToRunXA:
***************
INIT interpolated movement
init X pos (currentPos): 0 target X pos (posXA[0]): -21000
init A pos (currentPos): 0 target A pos (posXA[1]): -40747
END interpolated movement
current X pos: -20374
current A pos: -40747
From here, the movement is not interpolated..
END of a single axis motion
end X pos: -21000
end A pos: -40747
Many thanks in advance.
helicoidal_interpolation.ino (2.57 KB)