luni64 / TeensyStep

Fast Stepper Motor Library for Teensy boards

Home Page:https://luni64.github.io/TeensyStep/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Queue for trajectory planing in async movement

ChrGri opened this issue · comments

commented

Thank you for this awesome library. I recently switched from Arduino Nano to a Teensy 4.1. This required a move from the fast stepper library ( https://github.com/gin66/FastAccelStepper/blob/master/src/FastAccelStepper.cpp ), to this GIT project (its 4.1 fork to be precise). I've noticed that with the other library, async movements are handles by a queue automatically and if the target position is updated before the movement has completed, the trajectory is updated. In this library, however, the behaviour seems different. If the "moveAbsAsync()" function is called with every 30µs with varying target positions, the stepper does not move at all.

My question is: How to use this API in closed loop applications, where the stepper target position might change every some µs?
I don't want to wait until the move is completed to calculate a new target position. Instead, I want to start the movement, and update the target position when the stepper is still moving.

This snippet might explain my current implementation:

#define stepPinStepper 1
#define dirPinStepper 4
Stepper s1( stepPinStepper, dirPinStepper ); // Step pin: -, Dir pin: -

long Position_Next = 0;
void loop()
{
Position_Next++;
s1.moveAbs(Position_Next);
}

BR

commented

Short Answers:

  1. Currently TeensyStep is not compatible to T4.x processors. I'm not aware of any T4.1 fork, Which repository are you refering to?
  2. Currently TeensyStep does not support on-the-fly changes of target positions.

Both items are not good of course. But, unfortunately, I don't have ressources to work on it in the near future.

So, sorry to say, but it might be better to look for another stepper library for your project.