Go to Post FIRST may very well be the healthiest drug on the market. - Herodotus [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 Rating: Thread Rating: 2 votes, 4.50 average. Display Modes
  #1   Spotlight this post!  
Unread 28-01-2015, 09:15
nickb705's Avatar
nickb705 nickb705 is offline
Registered User
AKA: Nick
FRC #3701 (Royal Robotics)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2011
Location: Gastonia
Posts: 10
nickb705 is an unknown quantity at this point
Two limit switches, one button

Hey guys, this is my second year programming and have never programmed limit switches before. I know that there are a few other limit switch questions, but I want to use two switches (A top and bottom) and one button to control our lift motor. I was wondering if anyone could provide me with an example of how I could do this or if it is even possible. Anything is highly appreciated! Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 28-01-2015, 09:51
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,862
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: Two limit switches, one button

You could use a state machine (in Teleop or Periodic Tasks) or a sequence (in Periodic Tasks only).
- push button
- run up until limit switch is hit and stop
- push same button (or a different one)
- run down until limit switch is hit and stop

If one button, then use a feedback node or shift registers to remember the previous direction.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2015, 09:25
nickb705's Avatar
nickb705 nickb705 is offline
Registered User
AKA: Nick
FRC #3701 (Royal Robotics)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2011
Location: Gastonia
Posts: 10
nickb705 is an unknown quantity at this point
Re: Two limit switches, one button

How can I do this with one motor? Whenever i try to connect them both, the wire breaks. I have tried using a "or" boolean but with no luck.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2015, 10:01
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,113
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: Two limit switches, one button

Do you want to control a motor using only one joystick button?

Tell us a story. Pretend that the program and wiring are done, and describe for us what the person at the controls does and what the robot does in response. Use phrases like "presses the button for a half second then releases it" and "lift starts moving up and doesn't stop until the top limit switch is activated." Make sure you cover every case that you want to handle. Then add some cases that you don't expect but might still happen, like "holds the button down even after the lift has reached the bottom" or "presses the button again while the lift is already moving upward".

Once we know what you want the robot to do in response to the operator's actions, we can show you how to create code that will do it.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2015, 10:14
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,862
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: Two limit switches, one button

How would you feel about using different buttons for up and for down?
I worry that with a single button you won't be able to control the direction the elevator is moving in, especially if a limit switch shifts or breaks.
Do you have a mechanical brake to prevent the elevator from dropping without power when loaded with a tote (or not)?

-hold the up button and it rises until the button is released or the limit switch is contacted.

-hold the down button and it drops until the button is released or the limit switch is contacted.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 02-02-2015 at 10:18.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2015, 12:59
nickb705's Avatar
nickb705 nickb705 is offline
Registered User
AKA: Nick
FRC #3701 (Royal Robotics)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2011
Location: Gastonia
Posts: 10
nickb705 is an unknown quantity at this point
Re: Two limit switches, one button

We would be fine to use two buttons. We would like to push a button and have the motor move up and half speed and stop when the limit switch is hit, then hitting the same button (or another) and having the motor go down until the bottom limit switch is hit, and never stopping in the middle. I hope that clears up what we would like to!
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2015, 14:08
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,113
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: Two limit switches, one button

The "never stopping in the middle" can be a problem if one of your limit switches doesn't work properly. You might want to rethink your decision to let the lift keep running after the button is released.

How much other stuff is the operator going to need to do while the lift is in transit? Would it be too much trouble for him or her to be required to keep the button pressed in order for the lift to keep moving? That would make the lift a lot less likely to destroy itself if something failed.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-02-2015, 20:47
nickb705's Avatar
nickb705 nickb705 is offline
Registered User
AKA: Nick
FRC #3701 (Royal Robotics)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2011
Location: Gastonia
Posts: 10
nickb705 is an unknown quantity at this point
Re: Two limit switches, one button

After talking to my mentor, I had miss understood the intent of the limit switch, we DO want to want to have the motor run as long as the button is held, or the limit switch is hit, whichever comes first. I have figured out how to run the motor (up with button 1 and down with button 2) I could just use some help figuring out how to incorporate the two limit switches to turn the motor off. Any example would be highly appreciated!
Reply With Quote
  #9   Spotlight this post!  
Unread 02-02-2015, 20:59
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,085
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Two limit switches, one button

Quote:
Originally Posted by nickb705 View Post
After talking to my mentor, I had miss understood the intent of the limit switch, we DO want to want to have the motor run as long as the button is held, or the limit switch is hit, whichever comes first. I have figured out how to run the motor (up with button 1 and down with button 2) I could just use some help figuring out how to incorporate the two limit switches to turn the motor off. Any example would be highly appreciated!
There are 6 possible states for a button and 2 limit switches that can't be true at the same time. What do you want the motor to do for each of them?
  • Button not pressed, Switch 1 false, Switch 2 false
  • Button pressed, Switch 1 false, Switch 2 false
  • Button not pressed, Switch 1 true, Switch 2 false
  • Button pressed, Switch 1 true, Switch 2 false
  • Button not pressed, Switch 1 false, Switch 2 true
  • Button pressed, Switch 1 false, Switch 2 true
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #10   Spotlight this post!  
Unread 02-02-2015, 21:17
nickb705's Avatar
nickb705 nickb705 is offline
Registered User
AKA: Nick
FRC #3701 (Royal Robotics)
Team Role: Programmer
 
Join Date: Feb 2013
Rookie Year: 2011
Location: Gastonia
Posts: 10
nickb705 is an unknown quantity at this point
Re: Two limit switches, one button

To tell you the truth, I'm not sure. We want the limit switches as a safety to stop the motor from from hitting the sprockets. I'm not sure what needs to be true and what needs to be false. I hope that helps?
Reply With Quote
  #11   Spotlight this post!  
Unread 02-02-2015, 21:29
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,862
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: Two limit switches, one button

I suggest that when you test this you do it at some minimal power, e.g., .4, and hold each limit switch down at the start to verify that the switch matches the button direction.

The limit switch can be wired either Normal-Closed or Normally-Open and the boolean generated might be reversed from what you expect, i.e., it may be True when you expected False.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 02-02-2015 at 21:31.
Reply With Quote
  #12   Spotlight this post!  
Unread 02-02-2015, 21:17
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,113
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: Two limit switches, one button

Quote:
Originally Posted by nickb705 View Post
After talking to my mentor, I had miss understood the intent of the limit switch, we DO want to want to have the motor run as long as the button is held, or the limit switch is hit, whichever comes first. I have figured out how to run the motor (up with button 1 and down with button 2) I could just use some help figuring out how to incorporate the two limit switches to turn the motor off. Any example would be highly appreciated!
Here's a strong hint: use a boolean AND function to combine the "up" button value with the "top" limit switch value, so that the result is true only when the button is pressed and the limit switch is not activated. Do the same thing with the "down" button and "bottom" switch.

Now you have two boolean values, one saying "move up" and the other saying "move down". If you can't figure out how to use those values to control your lift motor, ask for more help.
Reply With Quote
  #13   Spotlight this post!  
Unread 02-02-2015, 22:30
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: Two limit switches, one button

Quote:
Originally Posted by Alan Anderson View Post
Here's a strong hint: use a boolean AND function to combine the "up" button value with the "top" limit switch value, so that the result is true only when the button is pressed and the limit switch is not activated. Do the same thing with the "down" button and "bottom" switch.

Now you have two boolean values, one saying "move up" and the other saying "move down". If you can't figure out how to use those values to control your lift motor, ask for more help.
So when the mechanical system overshoots due to lag in the control system, and the limit switch releases, up becomes a valid command again?

We are scraping for documentation on the new Switch VI's. Are these implemented using the FPGA hardware, so it is sampling quick enough that any mostly full range edge is caught? Does the counter reset on system reset? Can we reset the counter? Any debouncing built in?

Inquiring minds,
Tim
__________________
Software Mentor
3853 Pridetronics[

Reply With Quote
  #14   Spotlight this post!  
Unread 03-02-2015, 07:15
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,753
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: Two limit switches, one button

The limit switch is a simple wrapper over the DIO functions that were already available. They were added primarily for simulation. In order for a simulated robot to be able to identify how a digital line should toggle when something moves, it is useful to identify the switch, tell the physics engine where it is, how it is wired, etc. This is also true of the potentiometer. It is a simple wrapper over AI.

So the FPGA is doing the low level read and filter of the switch, but it is the RT side that is responsible for modifying a motor or other actuator in response. There is no new way to "tie things together" in the FPGA.

Greg McKaskle
Reply With Quote
  #15   Spotlight this post!  
Unread 03-02-2015, 22:16
tcjinaz tcjinaz is offline
Tim
FRC #3853
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2011
Location: Arizona
Posts: 206
tcjinaz has a spectacular aura abouttcjinaz has a spectacular aura about
Re: Two limit switches, one button

Quote:
Originally Posted by Greg McKaskle View Post
The limit switch is a simple wrapper over the DIO functions that were already available. They were added primarily for simulation. In order for a simulated robot to be able to identify how a digital line should toggle when something moves, it is useful to identify the switch, tell the physics engine where it is, how it is wired, etc. This is also true of the potentiometer. It is a simple wrapper over AI.

So the FPGA is doing the low level read and filter of the switch, but it is the RT side that is responsible for modifying a motor or other actuator in response. There is no new way to "tie things together" in the FPGA.

Greg McKaskle
Thanks. More "I needed to know that"
__________________
Software Mentor
3853 Pridetronics[

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 13:25.

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