Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SyncDriver for accelerated move #78

Closed
laurb9 opened this issue Feb 3, 2019 · 7 comments
Closed

Fix SyncDriver for accelerated move #78

laurb9 opened this issue Feb 3, 2019 · 7 comments

Comments

@laurb9
Copy link
Owner

laurb9 commented Feb 3, 2019

SyncDriver proportional rpm reducing method does not work well for accelerated mode because the timing for acceleration/deceleration phases is not linear.

Update the math to calculate plateau rpm correctly.

@laurb9 laurb9 added this to the 1.2.0 milestone Feb 3, 2019
laurb9 added a commit that referenced this issue Feb 5, 2019
Now SyncDriver just tells StepperDriver to use the allotted time, instead of guessing rpms.
The "move in time" functionality is not yet exposed through the other move* methods.
@laurb9
Copy link
Owner Author

laurb9 commented Feb 9, 2019

A little bit of quadratic equations and this is working correctly now, at least with regard to timing calculation (there is still a slowdown somewhere else but it's not related to the sync math).

@laurb9 laurb9 closed this as completed Feb 9, 2019
@jamesdelaneyie
Copy link

Hi there,

I was having issues today with getTimeForMove() returning incorrect values when using Accel/Deaccel unless they were about ~2100. Working a-ok on constant speed. Didn't realise v1.2 was out, will upgrade library tomorrow and test, but am was wondering if the above fix might have also fixed this issue I was having?

I also removed startMove from the function so that I could call startRotate on a deg, and then use other functions to work out the time remaining. Seemed to work fine for constant speed but again, not with Accel

@laurb9
Copy link
Owner Author

laurb9 commented Feb 14, 2019

Yes, it does sound like the problem (issue #39 ) that was fixed in 1.1.4. Try the newest version.

@jamesdelaneyie
Copy link

I did update the library last night but was still having issues. I'll remove all excess code and add here when I'm working on it again. From memory all my setting are like the below, rather low in general

RPM: 10
ACCEL: 50
DEACCEL: 30
MICROSTEPS: 8

Using MP6500 Polulu Driver, Arduino Mega.

Great library btw, thanks a mil for making it. Should really make a seperate issue here but I updated Multidriver to run 4 motors, worked great. Planning to update to 12 later on. Think I'll run into any issue?

@laurb9
Copy link
Owner Author

laurb9 commented Feb 15, 2019

With 12 motors you would see a progressive slowdown and a low rpm floor, but at the speeds you are talking about it should still work. I'd be more concerned about having enough GPIO pins.

Consider using constant speed. The motor can start moving directly at 10RPM, unless it has a very large load.

@jamesdelaneyie
Copy link

Hi Laurb9,
Have successful got 6 motors working with the Multidriver without any issue. The Mega with 52+ pins is loads for me, not a problem there.

The thing I'm building is here: https://twitter.com/jamesdelaneyie/status/1097319700235776000. A prototype atm, It's half of what the full installation will be. So 12 motors + 18 LED strips in total. The arms are about 50cm long, fulcrum about 4cm in from end, and weight about ~80g each iirc. Constant speed is a bit to sharp a movement, but might experiment with lower degrees of movement.

I'll try get the data from the previous test tonight, but one thing I havn't tried yet and was going to test to night as well is, is it possible to call .begin() and .setSpeedProfile() in the loop and update the RPM, ACCEL and DECEL settings?

@laurb9
Copy link
Owner Author

laurb9 commented Feb 22, 2019

Interesting application you have there. Indeed you might need acceleration or if using constant speed, you could try varying the rpm while moving with setRPM(). Accel mode will only get slower when many motors move at the same time.

begin() you should only call once - it sets up the pins. If setSpeedProfile() is called while moving in accelerated mode, nothing will change because startMove() precalculates the acceleration parameters at the start of the move only. If you call startMove() while moving, it'll try to start again from 0rpm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants