Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Difference between setPosition() and setEncPosition() for can talon encoders (http://www.chiefdelphi.com/forums/showthread.php?t=144533)

TheMechanic40 02-23-2016 03:19 PM

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!

Arhowk 02-23-2016 03:29 PM

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

TheMechanic40 02-23-2016 03:46 PM

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?

Ether 02-23-2016 03:47 PM

Re: Difference between setPosition() and setEncPosition() for can talon encoders
 
Where did you get "setEncPosition()" from?

TheMechanic40 02-23-2016 03:56 PM

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().

TheMechanic40 02-23-2016 04:05 PM

Re: Difference between setPosition() and setEncPosition() for can talon encoders
 
Quote:

Originally Posted by Ether (Post 1545254)
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.

ozrien 02-23-2016 05:43 PM

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.

TheMechanic40 02-23-2016 05:52 PM

Re: Difference between setPosition() and setEncPosition() for can talon encoders
 
Quote:

Originally Posted by ozrien (Post 1545340)
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.

Arhowk 02-23-2016 08:44 PM

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

Ether 02-23-2016 09:20 PM

Re: Difference between setPosition() and setEncPosition() for can talon encoders
 
Quote:

Originally Posted by ozrien (Post 1545340)
setEncPosition... See section 16.9 for more info.

of what document?



Arhowk 02-23-2016 11:21 PM

Re: Difference between setPosition() and setEncPosition() for can talon encoders
 
Quote:

Originally Posted by Ether (Post 1545513)
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).

Ether 02-23-2016 11:32 PM

Re: Difference between setPosition() and setEncPosition() for can talon encoders
 
Quote:

Originally Posted by ozrien (Post 1545340)
setEncPosition... See section 16.9 for more info.

Quote:

Originally Posted by Ether (Post 1545513)
of what document?

Quote:

Originally Posted by Arhowk (Post 1545629)
The document that I posted

Please post a screenshot showing "setEncPosition" anywhere in that document.




All times are GMT -5. The time now is 08:01 AM.

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