Go to Post Our robot weighed 168lbs..... bring it on Trimspa!!! - slickguy2007 [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 06-11-2014, 19:04
nickphowell nickphowell is offline
Registered User
FRC #4824
 
Join Date: Nov 2014
Location: Logansport, IN
Posts: 4
nickphowell is an unknown quantity at this point
Limit Switch Help

Our programming team is having some issues with setting up two limit switches. After button 4 is pressed, our first limit switch, Limit Switch, is supposed to stop our motors. After button 5 is pressed, the second limit switch, Limit Switch 2, is supposed to stop the motors once again.

When we run the code, the upper portion works properly (see picture), but our motors seem to fight each other.

Any help or input would be welcomed, and we are open to try everything.
Thank you

Reply With Quote
  #2   Spotlight this post!  
Unread 06-11-2014, 19:05
nickphowell nickphowell is offline
Registered User
FRC #4824
 
Join Date: Nov 2014
Location: Logansport, IN
Posts: 4
nickphowell is an unknown quantity at this point
Re: Limit Switch Help

In case the picture did not show, the link is here:
http://imgur.com/EvqRgHi
Reply With Quote
  #3   Spotlight this post!  
Unread 06-11-2014, 19:35
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: Limit Switch Help

  1. You really don't want to be addressing one motor from two conflicting places at the same time. That's why they fight each other. Are you also setting the same motors in both False cases? That would be telling it to go and stop at the same time.
  2. You need a Wait (say 10ms) in your loops otherwise you threaten to overload and lock up your CPU.
Instead, make all your decisions about what you want the motor to do, then set the motor only once.
Here's an example for a Relay. Just replace the Relay with your motor in the sequence you want.
Since you are keying off two different limit switches you can also select and pass in the corresponding limit switch name or reference.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 06-11-2014 at 19:42.
Reply With Quote
  #4   Spotlight this post!  
Unread 15-11-2014, 12:40
nickphowell nickphowell is offline
Registered User
FRC #4824
 
Join Date: Nov 2014
Location: Logansport, IN
Posts: 4
nickphowell is an unknown quantity at this point
Re: Limit Switch Help

Quote:
Originally Posted by Mark McLeod View Post
  1. You really don't want to be addressing one motor from two conflicting places at the same time. That's why they fight each other. Are you also setting the same motors in both False cases? That would be telling it to go and stop at the same time.
  2. You need a Wait (say 10ms) in your loops otherwise you threaten to overload and lock up your CPU.
Instead, make all your decisions about what you want the motor to do, then set the motor only once.
Here's an example for a Relay. Just replace the Relay with your motor in the sequence you want.
Since you are keying off two different limit switches you can also select and pass in the corresponding limit switch name or reference.
How do you wire and use a relay? We are a brand new programming team, so we do not know everything there is to know......yet.

We went ahead and tried a new chunk of code, and that is not working either. However, it worked better than previously. What went wrong is our "Up" case would not work properly. The motors would not work when this case was triggered, but the "Default" and the "Down" cases worked perfectly. The "Default" case just sets the motor output to 0.

Here are pictures of what the code looks like right now.
http://imgur.com/yLUmJ8J
http://imgur.com/f80i1KW
Reply With Quote
  #5   Spotlight this post!  
Unread 15-11-2014, 16:49
nickphowell nickphowell is offline
Registered User
FRC #4824
 
Join Date: Nov 2014
Location: Logansport, IN
Posts: 4
nickphowell is an unknown quantity at this point
Re: Limit Switch Help

Alright, so we have figured out our problem. Thank you all for the help
Reply With Quote
  #6   Spotlight this post!  
Unread 19-11-2014, 06:30
Iaquinto.Joe's Avatar
Iaquinto.Joe Iaquinto.Joe is offline
RPI 2018
AKA: Joe Iaquinto
FRC #0308 (The Monsters)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2011
Location: United States
Posts: 166
Iaquinto.Joe is a jewel in the roughIaquinto.Joe is a jewel in the roughIaquinto.Joe is a jewel in the rough
Re: Limit Switch Help

An additional tip:

Every time you call the reference VI, it will get a joystick reference twice. It's better practice to make a habit to only get references once if you can manage it. It will marginally make you code faster and increase readability.
__________________
4 year 2011 - 2014 FRC team 308 member, Lead Programmer - C++ / LabVIEW

3 year 2011, 2013, 2014 OCCRA member, Co-Captain OCCRA team 308
  • OCCRA Engineering Excellence - Waterford Kettering 2013
  • Innovation in Control - 2011
  • Quality award- Northville 2012
  • Engineering Excellence- Howell 2014
  • Innovation in Controls- Livonia 2014
Reply With Quote
  #7   Spotlight this post!  
Unread 19-11-2014, 07:10
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: Limit Switch Help

Quote:
An additional tip:
In other words, if the code will return the same value as you already have, you can just wire the value to two or more places.

Greg McKaskle
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 20:10.

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