View Single Post
  #1   Spotlight this post!  
Unread 29-03-2016, 21:43
Jeringo Jeringo is offline
Registered User
FRC #4749
 
Join Date: Jan 2016
Location: Atlanta
Posts: 10
Jeringo is an unknown quantity at this point
TalonSRX encoder confusion java

I am getting a little confused on encoders for the TalonSRX.
i am trying to do three things, first thing is the software limit. How exactly does it work. we have a shooter that tilts the upmost position it -1000 and all the way to the floor is 3500 i've tried swapping the values but it only lets me tilt the shooter down. the second thing is how to i reset the encoder or set it to 0? and the third thing is how to i tell the motor to go to a certain position?


Code:
Tilt.setFeedbackDevice(FeedbackDevice.AnalogEncoder);
Tilt.setForwardSoftLimit(-1000.00);
Tilt.enableForwardSoftLimit(true);
Tilt.setReverseSoftLimit(3501.00);
Tilt.enableReverseSoftLimit(true);

int pulseWidthPos = Tilt.getPulseWidthPosition();
int pulseWidthUs = Tilt.getPulseWidthRiseToFallUs();
int PeriodUs = Tilt.getPulseWidthRiseToRiseUs();
int pulseWidthVel = Tilt.getPulseWidthVelocity();
FeedbackDeviceStatus sensorStatus = Tilt.isSensorPresent(FeedbackDevice.CtreMagEncoder_Absolute);
boolean sensorPluggedIn = (FeedbackDeviceStatus.FeedbackStatusPresent == sensorStatus);