View Single Post
  #1   Spotlight this post!  
Unread 26-01-2015, 15:54
TimTheGreat's Avatar
TimTheGreat TimTheGreat is online now
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 236
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Programming US Digital Encoder

So I am trying to get a motor to go to a certain position using the encoder provided by US Digital, and am having trouble.

Code:
self.talon = wpilib.CANTalon(15)
        self.talon.changeControlMode(CANTalon.ControlMode.Position)
        self.talon.setFeedbackDevice(CANTalon.FeedbackDevice.EncFalling) #Not sure if the encode is EncFalling or Quad
        self.talon.reverseSensor(True)
        self.talon.setP(1)
        self.talon.setPosition(0)
and in OperatorControl

Code:
  self.talon.set(270)
But when I enable the DS, the motor just keeps spinning, and the value goes past 270.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP