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?
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.
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.
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.