We are trying to program a motor to move but for some reason even without input it’s twitching. It works fine with input but without it the motor just moves as if it had a little flash of input. Any solutions to make it stop?
Does it happen when the robot is Disabled? If so, try a new motor controller.
If not, then check your code. Something may be setting motor speed to something other than 0.
While Enabled it’s always receiving input, even if that input should be neutral.
Do you call Set Motor in more than one place?
Does the motor continue to twitch if you disconnect the joystick?
Is the motor controller status light solid? (and what kind of motor controller is it?)
If you have it programmed to be controlled by a joystick, one possibility may be that you do not have a “dead band” in your code. Even when the joystick is relaxed in its natural or zero position, it still may be outputting small numbers.
To fix this you may add a simple if statement, or a case structure if you use labview, that says if the absolute value of the joystick input is less than X. You will have to test to see what X works for you.
Again, this is just one problem my team has had in the past.
What kind of speed controller are you using? I occasionally saw the original Talons “twitch” when something induced noise on the PWM cable.
I have also seen very brief twitches occur using RoboRIO firmware from several years ago when the robot code lost communication for a moment and disabled the PWM outputs at just the right/wrong time to make the speed controller think it had gotten a single “run backwards at high speed” pulse before timing out and shutting off. I thought that undesired behavior was fixed, though.
Just to add one more speculative element. Are you using a Y cable to send the PWM signal to more than one motor controller? If so, jiggle or roll the cable between your fingers to see if that will cause the disabled motor controllers to twitch. If so, fix the cable to get rid of shorts at the Y.
We struggled with that some last year as well. After we had one of our can-grabbers deploy and almost take off the head-mentors nose, we tried rerouting wires, etc. We never managed to completely beat the twitches though.