Go to Post ...several people have told my that my brain has been oxygen-starved since at least 1975. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-08-2016, 08:59 PM
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
Exclamation How to program Talon SRX Encoders?

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
Attached Files
File Type: txt 2016 Code.txt (2.2 KB, 27 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 03-08-2016, 09:48 PM
BenBernard BenBernard is offline
Registered User
FRC #5687 (The Outliers)
Team Role: Mentor
 
Join Date: Jan 2016
Rookie Year: 2015
Location: Portland, ME
Posts: 39
BenBernard is an unknown quantity at this point
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 03-09-2016, 09:47 AM
sagrossm sagrossm is offline
Registered User
AKA: Sam
FRC #5712 (Hemlock's Gray Matter)
Team Role: Mentor
 
Join Date: Feb 2016
Rookie Year: 2016
Location: Hemlock, MI
Posts: 13
sagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to all
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-09-2016, 01:27 PM
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-09-2016, 01:38 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to program Talon SRX Encoders?

Quote:
Originally Posted by GoldenGollem View Post
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.


Reply With Quote
  #6   Spotlight this post!  
Unread 03-09-2016, 04:25 PM
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 03-09-2016, 04:35 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
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
Reply With Quote
  #8   Spotlight this post!  
Unread 03-10-2016, 07:33 AM
sagrossm sagrossm is offline
Registered User
AKA: Sam
FRC #5712 (Hemlock's Gray Matter)
Team Role: Mentor
 
Join Date: Feb 2016
Rookie Year: 2016
Location: Hemlock, MI
Posts: 13
sagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to allsagrossm is a name known to all
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)
Reply With Quote
  #9   Spotlight this post!  
Unread 03-10-2016, 09:51 AM
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
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
Reply With Quote
  #10   Spotlight this post!  
Unread 03-10-2016, 10:58 AM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: How to program Talon SRX Encoders?

Quote:
Originally Posted by GoldenGollem View Post
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.


Reply With Quote
Reply


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 02:29 AM.

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