Motor speed drops to zero between speed changes

Hi,

We are working on robotmesh desktop. The program uses a variable to store motor speed, with an initial value of 20%.

Then, after some criteria are met, the variable can increase/decrease in increments of 10%, sort of a blocky-based pid.

The ramping, in code, is working fine. Problem is… when the motor receives the new variable value, it appears to try and stop for a split second, then adjusts to the new speed.

Clearly, this is a big problem.

Seems to happen if we have the variable change quickly (like a few times/second) or slowly (like once per every 2-3 seconds).

Posting your code might help…

1 Like

image

That block increases motor velocity every .3 seconds by 15%.

We are displaying the velocity_target to the screen. It changes properly. The motor, on the other hand, decides to try and stop (or at least slow WAY down VERY quickly) every time it receives a new speed setting. It does adjust to the new setting, but seems to try and stop between each speed adjustment.

Not knowing what you are trying to do and not seeing the entire program makes it hard to diagnose the problem. For instance, the issue could be with how the looping is working, but there is no loop in the screen print. Where are each of the variables that are being used being set?

Normally when a motor is twitching, as you have described, the motor speed is being set in multiple places.

Every time you call “start rotate to” the motor will reset some internal variables and start moving to the target position. If you want to ramp speed, you will have to handle the motor moving externally.

5 Likes

All variables are set in the initial start block.

What you see is inside a forever loop. Once the motor’s speed is constant, the twitching/jittering/etc stops… even though it’s still hitting the “move” block again and again.

It seems the default mode, for when the variables are being reset/updated, is to go into ‘brake’ mode regardless of what the stopping mode is set to.