Go to Post CAD or it didn't happen - R3P0 [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 06-02-2013, 08:42
jalmos jalmos is offline
Registered User
FRC #4166
 
Join Date: Jan 2012
Location: Mora
Posts: 79
jalmos is an unknown quantity at this point
Using Timers in Labview

We are a second year rookie team with alot of learning to do in labview.
We are trying to create a timer using Labview with no success
Here is what is needed.

With the touch of one button.....
We want to activate a pneumatic cylinder up and down. Then right afterward we want a PG motor with a jaguar to turn on and off in a short period automatically.

This is to load our shooter with a cylinder, then reload the cylinder from a hopper with a pg motor.

Would anyone out be willing to send us some sample Labview code to make this work. We understand we will need to test the actual timing of this, but getting a look at some sample code would be greatly helpful.

Thanks so much for being such a great resource for a rookie team

jalmos
Reply With Quote
  #2   Spotlight this post!  
Unread 06-02-2013, 09:02
kgzak's Avatar
kgzak kgzak is offline
Registered User
AKA: Kris
FRC #4392 (Decievers) FRC #2075 (Enigma)
Team Role: College Student
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Grand Rapids, Michigan
Posts: 418
kgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to beholdkgzak is a splendid one to behold
Re: Using Timers in Labview

When I have access to LabView then I'll post what I have.
Reply With Quote
  #3   Spotlight this post!  
Unread 06-02-2013, 09:07
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,797
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: Using Timers in Labview

Here's a rather busy example of doing a sequence like you describe.
A sequence like this goes in the Periodic Tasks.vi due to the delays involved.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #4   Spotlight this post!  
Unread 06-02-2013, 09:15
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Using Timers in Labview

The right way to do this in LabVIEW is with a state machine.

A state machine basically works like this:
-You store the state of the machine as an integer number or enum
-Every loop, you run code conditionally based on the current state, and evaluate if you should change to another state
--If you decide to change, then you set the new number or enum of the state
--If you don't want to change, then you set the same number as the currents tate
-We will also keep a loop counter which we will use to decide to transition.

In LV, you would implement this as a shift register or feedback node, integer number, and case structure. The number has to be integer, not float, with a blue wire.

You would then define each state, and assign it a number. Alternatively, you can use an enum, and define each state both a number and a name. The result is the same, since an enum can act like a number when you want it to. It looks like your states are:
-idle
-fire_open
-fire_close
-reload_wait
-reload_run
and they always run in that order.

I would then create a feedback node or shift register for a loop counter, and case structure with a panel for each of the 5 states.

Most of the cases will look similar, and basically do this:
-Add 1 to the loop counter
-Check if the loop counter is >= a threshold
--If yes, increment the state number and set the loop counter to zero
--Else leave the state number and loop counter the same.
-For the highest state, you will have to set state to 0 instead of increment it
-For the idle state, you will not use a timer, but the push of a button to increment the state number and reset the loop counter.

What's cool about state machines is you can modify the code in each state to create fairly complex transitions between any states, just by setting the state number correctly.


I'll post a VI of it later. This can go anywhere in the code without blocking, and can be interrupted by overriding the state (the flat sequence can't easily be interrupted).
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
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 23:57.

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