Go to Post Give us six more motors in the kit, and we'll try and come up with something... - Karthik [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 21-02-2010, 01:44
masterspy7 masterspy7 is offline
Registered User
FRC #3019
 
Join Date: Feb 2010
Location: Arizona
Posts: 5
masterspy7 is an unknown quantity at this point
Creating a "delay" for a boolean value

Hey everyone, I am a programmer for team 3019 and have a quick question...

Here is the setup. Our kicker works like this. A cylinder pushes a kicker into its locked state, and a servo locks it into place. The cylinder then recedes. (this process is automatic)There is a limit switch to tell the program when it is in its locked state, which then tells it to activate the servo and pull in the cylinder. The problem is that as soon as the limit switch is activate, the cylinder recedes at the same time as the servo latches, and it does not latch fast enough.

So my question is, how can I create a delay for the cylinder, so the servo latches and after x amount of time the cylinder recedes?

The first thing I tried was creating a case structure right before solenoid fire. If the incoming boolean was false (the solenoid is going to retreat) I used a watchdog delay and feed (for the errors i used solenoid open to fire). This works, but it delays the entire robot, and I think logically it would constantly be delayed when the solenoid is not firing. Is there a better way to create this kind of delay?

Last edited by masterspy7 : 21-02-2010 at 01:51.
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2010, 02:02
bladetech932's Avatar
bladetech932 bladetech932 is offline
Programmer of awesome
AKA: Jon
FRC #0932 (Circuit Chargers)
Team Role: College Student
 
Join Date: May 2009
Rookie Year: 2009
Location: Tulsa
Posts: 242
bladetech932 is on a distinguished road
Re: Creating a "delay" for a boolean value

the best way i have found to do this is in a flat sequence with two cases put a for loop the run amount for the loop is your delay then the second state returns to start over
Reply With Quote
  #3   Spotlight this post!  
Unread 21-02-2010, 12:09
masterspy7 masterspy7 is offline
Registered User
FRC #3019
 
Join Date: Feb 2010
Location: Arizona
Posts: 5
masterspy7 is an unknown quantity at this point
Re: Creating a "delay" for a boolean value

Quote:
Originally Posted by bladetech932 View Post
the best way i have found to do this is in a flat sequence with two cases put a for loop the run amount for the loop is your delay then the second state returns to start over
Could you elaborate on this with a screenshot or something? I think I know what you mean, and I will try it first.
Reply With Quote
  #4   Spotlight this post!  
Unread 21-02-2010, 02:31
114Klaatu0x72's Avatar
114Klaatu0x72 114Klaatu0x72 is offline
DQN
AKA: Sean
FRC #0114 (EagleStrike)
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Mountain View
Posts: 19
114Klaatu0x72 has a spectacular aura about114Klaatu0x72 has a spectacular aura about114Klaatu0x72 has a spectacular aura about
Send a message via AIM to 114Klaatu0x72
Re: Creating a "delay" for a boolean value

The best solution for this would be to increment a value, and then check if is has reached a certain value. The idea behind it is that given a known period, you can approximate values by repeating that period a certain number of times, all while not having a program get hung up in a loop. You could achieve this by doing a simple if (value >= WhatIWant), do this, else value++ type thing. Or, you could do what I did and check the robot time, (A) because it automatically increments itself, and (B) because it is not dependent on processor time. I know this would be pretty straight forward in c++/java, and can only hope it is the same with labview. Hope this helps.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-02-2010, 13:14
anyheck anyheck is offline
Registered User
FRC #2242 (Cougars)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: New Orleans
Posts: 26
anyheck is on a distinguished road
Re: Creating a "delay" for a boolean value

Quote:
Originally Posted by masterspy7 View Post
The first thing I tried was creating a case structure right before solenoid fire. If the incoming boolean was false (the solenoid is going to retreat) I used a watchdog delay and feed (for the errors i used solenoid open to fire). This works, but it delays the entire robot, and I think logically it would constantly be delayed when the solenoid is not firing. Is there a better way to create this kind of delay?
I don't know if this is the "best" way but I wrote these Boolean modifiers. The timing ones store a value and then compare it every loop. THese are fine to use in teleop, actually best to use there.

Regards,
Sten
Attached Files
File Type: zip Boolean Programming Modifiers.zip (33.3 KB, 26 views)
Reply With Quote
  #6   Spotlight this post!  
Unread 21-02-2010, 14:07
masterspy7 masterspy7 is offline
Registered User
FRC #3019
 
Join Date: Feb 2010
Location: Arizona
Posts: 5
masterspy7 is an unknown quantity at this point
Re: Creating a "delay" for a boolean value

