Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   How to program Talon SRX Encoders? (http://www.chiefdelphi.com/forums/showthread.php?t=145438)

GoldenGollem 08-03-2016 20:59

How to program Talon SRX Encoders?
 
1 Attachment(s)
I am new with java with no mentor to teach me. I am trying to get an encoder to relay data and to be able to program one. When I try to use the FRC tutorials I end up with errors and have trouble figuring out the issue. If you can help that would be great. I will insert the code below. Thanks

BenBernard 08-03-2016 21:48

Re: How to program Talon SRX Encoders?
 
I assume the error you are getting is when you call enc.start(), since you are never initializing the enc variable. You declare it up top at:
Code:

       
Encoder enc;

You also need to initialize it, similarly to how you have initialized your Talon and CANTalon variables.

sagrossm 09-03-2016 09:47

Re: How to program Talon SRX Encoders?
 
If you are trying to use an encoder for a motor connected to a talon, you should just be able to receive values from the encoder through the motor object. For instance if you have an encoder on "winch" you should be able to use

winch.getEncPosition() or winch.getEncVelocity()

to get values from the encoder. Also you must use CANTalon and not just Talon to get values from the encoders.

GoldenGollem 09-03-2016 13:27

Re: How to program Talon SRX Encoders?
 
Ok it look right now... but how would I program the motor to only go 'X' amount of rpm.

Ether 09-03-2016 13:38

Re: How to program Talon SRX Encoders?
 
Quote:

Originally Posted by GoldenGollem (Post 1554325)
Ok it look right now... but how would I program the motor to only go 'X' amount of rpm.

Paragraph 10.3 of the Software Reference Manual, available for download at the manufacturer's website.



GoldenGollem 09-03-2016 16:25

Re: How to program Talon SRX Encoders?
 
Thanks Ether for that great refernce but what they show what to do goes against what others and the frc tutorial shows. If I am correct then I would need to define and encoder in my code which the CTR manual doesn't.

Ether 09-03-2016 16:35

Re: How to program Talon SRX Encoders?
 

First let me make sure about some things I am assuming but which you have not explicitly stated.
You are using TalonSRX motor controller, yes?

Your encoder is wired to the TalonSRX (not the roboRIO), yes?

You are using CAN (not PWM) to command the TalonSRX, yes?
If so, refer to paragraph 3.2 in the Software Reference Manual

sagrossm 10-03-2016 07:33

Re: How to program Talon SRX Encoders?
 
I believe you can set the number of counts per revolution if that's what you're looking for. just use

motor.configEncoderCodesPerRev(insert desired counts per rev)

GoldenGollem 10-03-2016 09:51

Re: How to program Talon SRX Encoders?
 
I beileve I have figured it out last night when I was working if not I will be back with questions. Thanks

Ether 10-03-2016 10:58

Re: How to program Talon SRX Encoders?
 
Quote:

Originally Posted by GoldenGollem (Post 1554978)
I beileve I have figured it out last night when I was working if not I will be back with questions. Thanks

In the meantime, would you please answer the questions in my previous post, and also tell us what you figured out.




All times are GMT -5. The time now is 08:25.

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