Go to Post Hey, SHIFT HAPPENS.... - David Kelly [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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-03-2009, 16:18
Wicked Wicked is offline
Registered User
FRC #0354 (G-House Pirates)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: New York
Posts: 46
Wicked is an unknown quantity at this point
Limit Switches

We want to use a limit switch on a motor to keep it from turning past a certain point. Does anyone know how we can program a limit switches. Any help would be appreciated. Thank you in advance.
Reply With Quote
  #2   Spotlight this post!  
Unread 03-03-2009, 16:53
vhcook's Avatar
vhcook vhcook is online now
Reader of Things
AKA: Victoria
FRC #1939 (Kuh-nig-its)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Kansas City, MO
Posts: 546
vhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond repute
Re: Limit Switches

Sure, it's pretty straightforward. First you're going to want to run a PWM cable from the limit switch to a DIO port on your digital sidecar (or decide which port location you're planning to run the cable later).

If you're in the basic framework, you need to put a DIO Open (WPI Library -> IO -> DigitalInput -> DIO IN Open) over on the left where the rest of the opens are. Create constants on the DIO Module and Channel inputs that indicate where you plugged the thing in. Put a DIO Close on the right side of the case statements.

Next, set a DIO In Get in the area of code you want to check (for example, inside the Teleop Execute case of the case statement). Run a wire from the DigitalInputDevRef output of the Open to the same input on the Get so that the code knows which device you're getting the value from. Run a wire from the DigitalInputDevRef output of the Get to the same input on the Close to ensure it exits cleanly.

The "Value" output of the Get is going to be a boolean (true/false) value, that you can run into some logic commands to decide what to do next. For example, you might do a Select (Programming -> Comparison -> Select) that shuts down the motors on True and does what it would have done without the limit switch on False.

We had a couple of the IEC rotary limit switches set up this way using the Normally Closed outputs. That setup returned True when the switch was disconnected from the DIO or when the switch had been triggered. Doing it this way made sure we would fail safe - if the cable was damaged or not plugged in, the motors would not run.

If you're in the advanced framework or you need more help, PM me and I'll be happy to help.
__________________


Reply With Quote
  #3   Spotlight this post!  
Unread 03-03-2009, 17:53
gwytheyrn gwytheyrn is offline
Registered User
AKA: David
FRC #0461 (West Side Boiler Invasion)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2004
Location: Indiana
Posts: 44
gwytheyrn is infamous around these parts
Send a message via AIM to gwytheyrn
Re: Limit Switches

Once you get past the opening and getting of the value of the switch, there's a bit of boolean mess to get it so it will work. Just using a single select won't quite do (unless you use an AND statement to check if the motor is actually trying to go past the limit and not away from it), as it will shut down the motor permanently unless something physically knocks the motor from pressing the switch.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-03-2009, 18:01
ebmonon36's Avatar
ebmonon36 ebmonon36 is offline
Registered User
AKA: Eric Bredehoeft
FRC #1018 (Robodevils)
Team Role: Mentor
 
Join Date: Dec 2002
Rookie Year: 2003
Location: Indianapolis, IN
Posts: 428
ebmonon36 has much to be proud ofebmonon36 has much to be proud ofebmonon36 has much to be proud ofebmonon36 has much to be proud ofebmonon36 has much to be proud ofebmonon36 has much to be proud ofebmonon36 has much to be proud ofebmonon36 has much to be proud ofebmonon36 has much to be proud of
Send a message via AIM to ebmonon36
Re: Limit Switches

I used a case select on an "In Range and Coerce" block where the upper and lower limits are set by case statements controlled by a digital input and the input is the motor speed, assuming the motor is run by a speed controller.

For example, the upper limit would be 1. When the switch is tripped, the upper limit becomes 0, thus preventing the motor from driving in that direction. The lower limit would be -1 until the switch is tripped and the lower limit is set to 0.

Last edited by ebmonon36 : 03-03-2009 at 18:05.
Reply With Quote
  #5   Spotlight this post!  
Unread 04-03-2009, 07:49
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Limit Switches

Quote:
Originally Posted by ebmonon36 View Post
I used a case select on an "In Range and Coerce" block...
I like it.

I would use boolean selectors instead of case blocks. I also suggest turning the whole chunk of limit switch logic into a subVI. It would act just like a regular motor control VI, but with a pair of limit switch inputs added.
Reply With Quote
  #6   Spotlight this post!  
Unread 04-03-2009, 15:43
Wicked Wicked is offline
Registered User
FRC #0354 (G-House Pirates)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: New York
Posts: 46
Wicked is an unknown quantity at this point
Re: Limit Switches

We ran into a little stumbling block. Well, it's pretty much what gwytheyrn described. We tried programming a case structure so that it rotated away from the switch when it recieved a value, but that did absolutely nothing, so we're stuck.
Reply With Quote
  #7   Spotlight this post!  
Unread 04-03-2009, 16:07
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,355
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Limit Switches

Read post # 8 in this thread. I uploaded a vi. that works just fine. You will need to modify the inputs to point to your switches. Also, verify that the ccw and cw limits are correct for your wiring, if not swap the two values.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #8   Spotlight this post!  
Unread 04-03-2009, 16:09
vhcook's Avatar
vhcook vhcook is online now
Reader of Things
AKA: Victoria
FRC #1939 (Kuh-nig-its)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Kansas City, MO
Posts: 546
vhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond repute
Re: Limit Switches

Did you try looking at the values on the relevant wires in debug mode so you could see whether the problem was how you had built your case or the values heading into it?

You can either click the lightbulb to highlight execution all the way through (which will really bog down the CRIO's response time), or you can click on a specific wire or wires with the code running to get a popup with the current value (runs a lot closer to normal speed).
__________________


Reply With Quote
  #9   Spotlight this post!  
Unread 04-03-2009, 17:07
gwytheyrn gwytheyrn is offline
Registered User
AKA: David
FRC #0461 (West Side Boiler Invasion)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2004
Location: Indiana
Posts: 44
gwytheyrn is infamous around these parts
Send a message via AIM to gwytheyrn
Re: Limit Switches

I strongly suggest trying the method in post number 4, as it is quite an elegant way to program for this, imho. Dunno about billbo's post; I don't have labview on this computer, but I guess it works in a similar fashion
Reply With Quote
  #10   Spotlight this post!  
Unread 04-03-2009, 17:21
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,355
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Limit Switches

Quote:
Originally Posted by gwytheyrn View Post
I strongly suggest trying the method in post number 4, as it is quite an elegant way to program for this, imho. Dunno about billbo's post; I don't have labview on this computer, but I guess it works in a similar fashion
From a cursory reading of ebmonon36's post, it sounds exactly like what I posted in the vi. It is simple and quite effective. We used this exact method, except the limit switches were replaced with comparators coming off a pot, to limit the travel of our turret this year.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Limit Switches popnbrown NI LabVIEW 1 10-02-2009 22:39
Limit switches(in C++) beefy1 Programming 3 24-12-2008 15:27
Limit Switches ChrisR_522 Programming 2 25-01-2008 08:04
limit switches stephenthe1 Programming 28 11-05-2005 16:37
Limit switches Team168 Programming 8 10-02-2003 16:22


All times are GMT -5. The time now is 10:36.

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