Motors Giggle (Not Stalling) On Calibration

It was warm enough in the garage this weekend to get my 212:2 11ppr motors hooked up and tested. I am getting a very strange problem now though.

When I run the motor test I get Left-CCW then CW, Right-CCW then CW and pass shows up for the encoder feedback. (Encoders are set up as 212x11x4=9328). Movement during this test is nice and smooth.

When I try and calibrate the chain length everything blow up. Pressing Left CW 5deg will run the left motor CW but will make an awful grinding/jittering sound. I then press CCW 5deg and it jitters and kinda move the other direction. Both motors pass the test but even when jogging make a jittery racket. I removed the chains and it changes nothing.

Odley enough if you swap the wires at the motors they will jog smoothly but the motor test will fail on encoder feedback. If I swap the two encoder A/B wires the test will pass but we will be back to jittery movement on jog/calibration.

My motor driver is seperate to I have checked all the wiring. Chaning the hardware pins in firmware acheives the same results as swapping the wiring.

Anybody know why it’s doing this?

I would guess that you would need to tweak the PID values, but I don’t know what
the right tweaks would be.

1 Like

I would have thought the motor test code would use the same PID/Settings as general motion. If they are different how can I figure out what the test code is sending?

it’s using the same code, but during the motor tests, there is no load, and that
makes the motors behave a little differently.

I tested with chains and load attached and with chains removed. Same behavior regardless of load.

Its almost like its trying to go the wrong way, feedback realizes this and changes direction then tries to go the other way again. Net gain is very slowly going the right way.

Ok, we had someone else get into this mode, what’s probably happening is that
the motors are overshooting and reversing to try and get to the right position

The suggestion was to reduce one of the PID values from 5, and for that person,
3 was about right.

since you have different motors, it’s very likely that you will need different
PID settings.

the trick with PID tuning is to make it as aggressive as you can, without
pushing it into instability like you are seeing, so it’s a matter of backing off
a bit to make it stable.

During the motor tests, they are commanded to run ‘full throttle’ for a second and the firmware checks that there have been a reasonable number of encoder pulses received in the correct direction. They test a rudimentary part of the motor system.
During the chain calibration, the distance to move the chain is calculated and the full PID loop is used to make the move. The ‘giggling’ may be due to the mismatch of the PID settings and the PPR value of your encoders. You may need to explore The PID settings to make progress on this. There is a Testing library in the recent release of Firmware, with interesting functions like:

PIDTestVelocity(Axis*, const float, const float, const float, const float);
positionPIDOutput (Axis*, float, float);
PIDTestPosition(Axis*, float, float, const float, const float, const float);
voltageTest(Axis*, int, int)

but I haven’t explored any fo it. These may well be things best left alone, but they do look useful :smile:.

1 Like

Is this related to the issue we saw on @Johnny5 Maslow?

Thank you

Re-reading the manual says “without the weight of the sled the motors will move in a rather jerky fashion during this process” so that would lead me to believe without the weight the PID is freaking out, yea.

I will re-assemble the sled next time I can get outside and see if that helps things out.

One issue that shouldn’t be PID related is that the calibration 0.1deg, 1deg, 5deg all make the motor run for the same ~2 seconds of run time. Hopefully that is just the time the PID takes to settle/give up and not another issue for me.