Is it just me? Multistepper speed slow. #107
Replies: 6 comments 4 replies
-
I don't know how familiar you are with Bresenham's algorithm so I'll expand a bit:
In case you want to improve that (shouldn't be too difficult), you'll find the relevant code here: TeensyStep/src/StepControlBase.h Line 94 in 57e532f As you see in the linked code,
As explained above the lead motor is supposed to run at 700Hz (smallest v_max) which it actually does: Hope that helps |
Beta Was this translation helpful? Give feedback.
-
Ok, I've made it work within the Arduino code itself as I'm not sure how to implement it into the StepControlBase.h file.
This is what my working code looks like, it ain't pretty but you'll get the idea:
I'll keep going and try to incorporate it in to your code but I'm sure someone way more clever than I could sort it in no time. Thanks again for your help. |
Beta Was this translation helpful? Give feedback.
-
I had some thoughts on this as well and pushed a trial on the development branch. This version calculates the speed of the lead motor such that it ensures none of the slave motors will run too fast. Here a spreadsheet for testing the algorithm. vTargetAlgorithm.xlsx In the example shown below, it reduces vMax of the lead motor from the configured speed 10000stp/s to 1125stp/s which is the max speed to avoid running m2 too fast. I didn't do much testing and won't have time for it for a few days. Maybe you can give the code in the development branch a try. Experience shows that combinations of directions and positive/negative targets often lead to unexpected errors. So, doing some corresponding tests would be helpful. Here the code I added to the controller to implement the algorithm (not yet optimized). I just saw that float x = 0;
float leadSpeed = std::abs(this->leadMotor->vMax);
for (int i = 0; i < N; i++)
{
float relDist = this->motorList[i]->A / (float)this->leadMotor->A * leadSpeed / std::abs(this->motorList[i]->vMax);
if (relDist > x) x = relDist;
}
targetSpeed = leadSpeed / x; |
Beta Was this translation helpful? Give feedback.
-
Thanks for testing. I'll pull it into the master branch tomorrow. |
Beta Was this translation helpful? Give feedback.
-
Hi @luni64 ! I stumbled across this issue and thought that this is not only applicable for the speed but also for pullIn/pullOut and acceleration? |
Beta Was this translation helpful? Give feedback.
-
Hm seems logical but I need to wrap my head around this, didn't do much with the library lately. Probably the same or a similar algorithm will work for those. If you want to give it I try I can certainly pull it in. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have a 3 axis camera slider (pan tilt slide) using a Teensy3.2 with TeensyStep.
I have observed that when moving all 3 axis together the speed of all 3 axis is a lot lower than it should be.
Obviously I understand that they are all bound by the slowest motor so they have a synchronised finish. I've modified the example sketch so you can test it too.
The speed of the last 2 tests is significantly slower than it could be. Especially the last test, all 3 axis never reach their max speed.
I hope it's something I'm doing wrong!!
Thanks for reading,
Colin
Beta Was this translation helpful? Give feedback.
All reactions