Glad I have more than six weeks with you.
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 11-02-2017, 21:04
Oblarg Oblarg is online now
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,133
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
CANTalon getEncVel update rate

So, in order to aid with PID tuning we log our encoder readings to a file on the roboRIO. The subroutine that writes values to our log file is called from a command that is run by the scheduler in the main robot loop. Previously, we had used CANTalon.getEncVel to log the velocity readings - but we were constantly perplexed because, when doing this, the update rate of the recorded velocity value appeared to be significantly slower than the frequency of the main loop, resulting in plots which looked "step-like" (there'd be 5 constant data points, and then a change in value, and then 4 more data points at the new value, etc).

Today, on a hunch, we changed the logging function to call CANTalon.getSpeed, instead, and the problem went away.

Has anyone else noticed anything like this? It seems bizarre that any of the CANTalon methods would update at a rate slower than the roboRIO's 50hz main loop, given how fast the Talon control loop runs.
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016

Last edited by Oblarg : 11-02-2017 at 21:15.
Reply With Quote
  #2   Spotlight this post!  
Unread 11-02-2017, 21:34
Ken Streeter's Avatar
Ken Streeter Ken Streeter is offline
Let the MAYHEM begin!
FRC #1519 (Mechanical Mayhem)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Team: Milford, NH; Me: Bedford, NH
Posts: 478
Ken Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond repute
Re: CANTalon getEncVel update rate

Quote:
Originally Posted by Oblarg View Post
... we had used CANTalon.getEncVel to log the velocity readings - but we were constantly perplexed because, when doing this, the update rate of the recorded velocity value appeared to be significantly slower than the frequency of the main loop, resulting in plots which looked "step-like" (there'd be 5 constant data points, and then a change in value, and then 4 more data points at the new value, etc).

Today, on a hunch, we changed the logging function to call CANTalon.getSpeed, instead, and the problem went away.

Has anyone else noticed anything like this? It seems bizarre that any of the CANTalon methods would update at a rate slower than the roboRIO's 50hz main loop, given how fast the Talon control loop runs.
Well, the good news is that the behavior you observed with the "step-like" updates of getEncVel every 5 cycles through the RoboRIO loop exactly matches the documented 100ms update rates for the API that fetches the values for the Encoder in the TalonSRX. This is because the Quadrature Encoder Status message is updated every 100ms.

This is described in the Talon SRX Software Reference Manual (see the links at https://www.ctr-electronics.com/talo...ical_resources ). The Quadrature Encoder Status frame is described in section 20.3. Your circumstance is also in the FAQ as question 16.9.

I know it's quite a tome, but there are some valuable things to be learned in the 160+ page Talon SRX Reference Manual.

The key thing to know in your specific usage scenario is that if you ensure your Talon in question is configured with the selected sensor being the Quadrature Encoder, you can then use the various calls like getSpeed() etc., as you found, to get information for the selected sensor, as that is updated every 20ms, as described in section 20.2 of the Talon SRX Reference Manual.
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"

Last edited by Ken Streeter : 11-02-2017 at 21:39.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2017, 22:43
Oblarg Oblarg is online now
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,133
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: CANTalon getEncVel update rate

Quote:
Originally Posted by Ken Streeter View Post
Well, the good news is that the behavior you observed with the "step-like" updates of getEncVel every 5 cycles through the RoboRIO loop exactly matches the documented 100ms update rates for the API that fetches the values for the Encoder in the TalonSRX. This is because the Quadrature Encoder Status message is updated every 100ms.

This is described in the Talon SRX Software Reference Manual (see the links at https://www.ctr-electronics.com/talo...ical_resources ). The Quadrature Encoder Status frame is described in section 20.3. Your circumstance is also in the FAQ as question 16.9.

I know it's quite a tome, but there are some valuable things to be learned in the 160+ page Talon SRX Reference Manual.

The key thing to know in your specific usage scenario is that if you ensure your Talon in question is configured with the selected sensor being the Quadrature Encoder, you can then use the various calls like getSpeed() etc., as you found, to get information for the selected sensor, as that is updated every 20ms, as described in section 20.2 of the Talon SRX Reference Manual.
Thanks for the info.

We look things up in the reference manual whenever possible, but if you don't exactly know what to look for it's sufficiently lengthy that it can be difficult to find things. I confess I haven't read it cover-to-cover.

We generally don't like to use getSpeed, because we try to avoid using the Talon's internal unit scaling whenever possible (we like our units in RPS, not RPM, and it is easier just to make sure every function we call gives us native units and scale them ourselves).
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
  #4   Spotlight this post!  
Unread 11-02-2017, 23:49
Ken Streeter's Avatar
Ken Streeter Ken Streeter is offline
Let the MAYHEM begin!
FRC #1519 (Mechanical Mayhem)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Team: Milford, NH; Me: Bedford, NH
Posts: 478
Ken Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond reputeKen Streeter has a reputation beyond repute
Re: CANTalon getEncVel update rate

Quote:
Originally Posted by Oblarg View Post
We generally don't like to use getSpeed, because we try to avoid using the Talon's internal unit scaling whenever possible (we like our units in RPS, not RPM, and it is easier just to make sure every function we call gives us native units and scale them ourselves).
I'm a fan of using all native units, too. getSpeed() continues to report in nativeUnits if one simply never calls "ConfigEncoderCodesPerRev()"

We intentionally do not call ConfigEncoderCodesPerRev() so that we receive sensor positions and velocities in native units, as described in the table in section 17.2.1.
__________________
Ken Streeter - Team 1519 - Mechanical Mayhem (Milford Area Youth Homeschoolers Enriching Minds)
2015 NE District Winners with 195 & 2067, 125 & 1786, 230 & 4908, and 95 & 1307
2013 World Finalists & Archimedes Division Winners with 33 & 469
2013 & 2012 North Carolina Regional Winners with teams 435 & 4828 and 1311 & 2642
2011, 2010, 2006 Granite State Regional Winners with teams 175 & 176, 1073 & 1058, and 1276 & 133
Team 1519 Video Gallery - including Chairman's Video, and the infamous "Speed Racer!"
Reply With Quote
  #5   Spotlight this post!  
Unread 11-02-2017, 23:57
Oblarg Oblarg is online now
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,133
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: CANTalon getEncVel update rate

Quote:
Originally Posted by Ken Streeter View Post
I'm a fan of using all native units, too. getSpeed() continues to report in nativeUnits if one simply never calls "ConfigEncoderCodesPerRev()"

We intentionally do not call ConfigEncoderCodesPerRev() so that we receive sensor positions and velocities in native units, as described in the table in section 17.2.1.
Yeah, but we occasionally use the CTRE mag encoder, and so if we call getSpeed we need to have an extra if statement and change our unit scaling (unless there's some way to use the CTRE mag encoder without leveraging the internal unit scaling?).
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
  #6   Spotlight this post!  
Unread 12-02-2017, 23:20
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: 566
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: CANTalon getEncVel update rate

Quote:
Originally Posted by Oblarg View Post
...(unless there's some way to use the CTRE mag encoder without leveraging the internal unit scaling?).
Just select Quadrature, its equivalent to CTREMagEncoderRelative without unit-scaling.

You can still init the selected sensor (quadrature) position with the PulseWidthPosition to benefit from the magnetic absolute position.
Reply With Quote
  #7   Spotlight this post!  
Unread Yesterday, 09:35
Oblarg Oblarg is online now
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,133
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: CANTalon getEncVel update rate

Quote:
Originally Posted by ozrien View Post
Just select Quadrature, its equivalent to CTREMagEncoderRelative without unit-scaling.

You can still init the selected sensor (quadrature) position with the PulseWidthPosition to benefit from the magnetic absolute position.
Oh, cool. We'll implement this right away, thanks!
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
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 16:10.

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