BDCComm Settings for Speed Mode Testing?

Hi Gang,

We’re testing the Jaguars in Speed control mode via BDCComm-92. The Jaguars are updated to Rev 92 of the firmware. I have the KOP encoder (US Digital EAP4 360-250-0-0-0) attached to a CIMple box with 1 CIM attached. The encoder is on the center CIMple box shaft and I have VCC wired to the + on the Jaguar, channel A of the encoder to A on the Jaguar, Gnd on the encoder to -, channel B of the encoder to B on the Jaguar.

For BDCcomm, on the configuration tab, I have the encoder lines set to 360. The mode set to “Speed”. My PID values are set low for testing (P=.3, I=.001, D=0). If I set the Reference to “Quadrature Encoder”, and try to set an RPM, it takes off at full speed rather than the RPM I set.

If I set the reference to “Encoder”, it seems to work at the proper RPM. So, first question is, why not Quadrature Encoder? Do I need to adjust the number of encoder lines or something?

If I try to go into Position mode and set a positive position, the motor takes off in the negative direction and vice versa. Does this mean that it’s actually and “Inverted Encoder”? I’m just trying to figure all of this out before committing it to software.

Also, there is a lot of chatter on the motor with low speeds. So, I’m assuming that my PID values need adjusting. But, no matter how I adjust the PID numbers I can’t get it to stabilize. Any guidance on this adjustment process would be greatly appreciated.



The good news…I know for a fact what you’re trying to do works.

Now why it’s not working for you:

Couple of things come to mind you might want to check.

Make sure you have A and B of the quadrature encoder in the right place in the wiring. Do this first. If there’s anything wrong in the mechanism or wiring there’s no point in tuning it won’t end well. You can check those encoders if you hook them to the cRIO.

As you’re tuning for a set point of RPM (velocity):
Try setting your P gain (Kp) to 0.1 or less and raising your I gain (Ki) between 0.001 and 0.1. If your mechanism can be perfectly driven by the ideal discrete time version of that Jaguar PID loop (in other words it’s a near match to some of the assumptions that math makes) you might not need much P gain (Kp) at all (in theory very little or none). If P gain (Kp) is too high it’ll oscillate (what you might be calling chatter) and sometimes you can move it up slowly from 0.1 to 0.3 for example and it’ll work (you’ll hit hard oscillation if you go up say 50%-80% more)…but then when you set it directly to 0.3 it will immediately oscillate when it starts the motor moving from a dead stop.

Try tuning the mechanism off the floor assuming it’s a drive mechanism.

Not sure about your encoder setting issue haven’t looked at that setting myself will ask the students.
UPDATE: We have our quadrature encoders running as quadrature encoders.
Perhaps A or B is not really connected?

I was having the same trouble with the Quadrature Encoder setting on my team’s robot, but I haven’t gotten around to testing it.
It may be a bug in the Jaguar firmware.

“Encoder” and “Inverted encoder” only use one channel of the encoder for speed, and assume the direction based on its output. I believe the only difference is that “inverted encoder” switches the “forward” direction for the motor, though I’ve no idea if this corresponds to the LED color.
One trouble with these modes is that “encoder” will always return a positive value when you ask its speed, and “inverted encoder” will always return a negative.

Quadrature encoder, however, uses both channels of the encoder to determine the speed AND direction.

As for tuning, I found (0.1, 0.05, 0) works well for my team’s robot. I think this is due to the slop in the chain. On my test robot, my tuning is around (3, 0.1, 0).

One way to check if your encoders are properly connected is to try them in POSITION mode. Note that your PID coeffecients in Position mode can be significantly different from your coeffecients in speed mode, and you DEFINITELY need integral to get to your setpoint.

Thanks Gang!

I’ll definitely try a couple of these suggestions on the robot. Also, I’ll hook my scope up to the encoder outputs to see if we’re really seeing quadrature. It’s good to know that the BDCComm program should see these as a quadrature encoder. This means that the cables may be hosed up. As soon as I get this beaten into submission, I’ll post a write up.



Trying using only a negative P constant.

I tried on my test 'bot at home, and the “quadrature encoder” setting works fine.
I’ll recheck the team’s bot. It probably is an issue with the wires. (Perhaps the encoder connector isn’t properly seated)

I’m assuming that there may be something wrong with the cables I was supplied by the controls folks. I just want to verify the cable layout for the connection from the encoder to the jaguar. Could someone who has the encoder working with the jaguar (as a quadrature encoder) please tell me your cable layout so I can verify my cables?