|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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
|
|
#2
|
|||
|
|||
|
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; |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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.
|
|
#5
|
||||
|
||||
|
Re: How to program Talon SRX Encoders?
Quote:
|
|
#6
|
||||
|
||||
|
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.
|
|
#7
|
||||
|
||||
|
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?If so, refer to paragraph 3.2 in the Software Reference Manual |
|
#8
|
|||
|
|||
|
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) |
|
#9
|
||||
|
||||
|
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
|
|
#10
|
||||
|
||||
|
Re: How to program Talon SRX Encoders?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|