Go to Post Still waiting for the "GDC Member" position to open up. Got my resume all set for that one. - Tetraman [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 02-17-2016, 08:34 AM
JakeTheGreat JakeTheGreat is offline
Registered User
FRC #2876
 
Join Date: Feb 2016
Location: Burlington, MA
Posts: 4
JakeTheGreat is an unknown quantity at this point
Using Limit Switches plugged into TalonSRX

My team has plugged a limit switch into the data port on a TalonSRX and I can't find out how to get its value. Is there a method in CANTalon or something that we can use? Thank you.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-17-2016, 09:25 AM
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 102
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: Using Limit Switches plugged into TalonSRX

Yes, there are methods to enable the limit switches and to read them back. They are particularly useful when you want to make sure the motor stops when the switch is hit.

Here's a sample blurb of connecting them:

Code:
// Construct instance
CANTalon lift = new CANTalon(12);

// Make available in "Test" mode
LiveWindow.addActuator("Lift", "Motor", lift);

// Enable hardware limit switch at both ends of lift so lift stops
// Make sure you connect them correctly!
lift.enableLimitSwitch(true, true);
There are two limit switch connections (one for stopping the motors from driving forward and one for stopping them from driving in reverse). It is important to connect them correctly in order to get the hardware feature working properly.

Here's a sample of checking in software if the switch has been hit

Code:
boolean atTop = lift.isFwdLimitSwitchClosed();
boolean atBottom = lift.isRevLimitSwitchClosed();
There are a bunch of methods available on the CANTalon speed controllers (they have many more features than most of the other speed controllers).

You should be able to find the javadoc for them on your system (comes with the WPIlib plugins). Look for the javadoc under (change YOUR_LOGIN_ID to the login you use on Windows):

file:///C:/Users/YOUR_LOGIN_ID/wpilib/java/current/javadoc/index.html

Beware of the "soft limit" functions. I'm not sure of the practical use, but we had some of the programmers set or enable both of the "soft limit" switches. This seemed to stick and prevented the CANTalon from working with other code that was not using the "soft limit" functions. Some of our team thought the CANTalon had gone bad and physically replaced them. We were lucky and pulled them from the trash and then discovered that the soft limits had been enabled on the ones mistaken for bad.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-17-2016, 09:25 AM
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 232
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Using Limit Switches plugged into TalonSRX

Quote:
Originally Posted by JakeTheGreat View Post
My team has plugged a limit switch into the data port on a TalonSRX and I can't find out how to get its value. Is there a method in CANTalon or something that we can use? Thank you.
If it's forward limit switch it should be
Code:
motor.isFwdLimitSwitchClosed()
for the reverse limit switch it should be
Code:
motor.isRevLimitSwitchClosed()
P.S Nice username
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #4   Spotlight this post!  
Unread 02-17-2016, 05:42 PM
JakeTheGreat JakeTheGreat is offline
Registered User
FRC #2876
 
Join Date: Feb 2016
Location: Burlington, MA
Posts: 4
JakeTheGreat is an unknown quantity at this point
Re: Using Limit Switches plugged into TalonSRX

Thank you guys, this helped us greatly!
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 08:07 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