Go to Post we would all build robots to play "rock-paper-scissors" if FIRST told us to, cause it is just so freakin' much fun to build a robot until 2:30am every night for six weeks! - 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 15-02-2010, 10:08
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Timing functions

We want a motor to spin for two seconds after a button is pressed AND keep spinning (until time is up) even if the joystick button is not being pressed.

Can we use a timing function in the true case to keep the case true (therefor the motor keeps running) even if the button is NOT being pressed? or do we need to take a different approach?

Last edited by grosh : 15-02-2010 at 10:20.
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2010, 10:57
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,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: Timing functions

Once you set a motor to start running it will continue to run until you tell it to turn off.
So, what you can do is use your case True to Set the motor on and set a time to be fed back into the loop using a shift register or feedback node. Then in the False case check to see if the time has expired before stopping the motor.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #3   Spotlight this post!  
Unread 15-02-2010, 11:58
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Re: Timing functions

Mark- Did I do this right?
Attached Thumbnails
Click image for larger version

Name:	motor delay.jpg
Views:	36
Size:	11.7 KB
ID:	8677  Click image for larger version

Name:	motor wait.jpg
Views:	28
Size:	8.3 KB
ID:	8678  
Reply With Quote
  #4   Spotlight this post!  
Unread 15-02-2010, 13:45
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Timing functions

Well in not really.

Just look at the attached code.

Use the SubVI where ever you need to latch and hold a boolean state for a set amount of time.

Note: the Hold and Release subVI triggers on a rising edge. So even if you continue to hold the button on the joystick it will set it's output to FALSE (off) after to set time has passed.

Omar
Attached Files
File Type: zip Hold_and_Release.zip (15.3 KB, 29 views)
__________________
Omar

Last edited by Omar : 15-02-2010 at 13:57.
Reply With Quote
  #5   Spotlight this post!  
Unread 15-02-2010, 13:54
grosh grosh is offline
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
Re: Timing functions

Quote:
Originally Posted by Omar View Post
Well in not really.

Just look at the attached code.

Use the SubVI where ever you need to latch and hold a boolean state for a set amount of time.

Omar
Thanks! It looks like I was way off.

Let me ask you another question. We just created a state machine for another mechanism after watching the LVMastery video. Would it be easier and/or more efficient to make a state machine? Ben Zimmer stated that timed waits can slow down your code.
Reply With Quote
  #6   Spotlight this post!  
Unread 15-02-2010, 14:14
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Timing functions

This can be used with a state machine (or not).

A lot depends on what else is going on in the state or what other parallel loops you have going on. You could have multiple state machines running in parallel.

But you could use the output of the Hold and Release to decide when it is time to change states.

Note: This VI is Reentrant so that it can be use to control one than one motor, There for each place you use it, they are independent of each other and will not know what time has been set in the other placements. Meaning you have to return to the same clone to detect the timeout.

So if you want to set it one state but check it another state you will need to make a copy of it and rename to dedicate to that motor or function and make it non-re-entrant. Then you will be able to set the hold time in one location, but be able to check the timeout in another location.

Omar
__________________
Omar
Reply With Quote
  #7   Spotlight this post!  
Unread 15-02-2010, 14:20
Omar's Avatar
Omar Omar is offline
Registered User
no team
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Huntsville, AL
Posts: 122
Omar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of lightOmar is a glorious beacon of light
Re: Timing functions

Quote:
Originally Posted by grosh View Post
Ben Zimmer stated that timed waits can slow down your code.
That is correct!
You do not want to place a wait inside your telop loop because it will slow down you loop by the amount of the wait. The code in your telop loop needs to get what it has to do fast and loop back around or your robot will not respond to joystick commands or other inputs.

If you have a wait for 2sec while your motor spins then for that 2 sec your joysticks will seem to be DEAD!

Ben Zimmer addresses this with his example of a stop time.
__________________
Omar
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Splice Timing Belt comphappy Technical Discussion 4 07-02-2009 09:37
Timing belts kajeevan General Forum 6 13-08-2008 13:59
timing of re-contact Gary Dillard Rules/Strategy 16 19-01-2008 14:09
autonomous timing seanl Programming 6 09-03-2007 09:42
Timing Codes Ryan Cumings Programming 11 29-01-2004 22:26


All times are GMT -5. The time now is 22:02.

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