Go to Post I like the way you are saving weight by cutting out the center of the speed controllers. - jcatt [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
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 26-12-2013, 08:06
DavisDad's Avatar
DavisDad DavisDad is offline
MechE
AKA: Craig Rochester
FTC #8470 (Team Technado)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Boston
Posts: 317
DavisDad will become famous soon enoughDavisDad will become famous soon enough
Jaguar Speed & Position Control with Encoders

Last year we tried to use the Jaguar Motor Controller's position and speed control functions in our Ultimate Accent bot. We got the BDC-COMM utility to work but couldn't work out the "C" programming.

We've had good success on the FTC team using the Matrix motor controller and would like to achieve a similar performance with Jaguars.

I'd appreciate any feedback or point me to a thread where this is discussed.
  #2   Spotlight this post!  
Unread 26-12-2013, 14:14
brennonbrimhall brennonbrimhall is offline
Free Agent
AKA: Brennon Brimhall
no team
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Clifton Park, NY
Posts: 222
brennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to allbrennonbrimhall is a name known to all
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by DavisDad View Post
We got the BDC-COMM utility to work but couldn't work out the "C" programming.
I'm going to operate with the assumption that by "C programming," you mean the C++ programming on the cRIO.

While we use Java, that should be similar to the API we use, which can be found here for all of the classes used in WPILibJ, or here for the CANJag class.

Does anyone know of similar documentation for C++?
__________________
Team 20, 2012-2014: 4 blue banners, 5 medals, and 9 team awards.
Church of Jesus Christ of Latter-day Saints, 2014-2016: Missionary, Colorado Denver South Mission.
  #3   Spotlight this post!  
Unread 26-12-2013, 16:38
DavisDad's Avatar
DavisDad DavisDad is offline
MechE
AKA: Craig Rochester
FTC #8470 (Team Technado)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Boston
Posts: 317
DavisDad will become famous soon enoughDavisDad will become famous soon enough
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by brennonbrimhall View Post
I'm going to operate with the assumption that by "C programming," you mean the C++ programming on the cRIO.

While we use Java, that should be similar to the API we use, which can be found here for all of the classes used in WPILibJ, or here for the CANJag class.

Does anyone know of similar documentation for C++?
I'm not a C++ programmer and will relay any info about this to my son who knows that stuff. I'm mechanical and would understand mechanism and controls hardware. I've worked with industrial PLCs using ladder logic and have some understanding of controls systems. The big questions for me are:
  • Do the Jaguar on-board speed and position controls work? If so, looking for examples of successful controls strategy?
  • Is my assumption correct that using the Jaguar's micro-controller PID loops faster and more efficient than running feedback/feed-forward loops from the CReo?
  • Is the CAN Bus route worth the effort?
  • What questions have I forgotten to ask?
  #4   Spotlight this post!  
Unread 26-12-2013, 16:57
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

The PID functionality of the Jaguars does work, but adding CAN can be expensive depending on which adapter you use.

The PID on the cRIO is just as fast and as powerful as the one on the jaguar, but works with all types of speed controllers and sensors. If you're looking for basic getting started examples, there are plenty for PID on the cRIO.
  #5   Spotlight this post!  
Unread 26-12-2013, 19:06
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Jared View Post
The PID on the cRIO is just as fast and as powerful as the one on the jaguar,
Why do you say this? I wasn't aware that anyone was running PID at 1000 hz on the cRIO. Doing PID on the cRIO is more flexible, however, since you can implement your own.

The serial CAN interface is somewhat inefficient, and you may find that if you send to many updates, it may use more cRIO throughput then running a 50 or 100hz PID on the cRIO would. One option would be to invest in the 2CAN. Another option would be to limit the amount of CAN traffic. Setting a setpoint every few seconds isn't a problem. Changing setpoints at 50hz to multiple jaguars and requesting lots of status can be a problem.

Last edited by Joe Ross : 26-12-2013 at 19:21.
  #6   Spotlight this post!  
Unread 26-12-2013, 21:30
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Joe Ross View Post
Why do you say this? I wasn't aware that anyone was running PID at 1000 hz on the cRIO. Doing PID on the cRIO is more flexible, however, since you can implement your own.
I tested this last year. I tried 800 hz to 10 hz, and everything faster than 100 hz behaves the same way as 100 hz because the victor can only be updated every ~20 ms (50 hz).

Also, I don't think that a drivetrain used in FRC will benefit from being updated 100 times a second vs 1000.

Where did you find the 1000hz number? I'm not saying it's wrong, but I couldn't find it online.
  #7   Spotlight this post!  
Unread 26-12-2013, 21:43
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Jared View Post
Where did you find the 1000hz number? I'm not saying it's wrong, but I couldn't find it online.
The point Joe was making is that the built-in PID in the Jag's firmware closes the loop at 1000 Hz. You can't do that with cRIO. You can't do that with Victor or Talon.

Quote:
everything faster than 100 hz behaves the same way as 100 hz because the victor can only be updated every ~20 ms (50 hz).
Victors will accept 200 Hz input PWM frequency.


Quote:
I don't think that a drivetrain used in FRC will benefit from being updated 100 times a second vs 1000.
Other systems might.



Last edited by Ether : 26-12-2013 at 21:50.
  #8   Spotlight this post!  
Unread 28-12-2013, 05:09
DavisDad's Avatar
DavisDad DavisDad is offline
MechE
AKA: Craig Rochester
FTC #8470 (Team Technado)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Boston
Posts: 317
DavisDad will become famous soon enoughDavisDad will become famous soon enough
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Ether View Post
The point Joe was making is that the built-in PID in the Jag's firmware closes the loop at 1000 Hz. You can't do that with cRIO. You can't do that with Victor or Talon.



Victors will accept 200 Hz input PWM frequency.




Other systems might.


Hi Ether,

First- I've read many of your posts and want to compliment you on your contributions to the teams. Your to-the-point, thorough, and expert responses are a pleasure to read. Thank you!

I've begun following your links and have a lot of studying to do...
  #9   Spotlight this post!  
Unread 28-12-2013, 17:17
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 748
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Ether View Post
Victors will accept 200 Hz input PWM frequency.
Yeah, but the point Jared was making was that the pulse width coming from the sidecar is about 20 ms, so you still can't get better than about 50 hz.

Also, I'm having a really hard time thinking of an FRC application where you need to update 1000 times per second over 100 or 200. It seems to me that in a single millisecond, a negligible amount of change can be done to the speed of a motor, and that some sensors won't show a change over 1/1000 of a second.

Has anybody really seen a benefit from really fast PID loops?
  #10   Spotlight this post!  
Unread 28-12-2013, 17:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Ether View Post
Victors will accept 200 Hz input PWM frequency
Quote:
Originally Posted by magnets View Post
Yeah, but the point Jared was making was that the pulse width coming from the sidecar is about 20 ms, so you still can't get better than about 50 hz.
The pulse width is not 20ms. The period is 20ms. The pulse width varies from roughly 1ms (full reverse) to 1.5ms (zero command) to 2ms (full forward.

You can change the PWM period coming from the sidecar, so you can send commands at a higher frequency.


  #11   Spotlight this post!  
Unread 28-12-2013, 17:39
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by magnets View Post
Yeah, but the point Jared was making was that the pulse width coming from the sidecar is about 20 ms, so you still can't get better than about 50 hz.
The PWM pulse repeat rate can be as high as 200hz. By default, it is 200hz for Jaguars, 100hz for Victors and Talons, and 50hz for Servos.
  #12   Spotlight this post!  
Unread 28-12-2013, 18:54
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 748
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Joe Ross View Post
The PWM pulse repeat rate can be as high as 200hz. By default, it is 200hz for Jaguars, 100hz for Victors and Talons, and 50hz for Servos.
I was unaware that this works. A while back (2009 or 2010) I looked at the signal with a scope, the pulse width was somewhere between 1-2.5 ms, and the delay in between was 20 ms, no matter what speed controller was selected (in LabVIEW).
  #13   Spotlight this post!  
Unread 31-12-2013, 10:39
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by magnets View Post
Has anybody really seen a benefit from really fast PID loops?
We have had a very positive experience using the closed loop PID in the Jaguar with Speed Control. Less than .25 seconds to reach proper speed from 0, even shorter times when returning to speed after a shot.

It doesn't require the CRIO PID to process it which free resources that can be used for other things.
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics


  #14   Spotlight this post!  
Unread 15-01-2014, 16:54
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Phalanx View Post
We have had a very positive experience using the closed loop PID in the Jaguar with Speed Control. Less than .25 seconds to reach proper speed from 0, even shorter times when returning to speed after a shot..
Note to rookies:

Fast spinup and recovery times are strongly influenced by mechanical design: operating speed, motor(s) selection, gear ratios, wheel diameter, and moment of inertia of the load (including wheel and flyweight). With a proper mechanical design, you should be able to get fast spinup and recovery times with other controllers as well.


  #15   Spotlight this post!  
Unread 26-12-2013, 21:45
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Jaguar Speed & Position Control with Encoders

Quote:
Originally Posted by Jared View Post
Where did you find the 1000hz number? I'm not saying it's wrong, but I couldn't find it online.
It's in the jaguar source code (not sure if it's still available online, used to be available from TI). There is a 1ms timer interrupt. It runs the PID and updates the H-bridge PWM from the same interrupt.
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 10:14.

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