Go to Post (OK, now that I have said this, just watch someone like Kevin Watson have a working solution by this Friday... :yikes: ) - dlavery [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 05-02-2013, 17:08
BPtigers BPtigers is offline
Registered User
FRC #4663 (i8sumpi)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Minnesota
Posts: 25
BPtigers is an unknown quantity at this point
How to program a limit switch?

Right now my team is making a tower with a hook system that goes up and down. As of now I have the tower programmed so I can control the speed the thing goes up using the axis 3 whiling holding a button, and the same for the thing to come down. Right now we have two limit switchs hooked up to the hook thing so when the object hits the limit switch the motor Should stop in that direction. How can I program a limit switch to do that? I don't know how to program a limit switch at all. Below I have a picture of my code for the motor going down without a switch, so how do I make that work until I hit the bottom limit switch thanks a ton. Visuals are awesome. Thanks
Attached Thumbnails
Click image for larger version

Name:	motor up.PNG
Views:	90
Size:	15.6 KB
ID:	13815  
__________________
Ben
Reply With Quote
  #2   Spotlight this post!  
Unread 05-02-2013, 20:16
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: How to program a limit switch?

I've attached screenshots of how our team used limit switches to limit movement in 2011. The first screenshot shows how we initialized our limit switches, and the second shows how we implemented them in our Teleop code.

The VI with the arrow and question mark in the second screenshot is In Range And Coerce, which is a VI many people don't know about - primarily the Coerce part. It takes whatever number you input (in this case, our motor signal) and forces it inside a specified range if it falls outside the limits.

In our code, if the upper limit switch is pressed, it sets the upper end of the range to 0 so we can't move up any farther. (So our range is -1 to 0.) Likewise, if the lower switch is pressed, we set the lower end to 0 (range: 0 to 1).
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	79
Size:	5.2 KB
ID:	13821  Click image for larger version

Name:	Capture1.PNG
Views:	95
Size:	5.8 KB
ID:	13822  
Reply With Quote
  #3   Spotlight this post!  
Unread 05-02-2013, 23:22
BPtigers BPtigers is offline
Registered User
FRC #4663 (i8sumpi)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Minnesota
Posts: 25
BPtigers is an unknown quantity at this point
Re: How to program a limit switch?

So what should I add, another case structure or what to make it do what I want right now when the button isn't hit, but stop it when the button is on the limit switch?
__________________
Ben
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2013, 19:35
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: How to program a limit switch?

I'm not sure I understand what you're trying to do...are you trying to control your tower height with a joystick, or with a button? I'm not sure what your control scheme is, so I'm not sure how you need to code your limit switches.
Reply With Quote
  #5   Spotlight this post!  
Unread 07-02-2013, 22:40
BPtigers BPtigers is offline
Registered User
FRC #4663 (i8sumpi)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Minnesota
Posts: 25
BPtigers is an unknown quantity at this point
Re: How to program a limit switch?

So should this code work, for an upper limit and a lower limit, but what should I put in the case structure for default then? Thanks a ton everyone.
Attached Thumbnails
Click image for larger version

Name:	default case.JPG
Views:	55
Size:	45.2 KB
ID:	13844  Click image for larger version

Name:	up complete case.JPG
Views:	41
Size:	47.8 KB
ID:	13845  
__________________
Ben
Reply With Quote
  #6   Spotlight this post!  
Unread 08-02-2013, 07:02
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: How to program a limit switch?

That depends. Why is the code conditionally reading the joystick? What is the down/default thing that is determining the joystick shouldn't be read?

If you are in the condition where the joystick isn't controlling the mechanism, what is? That has to produce the number to drive the motor.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2013, 17:10
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: How to program a limit switch?

First off, I don't really see how you could ever get a value of less than 0 when you modify the throttle input like that. If I'm understanding correctly, the code you wrote would scale the throttle value from 0 to 1.

Regardless, though, I would use another Select to choose your output rather than a case structure. I've attached a screenshot explaining (very roughly) how I would structure this.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	54
Size:	4.5 KB
ID:	13860  
Reply With Quote
  #8   Spotlight this post!  
Unread 09-02-2013, 19:37
BPtigers BPtigers is offline
Registered User
FRC #4663 (i8sumpi)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Minnesota
Posts: 25
BPtigers is an unknown quantity at this point
Re: How to program a limit switch?

Right now my motor doesn't even move up or down. The jaguar light is a solid green when the code is enabled, but when I click and hold the up button or down button and push forward the throttle the green light doesn't change at all it appears like the motor is at 0 constantly, so I don't know if the pwn is bad or not or how can I tell just by looking at it? My big question is assuming the code is right, it has to be the wiring, and assuming that the jaguar is wired right it has to be the limit switch wiring. My coach says that if we leave the limit switches unhooked altogether the limit should be false by default, because there is no limit switch plugged in. Is that true when a limit switch isn't plugged in it's naturally false in the code, or since the limit switch isn't plugged in the labview reads it as true, because my motor isn't moving and the only reason I see is since the limit switch isn't plugged in it's screwing it up? Also how is a limit switch suppose to be hooked in if we want it normally open. Thanks for all the help or if you do see an error in my coding let me know thanks. picture with the limit switches doesn't work, but the picture without the limit switches in it works just fine so I don't know where the problem is if it's in the coding.
Attached Thumbnails
Click image for larger version

Name:	limit com.JPG
Views:	19
Size:	57.6 KB
ID:	13901  Click image for larger version

Name:	good example.JPG
Views:	12
Size:	44.0 KB
ID:	13902  
__________________
Ben
Reply With Quote
  #9   Spotlight this post!  
Unread 09-02-2013, 20:37
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: How to program a limit switch?

I'd look for a document on the Jaguar, but I believe that an open switch on the Jaguar prevents movement in that direction. Put jumpers on the Jag limit connectors and try again.

Greg McKaskle
Reply With Quote
  #10   Spotlight this post!  
Unread 09-02-2013, 22:11
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: How to program a limit switch?

Yea, limit switches wired into the Jaguar directly must be Normally Closed.
The Jag only goes in that direction if the pins are shorted.
An open circuit prevents movement.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #11   Spotlight this post!  
Unread 09-02-2013, 23:37
BPtigers BPtigers is offline
Registered User
FRC #4663 (i8sumpi)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Minnesota
Posts: 25
BPtigers is an unknown quantity at this point
Re: How to program a limit switch?

I have my limit switches plugged into the DIO... But if I were to hook them up to the jaguar directly do I need to code anything for them or does the jaguar do it all automatically? Thanks
__________________
Ben
Reply With Quote
  #12   Spotlight this post!  
Unread 09-02-2013, 23:43
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
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 a limit switch?

Quote:
Originally Posted by BPtigers View Post
I have my limit switches plugged into the DIO... But if I were to hook them up to the jaguar directly do I need to code anything for them or does the jaguar do it all automatically? Thanks
automatically.


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 22:49.

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