-
Notifications
You must be signed in to change notification settings - Fork 73
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
Stop is not correctly implemented? #86
Comments
Have you tested this? If so which Firmata client library did you use? |
ConfigurableFirmata 2.10.1 It is not certain that this is a bug, maybe the author knowingly did this. It was a little confused for me, When we issue the stop command to the motor, it doesn't stop yet. See stop command in accelstepper library (https://www.airspayce.com/mikem/arduino/AccelStepper/classAccelStepper.html#a638817b85aed9d5cd15c76a76c00aced). It only starts the deceleration So it doesn't complete, only stop/complete with just a few cycles later, if you set a deceleration parameter. The question is, can an earlier function be evaluated as correct? Is running the motor? Yes, it's running (it's rotating), but the stop process has started. So, I think this would be correct (if there is a deceleration): |
I wouldn't expect it to report the position prior to the stop completing, but it sounds like that's what you are describing. I'll take a look after work tonight. |
I'm not with hardware yet, but it looks like it will report the position twice. Once when stop is fired and once when the deceleration has stopped. |
I'm running AccelStepper 1.23.0 and it stops immediately which is by design. I made a conscious decision to stop immediately even when acceleration is used. Here was my reasoning. Is it decelerating when stopping for you? Perhaps something changed in accelStepper? |
I am trying to make a Lazarus client (pascal) and in my tests found Stop function does not work properly, it stops suddenly not smoothly. Looking in the source code I think I found the problem, it works for me. In AccelStepperFirmata.cpp file I removed or commented two lines else if (stepCommand == ACCELSTEPPER_STOP) { |
It was a conscious decision to have stop not decelerate based on the use cases I imagined (limit switches and panic buttons). Tell me about your use case. |
I personally prefer a smooth stop but I agree with you in some cases it is better to stop suddenly (if you have limits like a garage door hitting your car), but that can cause problems too, imagine a motor with heavy load, that means a lot of inertia can cause problems. |
Ah, so we should definitely update the current speed. Let me look into how accelStepper would handle an immediate stop when a stepper has deceleration. |
The AccelStepperFirmata documentation for the |
Or maybe a little modified stop command like this |
Because I need to continue developing my Lazarus client I definitely changed the source code of AccelStepperFirmata, commenting the two lines, so I have a smooth stop now, when I need a sudden stop I have implemented a faststop function, setting Acceleration to max_acceleration, then calling stop (in this case with max deceleration) and then set normal acceleration again. |
Is abrupt stop problem can be only solved as jcvillegasfernandez suggests or there update with fix on the way? |
here's the code
if (stepCommand == ACCELSTEPPER_STOP) {
if (stepper[deviceNum]) {
stepper[deviceNum]->stop();
isRunning[deviceNum] = false;
reportPosition(deviceNum, true);
}
}
But the accelstepper library cannot handle the quick stop. Therefore, the deceleration must be waited before the stepper motor stops. Is the report too early?
The text was updated successfully, but these errors were encountered: