Switching CAN Jaguar Control Modes

We’ve got our Jaguar connected via CAN, and we have an encoder and limit switches hooked up to it. We can read the encoder inputs from it (woo!), and the limit switches work correctly too.

We were trying to get the kPosition mode to work correctly, but it doesn’t seem to work at the moment quite yet. We were already planning to implement a manual override for our arm, so that works perfectly fine. However, once we switch to kPosition mode, it seems to indicate that it did the switch, but when we switch back to the kPercentVbus mode the motor control doesn’t seem to work anymore.

I’m probably going to make a simpler mockup tomorrow morning and try it, but I was wondering if anyone has tried doing this sort of thing before (switching back and forth between different control modes), and if there were any tricks to getting it to work.

Any thoughts? We’re using C++/python, but I feel this is probably a language agnostic thing. Thanks!

Isn’t it kPercentVoltage, in the CanJaguar.h this year?

We’ve actually had problems with the kPercentVoltage enum. But, ignoring the controlmode input, reverts to kPercentVoltage as a default.


After you switch control modes you have to reset PID and enable control, and reset encoder settings. It took a while for us to realize why our robot wasn’t working then I looked at the Javadoc and it said that when changing the control mode we needed to reset all those values.

Vinnie, thanks for your input. I had realized that it required the parameters to set each time the control mode had switched around, but I looked back at it and saw that we had forgotten a setting or two.

The other key realization is that you only have to call ‘EnableControl’ when you are switching into a feedback-controlled mode – like kPosition or kSpeed. When you switch back into kPercentVBus, one shouldn’t call EnableControl otherwise it doesn’t seem to work.