View Single Post
  #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