We’ve attached a picture of our labview code. Its a different loop from the main robot loop.
Here are the problems we’re having:
-We’re getting the light on the cRIO to go on but the solenoid doesn’t activate
-We’ve searched through other topics and tried different things and nothing seems to work.
-When we look inside the solenoid set subVI while running the code the channel would switch between 7 and 10 rapidly…there is no 10 on the solenoid module, it only goes up to 8!!
For safety reasons, the FPGA image that controls the I/O will not do much without the DS communication and the ability to disable the robot from there. So building quick VIs like yours that do WPI I/O will not work like they would in a normal NI system. I believe that if you drop the Start Communication VI in parallel that stuff will work.
I can’t explain why you are seeing funny values for the solenoid.
It may not be the problem here, but you should get in the habit of using the enumerated types for the input ports rather then numerical constants. You should try to avoid the red coercion dots, unless you really mean it.
The easiest way to do this is to always right click on the input terminal and select create constant.
The DS communication contains the tele/auto and enable/disable bits, joystick values, digital and analog in values that the robot program is then able to operate on. More importantly, if the robot doesn’t hear from the DS about ten times a second, the robot FPGA shuts down the outputs. This means that if someone unplugs and DS, unplugs a router, or if the robot goes out of range of the wireless, the robot will shutdown. If also means that the DS kill switch is always in the loop when doing outputs.
The Driver Station communication is already handled for you in both the Basic and Advanced templates. If you start with one of those, you shouldn’t need to add it anywhere.
Greg’s comment about needing it was directed at anyone who was trying to build a quick VI from scratch for testing something simple. You find the Start Communication VI in the Driver Station palette. You put it anywhere outside all loops.
Alright, we found out the programming wasn’t the problem. Its something with the cRIO. In the programming we went to channel 7 and 5 and on the actual relay pins were on 6 and 4 and it magically works. We thought that then if we did 2 in the programming then it would be 1 on the relays and we tested it, thinking it was programming channel -1= relay and that doesn’t work… We’re completely clueless. Has this happened to anyone else and if it did is there a chart as to what is what?
I’ve been working with Brandon on this issue and we think we solved it today.
The solenoid channels we were feeding into our code didn’t match the pin numbers on the solenoid breakout. Either we are doing something weird in the code that we are not aware of, or we missed documentation on this translation. We did some trial and error testing of which reference in the code activated which light on the cRIO 9472 and discovered this:
In Labview assigning channels 1 and 2 produced no result on the cRIO. 3 linked to pin 8, 4 to 7, 5 to 6, 6 to 5, and so on.
We now have joystick buttons operating all of our solenoids. Thanks to everyone who advised us on this problem. All suggestions helped us better understand this system.