Log in

View Full Version : pic: Lab view


Rochester2909
11-03-2014, 15:30
[cdm-description=photo]39986[/cdm-description]

Jay1986
11-03-2014, 15:35
Well to fix your solenoid problem, the "solenoid set vi" needs a on/off command for single solenoids and not a true/false. To fix this, right click on the terminal of the "set vi" and hit create constant. This will give you the correct command. Then copy and paste another one and change it to "off". Then wire both commands to a select with the "on" wired to "true" and "off wired to "false". Then wire the output of your button to the input of the select and finally wire the output of the select to the input of the solenoid "set vi". Do this for both solenoids.

randantor
11-03-2014, 15:38
Well to fix your solenoid problem, the "solenoid set vi" needs a on/off command for single solenoids and not a true/false. To fix this, right click on the terminal of the "set vi" and hit create constant. This will give you the correct command. Then copy and paste another one and change it to "off". Then wire both commands to a select with the "on" wired to "true" and "off wired to "false". Then wire the output of your button to the input of the select and finally wire the output of the select to the input of the solenoid "set vi". Do this for both solenoids.


The solenoid VIs will work with either a boolean or an enum value.

Jay1986
11-03-2014, 15:47
Other suggestions with the rest of the code: First of all, don't have all of you code in teleop. The more code you have in teleop, the laggier your controls will be since all of the code is waiting for each other before it starts another iteration. What I recommend you to do is, write all the outputs from the buttons to global variables and then put all of your code in periodic tasks with separate loops and read the global variable from teleop. Doing this also allows you to have your code run in autonomous, so you can just write to your global variables instead of rewriting all of your code in autonomous. You don't have much code, so this is not a necessity this year. Another suggestion, you are using case structures like selects, so the case structure is a bit unnecessary. Also, the "motor set vi" reads values from -1 to 1, not -255 to 255. Other than that, it looks fine.

Hope this helps!

Woolly
11-03-2014, 15:48
Correct me if I'm wrong, but for a double solenoid, don't you need to select between forward and reverse to make the mechanism extend and close.
Also, looking at your comments you want it to toggle being in or out on button press.

You will need to wire your button through this vi (thank you Channel Cats)
http://2013swat-robot-code.googlecode.com/svn/trunk/Re-usable%20VIs/EDGE-TRIGGERED-D-TYPE-FLIP-FLOP.vi

and then to a select statement that selects between the forward and reverse constants.

Mark McLeod
11-03-2014, 16:19
Except those are Single solenoids, not doubles.
But the button toggle suggestion is good.

AGPapa
11-03-2014, 17:06
The motor sets need a double from -1 to 1, not an integer.