Conversation
…is moves Starts several independent steppers, each to its own target position, timed so they all reach standstill at approximately the same time. Each axis still runs its own trapezoidal/S-curve ramp independently - this is not interpolated straight-line motion - only the per-axis speed (and, for very short moves, acceleration) is scaled down, never up, so the fastest axes are slowed to match the slowest one. Includes a worked example (examples/SynchronizedMultiMove) that measures and prints per-axis arrival time to verify synchronization on real hardware.
ARDUTECH0
force-pushed
the
feature/move-all-to-sync
branch
from
September 21, 2026 10:44
53cb3b5 to
58b7977
Compare
Owner
|
Thanks for the patch. I prefer to not include this in FastAccelStepper due to the following reasons:
Feel free to maintain your own fork of FastAccelStepper with this code included. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FastAccelStepperEngine::moveAllToSync(steppers, targetPositions, count): starts several independent steppers, each to its own target position, so they all reach standstill at approximately the same time.setLinearAcceleration()still applies per axis). It only computes, per axis, how long the slowest axis' move would take at its own configured speed/acceleration, then scales every other axis' speed down (and, for moves too short to ever reach a scaled-down cruise speed, acceleration too) so all of them take the same time - never scaling anything up past what was already configured.setSpeedInHz()/setAcceleration()configured; those become the per-axis ceiling for this call. A later, unrelatedmoveTo()/move()keeps using whatever values this call left behind, so reconfigure if the axis is moved individually afterwards.examples/SynchronizedMultiMove, which drives two steppers with deliberately mismatched distance/speed/acceleration and prints (viamillis()) how many ms after the shared start each one reaches standstill, so the synchronization is directly observable on the Serial Monitor without needing a scope.extras/doc/FastAccelStepper_API.mdviaextras/scripts/header2markdown.shand added the new keyword tokeywords.txt.Test plan
I have not been able to build or run this on real hardware or in the PC-based test suite - I don't have a compiler or a board available in the environment I wrote this in. The math (per-axis trapezoid/triangle timing model) is worked through by hand in the PR author's own testing notes, but has not been executed.
examples/SynchronizedMultiMoveon real hardware (two motors on the StepperDemo-style pins is enough) and confirm both "reached standstill" log lines land close together despite the mismatched per-axis configuration.getSpeedInMilliHz()/getAcceleration()/moveTo()API, but that hasn't been verified by actually running anything.