Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Switching CAN Jaguar Control Modes (http://www.chiefdelphi.com/forums/showthread.php?t=92527)

virtuald 21-02-2011 00:49

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!

EricS-Team180 21-02-2011 10:31

Re: Switching CAN Jaguar Control Modes
 
Quote:

Originally Posted by virtuald (Post 1028085)
kPercentVbus mode

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.

Eric

vinnie 21-02-2011 11:37

Re: Switching CAN Jaguar Control Modes
 
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.

virtuald 22-02-2011 12:08

Re: Switching CAN Jaguar Control Modes
 
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.


All times are GMT -5. The time now is 03:45.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi