Go to Post My own opinion is that any truly great student can succeed with any teacher, and any truly great teacher can succeed with any group of students. - DampRobot [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-02-2016, 06:52
Abelbae Abelbae is offline
Registered User
FRC #5784
 
Join Date: Jan 2016
Location: Vassar, MI
Posts: 5
Abelbae is an unknown quantity at this point
Question Talon SRX Velocity Control

Could someone please provide some example code for controlling a flywheel with an SRX to run at a certain velocity? We have an encoder hooked up to the wheel, but we're currently waiting for a breakout board to come in for soldering, so if it's possible, I'd appreciate the code being without an encoder for now.
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2016, 08:31
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: Talon SRX Velocity Control

Hi Abelbae, Welcome to CD. Can you try going to the product's website?
Reply With Quote
  #3   Spotlight this post!  
Unread 04-02-2016, 08:43
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Talon SRX Velocity Control

Start with the provided reference material at http://www.ctr-electronics.com/talon...ical_resources

When you tune it, start with the F parameter then P. If you really need the last 0.1% you could add a small I term.

The new SRX code has a parameters for "peak/nominal closed-loop output". I have not used this before, but it would have solved an issue I had years ago with the older Jaguars. When driving a flywheel, there is significant inertia and if the loop overshoots, the control loop will try to slow the wheel down, potentially by trying to turn it backwards. Reversing the motor while the flywheel blew half the H-bridge driver inside the speed controller.

So, I will amend my recommendation. The F term is the Forward (open-loop) parameter.

1) set P,I,D,F to zero
2) command 800 speed (assuming full range +/- 1023)
3) find a value for F which gets you to the target RPM
4) query what the voltage for that RPM is (Vnom)
5) ConfigPeakOutputVoltage(+12, +Vnom/2)
6) find a value for P that maintains the RPM over changes in load
7) if required, tune I for more accurate nominal values

Especially if you use the I term, you may also want to play with the new ConfNominalOutputVoltage command to create a "good enough" voltage band around your desired RPM. This could help if you have minor oscillations near your target RPM.
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2016, 16:58
Abelbae Abelbae is offline
Registered User
FRC #5784
 
Join Date: Jan 2016
Location: Vassar, MI
Posts: 5
Abelbae is an unknown quantity at this point
Re: Talon SRX Velocity Control

Thank you for the information. I'm figuring it out right now, but sadly I won't be able to test it for a few days, as the team is currently getting the electrical on the robot. I'll post more if I have any questions.
Reply With Quote
  #5   Spotlight this post!  
Unread 06-02-2016, 12:00
bohdand bohdand is offline
Registered User
FRC #1099
 
Join Date: Jan 2016
Location: CT
Posts: 4
bohdand is an unknown quantity at this point
Re: Talon SRX Velocity Control

gpetilli,

Thank you for posting your tuning steps. I've tried to use them and I am getting unusual results and hoping you might be able to provide some guidance.
We are using velocity closed loop mode, CTRE Mag encoder in Relative.

I've set PIDF all to zero, set a RPM speed of 1000 RPM and increased F to 0.84 to obtain ~1006 RPM. Once I start to increase P - in this case 0-> 0.1 the speed slows down to to 600 RPM. If I add some I, the motor goes to max reverse speed (~1200).

Any help would be appreciated.

Thanks,

bohdand
Reply With Quote
  #6   Spotlight this post!  
Unread 06-02-2016, 12:29
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: Talon SRX Velocity Control

Quote:
Originally Posted by bohdand View Post
Any help would be appreciated.
Grab a screenshot of the roboRIO-web-based config Self Test when the closed-loop is misbehaving and post it here.


Reply With Quote
  #7   Spotlight this post!  
Unread 06-02-2016, 12:30
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: Talon SRX Velocity Control

Sounds your motor and sensor are not in-phase.

gpetilli's procedure is helpful, but not quite complete. Take a look at section 12.4 for a complete walk through of velocity close-loop (Talon SRX Software reference manual).

Also section 16.31 "My Closed-Loop is not working? Now what?"
Reply With Quote
  #8   Spotlight this post!  
Unread 08-02-2016, 09:13
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Talon SRX Velocity Control

Quote:
Originally Posted by bohdand View Post
gpetilli,

Thank you for posting your tuning steps. I've tried to use them and I am getting unusual results and hoping you might be able to provide some guidance.
We are using velocity closed loop mode, CTRE Mag encoder in Relative.

I've set PIDF all to zero, set a RPM speed of 1000 RPM and increased F to 0.84 to obtain ~1006 RPM. Once I start to increase P - in this case 0-> 0.1 the speed slows down to to 600 RPM. If I add some I, the motor goes to max reverse speed (~1200).

Any help would be appreciated.

Thanks,

bohdand
it almost sounds like your motor and encoder disagree on which direction is positive. If that is the case, you may be able to use a -0.1 for P. Do post your screen shots as requested by Ether.

The steps I gave are fairly generic and intended to help you through the basic thought process, you should use the more detailed debugging instructions in the CTRE documentation.
Reply With Quote
Reply


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 03:01.

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