Go to Post It's a process of elimination led by inspiration. - JaneYoung [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 24-02-2013, 13:56
ArzaanK ArzaanK is offline
Registered User
FRC #1325 (Inverse Paradox)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Mississauga, Ontario, Canada
Posts: 40
ArzaanK is an unknown quantity at this point
Shooter Motors to run continuously.

I am a relatively new programmer on Team 1325, and one of my tasks is to write the code for our shooter. Currently in my code, when a button is pressed, the motors of the shooter turn on, at the speed of the axis of the joystick, and when the button is released, the motors stop. This works, but I would like to have some code that does the following;

When a button is pressed, the motors start, and the motors continue to run even if that button is released.

When another button is pressed stop the motors of the shooter.

I thought about using a while loop earlier to accomplish this but I read somewhere that while loops should not be used in the TeleOp section of the code. I also know that a feedback node could be used to accomplish what I want to do, but I am not sure where to start.

Any help would be greatly appreciated.

Here is the code that I currently have:
Reply With Quote
  #2   Spotlight this post!  
Unread 24-02-2013, 14:17
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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,731
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: Shooter Motors to run continuously.

There are a couple of ways to do this.

One way is to simply have
  • one button control a Case statement that sets the motor output in True to 1, but does absolutely nothing in the False case.
  • A second button do the same thing, but set the motor output to zero, but also does absolutely nothing in the False case.
  • You can tied the two case statements together to force an order in the event both buttons are pushed simultaneously, but it isn't necessary in this particular application
A second cleaner way is to use a feedback node to remember the previous value and only change the value when one of the buttons is pushed.
I'll sketch an example up. This fits into your existing scheme the easiest.
Attached Thumbnails
Click image for larger version

Name:	TwoButtonOnOff.png
Views:	48
Size:	21.5 KB
ID:	14158  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 24-02-2013 at 14:39.
Reply With Quote
  #3   Spotlight this post!  
Unread 24-02-2013, 14:24
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,748
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: Shooter Motors to run continuously.

As an aside, there really isn't any need to use the inplace element structure. It is pretty advanced stuff.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 24-02-2013, 14:24
chriz4gx chriz4gx is offline
Registered User
AKA: Christopher Villar
FRC #2871 (Beantown Botz)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Boston,MA
Posts: 45
chriz4gx is an unknown quantity at this point
Re: Shooter Motors to run continuously.

So you want to try something like this.
When you click the button you program it will turn on the motor. After you release the button it will continue running. After you click the same button again it will shut off the motor. Remember to place your the "Motor Get" and "Set Output". Then just create a Constant depending how fast you want the motor to move when the button is clicked and in the false case you want to create a constant of 0.
Reply With Quote
  #5   Spotlight this post!  
Unread 24-02-2013, 14:44
ArzaanK ArzaanK is offline
Registered User
FRC #1325 (Inverse Paradox)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Mississauga, Ontario, Canada
Posts: 40
ArzaanK is an unknown quantity at this point
Re: Shooter Motors to run continuously.

Thanks for the prompt responses. I'll try out some of these examples when I get access to the robot tomorrow.
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 04:30.

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