Go to Post Yes, machining a dog profile into a steel sprocket on a manual mill was an experience filled with pain and regret. - Joe G. [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 29-03-2016, 22:25
GRSICP GRSICP is offline
Greta Rauch
FRC #5822 (WolfByte)
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2010
Location: Chicago
Posts: 18
GRSICP is an unknown quantity at this point
Re: TalonSRX encoder confusion java

I don't know the answer to the questions about the limits as I have not used them yet. However, I can help with getting the Talon to a certain position.

Here is an example of initialization of a Talon:
Code:
armR = new CANTalon(1); 
armR.setFeedbackDevice(FeedbackDevice.QuadEncoder); //Set the feedback device that is hooked up to the talon
armR.setPID(0.2, 0.001, 100, 0.00, 360, 12, 0); //Set the PID constants (p, i, d), you will need to do some tweaking to get these right
Here is the code needed to get the arm to a certain location:
Code:
armR.changeControlMode(TalonControlMode.Position); //Change control mode of talon, default is PercentVbus (-1.0 to 1.0)
armR.set(height); //height is the value you are looking to move to
armR.reverseSensor(true); 
armR.enableControl(); //Enable PID control on the talon
A note on the reverse sensor line: in our case, the reading from the QuadEncoder was negative so we needed to both feed .set a negative value and use the reverseSensor method.

In terms of setting it to 0, here is the code we use:
Code:
talonName.setPosition(0);
I hope this helps!
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:02.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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