Go to Post STICK WITH WHAT WORKS FOR YOU!!! - Will Hanashiro [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 06-02-2015, 10:05
JackVaughn23 JackVaughn23 is offline
Registered User
FRC #5727
 
Join Date: Feb 2015
Location: North Carolina
Posts: 3
JackVaughn23 is an unknown quantity at this point
CanTalonSRX Encoder Readings

Good morning, this is my first post to this forum so please bear with me. We are using a motor with an encoder on it connected to a CanTalonSRX. I am able to set values for the motor, but I am not able to get any values from the encoder. When I read the manual (CrossTheRoads) for the CanTalonSRX all of the methods that are using in the examples are for a CanTalon and not the CanTalonSRX. I can use the CanTalon methods to "set" items but anything I try to "get" it always returns a value of 0. When I look at the WPILib documentation for Java for CanTalonSRX all of the methods require arguments to be passed to the function that I have no clue what they are. For example,

GetCurrent(SWIGTYPE_p_double param)

I'm not sure what argument the method is wanting.

But on the other hand, the methods for a CANTalon are incredibly simple and most require no arguments and I would really love to use those methods if they would work with the SRX (the CrossTheRoad manual only examples CANTalon methods for use with the SRX).

Any help would be greatly appreciated, I apologize in advance if I left out any details needed.
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2015, 10:14
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 258
Jefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond repute
Re: CanTalonSRX Encoder Readings

Quote:
Originally Posted by JackVaughn23 View Post
Good morning, this is my first post to this forum so please bear with me. We are using a motor with an encoder on it connected to a CanTalonSRX. I am able to set values for the motor, but I am not able to get any values from the encoder. When I read the manual (CrossTheRoads) for the CanTalonSRX all of the methods that are using in the examples are for a CanTalon and not the CanTalonSRX. I can use the CanTalon methods to "set" items but anything I try to "get" it always returns a value of 0. When I look at the WPILib documentation for Java for CanTalonSRX all of the methods require arguments to be passed to the function that I have no clue what they are. For example,

GetCurrent(SWIGTYPE_p_double param)

I'm not sure what argument the method is wanting.

But on the other hand, the methods for a CANTalon are incredibly simple and most require no arguments and I would really love to use those methods if they would work with the SRX (the CrossTheRoad manual only examples CANTalon methods for use with the SRX).

Any help would be greatly appreciated, I apologize in advance if I left out any details needed.
You want to use the CANTalon class. CANTalonSRX is a lower level implementation that is made available, but isn't needed in most cases.

Omar... feel free to jump in here and correct me if the Java implementation is different than C++.
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2015, 10:19
JackVaughn23 JackVaughn23 is offline
Registered User
FRC #5727
 
Join Date: Feb 2015
Location: North Carolina
Posts: 3
JackVaughn23 is an unknown quantity at this point
Re: CanTalonSRX Encoder Readings

Hello Jefferson,

Our team greatly appreciate the quick response. What would cause all of the values to return 0 with CANTalon? The reason we're wanting to use the sensor at all is to hold our elevator in place. Even with the brake enabled it slowly comes down.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2015, 11:00
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 258
Jefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond repute
Re: CanTalonSRX Encoder Readings

Quote:
Originally Posted by JackVaughn23 View Post
Hello Jefferson,

Our team greatly appreciate the quick response. What would cause all of the values to return 0 with CANTalon? The reason we're wanting to use the sensor at all is to hold our elevator in place. Even with the brake enabled it slowly comes down.
The best place to start is the webdash on the roboRio. Find the Talon and do a self test. It'll show a lot of the things you would query through the user code. If you are getting zeros in there, something is wrong with the input to the Talon.
Reply With Quote
  #5   Spotlight this post!  
Unread 07-02-2015, 21:31
ozrien's Avatar
ozrien ozrien is online now
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 531
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: CanTalonSRX Encoder Readings

Yeeup Jefferson is right on all counts.
Use the self-test to see exactly what the Talon is reading. If it's wrong there then usually it's just a wiring-issue. (Section 2.4 in Talon SRX software reference manual).

Please use CANTalon (as suggested in Section 3.2 in Talon SRX software reference manual).

The only mention of CanTalonSRX is for workaround section 21.15, which is a specific C++ that doesn't impact your team.
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 18:08.

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