Go to Post Well, it's officially that part of the offseason where we all lose our minds again. - Whippet [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-01-2012, 15:09
duffany1 duffany1 is offline
Registered User
AKA: Brandon
FRC #0195 (The Cyberknights)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2006
Location: Southington, CT
Posts: 17
duffany1 is an unknown quantity at this point
WPILibrary's CANJaguar Class?

Hi,

I've got a few questions relative to the CANJaguar class in the WPI Library.

Does the CANJaguar included in the WPI Library run on its own interrupt routine? In other words, if we run custom PID code, and we perform functions with Jaguars using CAN, are we going to be 100% sure that our IRQ rate specified in our program (for TeleopPeriodic) will be the actual IRQ rate for the Jags? I need the wisdom of someone experienced with the WPI Library.

Thanks in advance.
  #2   Spotlight this post!  
Unread 13-01-2012, 01:25
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: WPILibrary's CANJaguar Class?

Quote:
Originally Posted by duffany1 View Post
Does the CANJaguar included in the WPI Library run on its own interrupt routine? In other words, if we run custom PID code, and we perform functions with Jaguars using CAN, are we going to be 100% sure that our IRQ rate specified in our program (for TeleopPeriodic) will be the actual IRQ rate for the Jags? I need the wisdom of someone experienced with the WPI Library.
The PID algorithm that runs on the Jaguar uses the timer interrupt on the controller internally (every 1ms). It does not depend on an interrupt in the cRIO. That's one of the nice things about using CANJaguar's PID instead of running the PID algorithm on the cRIO. Each control loop has a dedicated microcontroller to run it.
  #3   Spotlight this post!  
Unread 14-01-2012, 00:00
duffany1 duffany1 is offline
Registered User
AKA: Brandon
FRC #0195 (The Cyberknights)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2006
Location: Southington, CT
Posts: 17
duffany1 is an unknown quantity at this point
Re: WPILibrary's CANJaguar Class?

Quote:
Originally Posted by jhersh View Post
The PID algorithm that runs on the Jaguar uses the timer interrupt on the controller internally (every 1ms). It does not depend on an interrupt in the cRIO. That's one of the nice things about using CANJaguar's PID instead of running the PID algorithm on the cRIO. Each control loop has a dedicated microcontroller to run it.
Correct me if I'm wrong, but what I'm getting from your response is that the easiest way to get the Jaguar to run proper PID code is to use the WPI Library's functions from the CANJaguar class, which were written to cooperate with the built-in 1ms interrupt? If that is what you are saying, then is there any way for us to implement our own PID code directly within the microcontroller of the Jaguar itself, to get it running on the 1ms interrupt, instead of us running our code within the cRIO (TeleopPeriodic)?

To clarify: last year, we actually did not use the PIDController class or the CANJaguar class; instead, we wrote our own PID algorithm and used the SetSpeed function from the normal Jaguar class (if I can recall the name of that function correctly) to carry out the ramped speed commands. (We did not use CAN, either.)

What I'm now wondering is this: Last year, were we in fact trying to run our custom PID code, while at the same time the Jaguar was running its own little PID code in its own world, potentially interfering with our PID code? (i.e., did we just get lucky that we didn't have any problems with these two algorithms running in parallel?) And if so, is it possible to perhaps replace the PID algorithm that the Jaguar uses by default with our own PID code, so that we can be sure that our interrupt routine is the only interrupt routine that is running in this system?

I am sorry if parts of this don't make sense, or if I am confounding any fundamental components of the Jaguar's internal operation, as I am somewhat inexperienced in this area. But I can further clarify my questions if necessary.
  #4   Spotlight this post!  
Unread 14-01-2012, 03:29
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: WPILibrary's CANJaguar Class?

If you weren't using CAN last year, then you weren't using the Jaguar's PID. That is the only interface to enable the internal controller.

If you want to run the PID controller on the cRIO, that's fine. I'm surprised you wrote your own given the very capable implementations provided for you.

There is no way for you to replace the PID algorithm in the Jaguar. You may either use it as is via CAN, or you may ignore it and run any other PID implementation on the cRIO.
  #5   Spotlight this post!  
Unread 14-01-2012, 09:40
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 990
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: WPILibrary's CANJaguar Class?

Quote:
Originally Posted by jhersh View Post
There is no way for you to replace the PID algorithm in the Jaguar.
You can set the constants however (and have to if using a mode that uses the PID controller)
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:47.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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