Just a question pertaining to loops, which may have something to do with soleoids: wouldn’t putting loops with “waituntil millisecond” control into the TELEOP subvi cause everything above it run slow, because it is already stuck inside a while loop on the Robot Main? A NI rep told me that loops run only as quickly as the slowest object inside them, wheter waiting for an answer or a timer.
Yes, however, I’m not sure your question belongs in this thread …
Putting a WAIT for anything more than 20msec will cause your Teleop watchdog to starve … there’s a relatively new thread in here that shows a way to put a 1-second wait into a state machine so you don’t have to stall your Teleop. It involves the use of shift registers to employ some loop-to-loop memory so you can pick a time to exit without specifically “waiting” for that time to elapse. Here’s a link … there’s a diagram in the last post …
The NI Rep is correct. Stated differently, a loop in any of the languages in FRC will not begin again until everything in it has completed. In LV, some things in the loop are sequenced, and others can run in parallel, so the loop waits for the last element to finish.
If you want to run something inside teleop loop, such as was done in the other thread that counted for one second, use either a shift register or a feedback node to remember when the valve was opened, compare for each teleop and close when time and other conditions are right. If you want more precise timing, you can move it to a purely timed loop that isn’t synched to the DS.
go to LabView Question http://www.chiefdelphi.com/forums/showthread.php?t=82255 , post #8. find image of where I am at in solenoid programming, teleop subvi
solenoids are looped together to act at the same time(both side of 2 end 24v Festo) and then return
I got the air compressor working(compressor opens and starts in begin.vi), but it doesnt stop after reaching 120 psi.
In my code, i have the compressor get enabled state, in which i have a case structure connected to the the “enabled state” of the vi. If it is true, i turn the spike off, and if it is false, i turn the spike on.
Since when its true, the pressure switch should be closed, meaning that there is enough air in the pressure tank and that i need to stop air from going in, right?
However when deploying, the compressor does not stop. Am i doing something wrong?
You shouldn’t be doing any of that. It interferes with the Compressor task.
The Compressor Start is running in the background watching the pressure switch and turning the Spike on & off.
You shouldn’t have any code that tpuches the Relay or the DIO that the Compressor is now using.
Ok, I removed that code. The only Air Compressor code I have opens it and starts it in the begin.vi and closes it in the finish.vi.
However, the pressure switch does not turn the spike on and off. The LED status was green for the duration of the air pumping.
On a sidenote, teleop keeps switching from teleop enabled to disabled. I have no clue what is causing this, and i wonder if it is affecting my deployment.
Edit: So we have confirmed that the Pressure Switch is working, but the spike is not turning off since the led next to relay 1 is green the entire time. Is this a programming error or what? Screenshots would help alot.
The problem can be with the Pressure Switch or the code.
One test is to unplug the pressure switch while the compressor is running. If the Relay light goes out, then you have a bad pressure switch. If the Relay keeps going green, then I’d suspect a code problem.
Since the Spike is doing what the Digital Sidecar Relay LEDs are doing, then the wiring for that is working fine.
We unplugged the pressure switch while the compressor was running and the LED remained green, so it was a code problem?
I attached my Begin.vi, Robot Main.vi and Teleop.vi. Is the code wrong? The Spike, Compressor, and the Pressure Switch is apparently connected correctly.
Well, what is wrong with our code? Do you need to see anything else?
Problem: Joysticks dont work(will explain this later) and Air Compressor does not shut off(Spike doesnt turn off) after the pressure switch opens(its normally closed, and it does open after it reaches about 120 psi)
For Joysticks:
Joystick 1 sends a signal to the both jaguars and they go in opposite directions(1 Jaguar is green, the other is blinking red).
Joystick 2 randomly sends a signal to the jaguar on the right(usually orange, randomly goes blinking red or blinking green).
With the lightbulb on, We have confirmed that pushing joystick 1 forward and not pushing joystick 2 gives the value of -1 and 0 respectively. It works vice versa also. So there is a screw-up somewhere in tank drive where the signals get mixed together or something.
I’d need to see your code to help much, but I don’t see anything.
Are you using imageshack or something like that?
Those sites get block by our school and there’s not even an indication that there is a picture in any of your posts.
Someone else will have to help with this problem…
P.S. When I get home I’ll be able to see what you posted. That is if they ever let me out of this shop…
One thing I noticed is that you’re opening and closing your robot drive in teleop, plus you still have references to the default robot drive in telop. You probably have conflicts in PWM assignments doing that. You also shouldn’t be opening and closing hardware like that, as telop is called 50 times per second. You should open it and save the device reference in begin. In teleop you should get the device reference and do something with it. It should be closed in finish.
I used tinypic. next time, ill just upload a zip file so everyone can access it.
Thats what we had. We had all that, and the only errors we were getting from the driver station were the watchdog errors. This was good, except that tank drive was not functioning properly(meaning each joystick controls its own jaguar which moves the motor its connected to).
I guess we are just having errors somewhere when everything is being referenced. maybe some other code is screwing around the data for the references because when we use joystick references instead of just opening joysticks on a USB port, tank drive screws up(I am sure i wrote this before, but ill do it once again. When i say tank drive screws up, i mean that in light bulb mode, the joysticks are giving the correct values[joystick 1 turns left motor, joystick 2 turns right motor]. When we run the code on the robot, Joystick 1 controls both motors and joystick 2 looses control of motor 2(it regains control for half a second randomly)
It would be really helpful if you could post or PM me some sample code(we dont have any examples installed in labview for some reason) that we could work off of.
Your Begin.vi code looks good. The only danger is we can’t see if you are opening multiple things like “USB 1” and “Drive Motors”.
P.S. One mistake is you open two different devices on Relay 1.
Your basic Teleop.vi code looks okay too, except for what Joe commented on.
The Compressor code in Robot Main.vi doesn’t actually do anything. It can be removed and you wouldn’t notice any difference in operation.
I’d refrain from adding anything at all to Robot Main on general principle.
I’m with Joe on the duplicate drive code. Without seeing the full Begin.vi it looks like you probably have a conflict where sometimes your code wins control and sometimes the default drive code you left in the False case in the top part wins control.
If you’re not using the default targeting code I’d recommend you just delete it from Teleop.
In Begin clean up opening the drive motors twice and any multiple Opens on joysticks you might have.
I’ll see if I can post a cleaned up version of your code later after lunch and a trip to Lowe’s for bumper plywood and aluminum tubing.
we were having this same problem of the compressor turning on and then immediately off as soon as the robot was enabled. now the compressor does not turn on at all. after reading several other posts i noticed that our relay leds on our digital side car are not lighting up and the led on our spike stays orange, it has never changed colors, i’ve tried fliping the pwm cable around but that seems to not have made any difference. we are using the example vi from labview to try to run this compressor and cylinder. does any one have any suggestions on how to get the relay to start working?
I copied your code into a new copy of the default robot project.
Robot Main.vi is left in it’s original untouched state.
All Opens are done in Begin.vi
All Closes are in Finish.vi
All uses are in Teleop.vi
I got rid of the duplicate drive motors and fixed the duplicate relays.