Quote:
Originally Posted by anyheck View Post
I don't know if this is the "best" way but I wrote these Boolean modifiers. The timing ones store a value and then compare it every loop. THese are fine to use in teleop, actually best to use there.

Regards,
Sten
Thanks! Did I implement this properly? You can see am delaying the false value going into the solenoid set. I think this outputs a false value.And the delay is 2 seconds.
Attached Thumbnails
Click image for larger version

Name:	delaytest.JPG
Views:	54
Size:	44.4 KB
ID:	8734  
Reply With Quote
  #7   Spotlight this post!  
Unread 21-02-2010, 15:18
anyheck anyheck is offline
Registered User
FRC #2242 (Cougars)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: New Orleans
Posts: 26
anyheck is on a distinguished road
Re: Creating a "delay" for a boolean value

I always use them as SubVi-s. So unwrapping them I'm not sure I'll have to look in a bit. You should be able to set up some momentary boolean and have it output a boolean that stays true or false for the millisecond value.

They are set to be "reentrant" so you can use them wherever you want and not have race conditions.

I was using one in periodic yesterday and it didn't behave as expected, but then I passed it back into teleop with a global and it was fine.

Sometimes I'll daisy-chain them together for doing multiple timings or sequential timing.

The latch switch ignores re-pressing so you can use the one-loop-latch as a trigger to the countdown vi if you need an exact timing length.
Reply With Quote
  #8   Spotlight this post!  
Unread 21-02-2010, 15:31
anyheck anyheck is offline
Registered User
FRC #2242 (Cougars)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: New Orleans
Posts: 26
anyheck is on a distinguished road
Re: Creating a "delay" for a boolean value

Ok. I guess since I don't know what the boolean that is controling the case statement is doing, I don't know what this will do.

This attached photo is typically how I wire it.

Try it out in a test blank VI with a while loop.
Attached Thumbnails
Click image for larger version

Name:	Boolean Control.JPG
Views:	39
Size:	37.9 KB
ID:	8735  
Reply With Quote
  #9   Spotlight this post!  
Unread 21-02-2010, 15:58
masterspy7 masterspy7 is offline
Registered User
FRC #3019
 
Join Date: Feb 2010
Location: Arizona
Posts: 5
masterspy7 is an unknown quantity at this point
Re: Creating a "delay" for a boolean value

The boolean controlling the case structure is the incoming boolean for the solenoid. It's set up that way because I only want a delay when the false value is coming in. I will try what you suggested. What I had before didn't work though...Does it matter if its unwrapped or not?
Reply With Quote
  #10   Spotlight this post!  
Unread 22-02-2010, 02:44
anyheck anyheck is offline
Registered User
FRC #2242 (Cougars)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: New Orleans
Posts: 26
anyheck is on a distinguished road
Re: Creating a "delay" for a boolean value

Quote:
Originally Posted by masterspy7 View Post
The boolean controlling the case structure is the incoming boolean for the solenoid. It's set up that way because I only want a delay when the false value is coming in. I will try what you suggested. What I had before didn't work though...Does it matter if its unwrapped or not?
Reading your description again, I think that the lower example that I showed would work for what you want:

When the incoming boolean goes true, it activates the "one-loop-latch" which is basically a modifier that makes the output true for only one loop. That will activate the countdown and make it true for just 2000 ms after the boolean input goes true.

If you wire it up as in the top example, the output will be held true for as long as the input is true plus 2000 ms before going false.

I hope this helps and not too late. We had another late night.

Regards,
Sten
Reply With Quote
  #11   Spotlight this post!  
Unread 22-02-2010, 13:57
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: 121
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: Creating a "delay" for a boolean value

Hold_and_Release.vi will detect a rising edge of a boolean like your limit switch. You can change it to detect a falling edge.

The output Boolean will remain high for the amount of time that is passed in.
You can invert the output is needed.
Attached Files
File Type: zip BooleanDelayAction.zip (11.6 KB, 21 views)
__________________
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
Championship Event - Where the "Random" Match Sorting Really "Shines" Travis Hoffman Championship Event 57 19-04-2007 08:06
New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" Jessica Boucher Team Organization 0 10-08-2005 10:55
Thanks to All "Value-Added" Participants Rich Kressly Thanks and/or Congrats 3 13-05-2005 17:53
"Thunderbirds" Vs. "Team America" Which one will rule the box office? Elgin Clock Chit-Chat 3 07-09-2004 19:53
Conflict between "Initialize_Tracker()" and "pwm13 & pwm15"? Kevin? gnormhurst Programming 3 22-02-2004 02:55


All times are GMT -5. The time now is 08:39.

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