Go to Post Pulling off an off season during a hurricane isn't easy. - Arefin Bari [more]
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 23-02-2016, 15:19
TheMechanic40 TheMechanic40 is offline
Registered User
FRC #3506 (YETI Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: North Carolina
Posts: 31
TheMechanic40 is an unknown quantity at this point
Difference between setPosition() and setEncPosition() for can talon encoders

I've noticed that CAN talons have two methods that seem to set encoder positions: setPosition() and setEncPosition(). Does anyone know what the difference is? Neither are working for us and I was wondering if each is to be used in certain situations. Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 23-02-2016, 15:29
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Difference between setPosition() and setEncPosition() for can talon encoders

setPosition (to the best of my knowledge) sets the setpoint of the PID where setEncPosition configures the sensor to be at that value
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
Reply With Quote
  #3   Spotlight this post!  
Unread 23-02-2016, 15:46
TheMechanic40 TheMechanic40 is offline
Registered User
FRC #3506 (YETI Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: North Carolina
Posts: 31
TheMechanic40 is an unknown quantity at this point
Re: Difference between setPosition() and setEncPosition() for can talon encoders

This is the source of my confusion, section 13.3 of the talon srx software manual says that setPosition() sets the sensor position so setPosition(0) would zero the encoder. Does setPosition() only set the encoder value when the talon isn't in PID mode and it sets the setpoint when it is in PID mode, while setEncPosition() sets the sensor position no matter the talon's control mode?
Reply With Quote
  #4   Spotlight this post!  
Unread 23-02-2016, 15:47
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,025
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: Difference between setPosition() and setEncPosition() for can talon encoders

Where did you get "setEncPosition()" from?

Last edited by Ether : 23-02-2016 at 15:58.
Reply With Quote
  #5   Spotlight this post!  
Unread 23-02-2016, 15:56
TheMechanic40 TheMechanic40 is offline
Registered User
FRC #3506 (YETI Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: North Carolina
Posts: 31
TheMechanic40 is an unknown quantity at this point
Re: Difference between setPosition() and setEncPosition() for can talon encoders

Yes, one of the things about it that confuses me is that the software manual says that setPosition(0) will zero a quadrature encoder (which we're using), but when we call that method the value returned from getEncPosition() doesn't change and the manual doesn't even mention setEncPosition(), but it exists, although it also doesn't change the value of getEncPosition().

Last edited by TheMechanic40 : 23-02-2016 at 15:57. Reason: Removed quote
Reply With Quote
  #6   Spotlight this post!  
Unread 23-02-2016, 16:05
TheMechanic40 TheMechanic40 is offline
Registered User
FRC #3506 (YETI Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: North Carolina
Posts: 31
TheMechanic40 is an unknown quantity at this point
Re: Difference between setPosition() and setEncPosition() for can talon encoders

Quote:
Originally Posted by Ether View Post
Where did you get "setEncPosition()" from?
We found setEncPosition() by looking at the suggestions from content assist in eclipse after typing setPos. We tried both setEncPosition(0) and setPosition(0), but neither seemed to work.
Reply With Quote
  #7   Spotlight this post!  
Unread 23-02-2016, 17:43
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: Difference between setPosition() and setEncPosition() for can talon encoders

You must select the sensor type before calling setPosition(). setpos and getpos are for the "selected" sensor.

Also be aware that calling setPosition doesn't instantly clear the return of the next getPosition(), leave at least 20ms or so for the Talon Feedback Status Frame to update the RIO. Then call getPosition(). It does however clear the position in the firmware of the Talon within 100us or so.

setEncPosition/getEncPosition are low level functions for quadrature encoder. They do not update as fast but provide low-level api for getting sensor values from all sensor types at once. See section 16.9 for more info. Similarly there are GetAnalo* functions for analog sensors, and GetPulseWid* funcs for pulse width sensors.
Reply With Quote
  #8   Spotlight this post!  
Unread 23-02-2016, 17:52
TheMechanic40 TheMechanic40 is offline
Registered User
FRC #3506 (YETI Robotics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: North Carolina
Posts: 31
TheMechanic40 is an unknown quantity at this point
Re: Difference between setPosition() and setEncPosition() for can talon encoders

Quote:
Originally Posted by ozrien View Post
You must select the sensor type before calling setPosition(). setpos and getpos are for the "selected" sensor.

Also be aware that calling setPosition doesn't instantly clear the return of the next getPosition(), leave at least 20ms or so for the Talon Feedback Status Frame to update the RIO. Then call getPosition(). It does however clear the position in the firmware of the Talon within 100us or so.

setEncPosition/getEncPosition are low level functions for quadrature encoder. They do not update as fast but provide low-level api for getting sensor values from all sensor types at once. See section 16.9 for more info. Similarly there are GetAnalo* functions for analog sensors, and GetPulseWid* funcs for pulse width sensors.
Ah, thank you for the clarification.
Reply With Quote
  #9   Spotlight this post!  
Unread 23-02-2016, 20:44
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Difference between setPosition() and setEncPosition() for can talon encoders

My bad, I had that confused with the setSetpoint function.

for future reference, this is a great resource https://www.ctr-electronics.com/Talo...e%20Manual.pdf
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
Reply With Quote
  #10   Spotlight this post!  
Unread 23-02-2016, 21:20
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,025
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: Difference between setPosition() and setEncPosition() for can talon encoders

Quote:
Originally Posted by ozrien View Post
setEncPosition... See section 16.9 for more info.
of what document?


Reply With Quote
  #11   Spotlight this post!  
Unread 23-02-2016, 23:21
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Difference between setPosition() and setEncPosition() for can talon encoders

Quote:
Originally Posted by Ether View Post
of what document?


The document that I posted, I assume (though my last assumption in this thread was wrong so who knows. 16.9 in that document refers to "why are there multiple methods of gathering encoder data" so i believe it to be correct).
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
Reply With Quote
  #12   Spotlight this post!  
Unread 23-02-2016, 23:32
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,025
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: Difference between setPosition() and setEncPosition() for can talon encoders

Quote:
Originally Posted by ozrien View Post
setEncPosition... See section 16.9 for more info.
Quote:
Originally Posted by Ether View Post
of what document?
Quote:
Originally Posted by Arhowk View Post
The document that I posted
Please post a screenshot showing "setEncPosition" anywhere in that document.


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 08:29.

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