View Single Post
  #3   Spotlight this post!  
Unread 17-01-2017, 08:55
cybersader13 cybersader13 is offline
Registered User
FRC #5976
 
Join Date: Jan 2017
Location: Waukesha, WI
Posts: 4
cybersader13 is an unknown quantity at this point
Re: CANTalon w/Encoder DriveStraight Command example

Thank you. Yep, the logic in the isFinished() looks odd because of the way the Talon was wired. Setting a positive setpoint was generating negative counts, so we compensated for that in the code.

We have got a simple command working and will post a cleaned up example of what we did tonight in case it helps others in the future.

One thing that I don't entirely have my head wrapped around yet is the units used for some of the configuration.

For example, with a 360 cycles/rev quad encoder, are we supposed to use
Code:
talon.configEncoderCodesPerRev(360)
or
Code:
talon.configEncoderCodesPerRev(360 * 4)
We have things working with the former.

Then there is also this
Code:
driveTrain.talon.set(numberOfRevs)
which if we're right is in terms of revolutions (though javadoc says "In Position mode, outputValue is in encoder ticks..."?) and this
Code:
talon.setAllowableClosedLoopErr(allowableError)
which is in terms of cycles (1/360 or 1/(360 *4))? Will nail that down when able to test a bit more.

Again, thanks!
Reply With Quote