Code Check

This is my fourth day in Labview (our Java coder decided to quit the team) so I’m just checking to see if my code looks good.

To explain a little about the bot, it runs 4 CIMs on drive, tank style with Jaguars. The bicep is controlled by two window motors that work in unison on jaguars, and the forearm is controlled by the fisher-price (so its scaled) on a vector. The minibot is deployed by the cylinder, so I’d actually like to make it so the compressor turns off for good once it comes up to pressure and I don’t know how to do that. We have red and blue rope-light connected to their respective relays that turn red or blue depending upon our assignment. Do I need to turn the lights on both in autonomous and teleop?

Do we need to put our fans on a relay? The safety inspectors jumped down our throats last year when we tried to explain that we didn’t need a relay on the fans, and we showed him the rules, but he didn’t believe us, so we threw them on a relay.

I’m also concerned about the safety VIs, I don’t know how to use them, or even if I need to use them. I’m also clueless when in comes to the error-in and error-out functions.

Begin.vi (38.9 KB)
Finish.vi (23.1 KB)
Disabled.vi (19.1 KB)
Periodic Tasks.vi (17 KB)
Teleop.vi (28 KB)


Begin.vi (38.9 KB)
Finish.vi (23.1 KB)
Disabled.vi (19.1 KB)
Periodic Tasks.vi (17 KB)
Teleop.vi (28 KB)

I don’t have labview at home, so i cant help you specifically, but the compressor part is pretty easy. All you need is to open a compressor in the begin vi, with the pressure switch pwm port and the relay for the spike as its inputs, start the compressor, and then give it a reference name (and finish it in finish.vi).

No code in teleop needed. The compressor will automatically start pumping when autonomous starts, and when it hits about 120 psi, it will stop. You can also preload air into your tanks before matches so the compressor won’t have to run during autonomous.

Thanks! Will this make it so it doesn’t turn on once it goes below 95 PSI? i.e., just fill once (to save battery?)

I understood that you can put air in the tanks beforehand, but I thought it had to come from the same compressor, or at least the same type.

The compressor Start command makes the compressor turn on when it’s at about 115 PSI and off when it’s about 120 PSI (not sure about the actual numbers, sorry). You can also control the relay the compressor is on directly, using the relay commands (they’re in the output pallet), I’m not sure how you access the PSI gauge, sorry.

On the other hand, your battery will last. Last year, our team had a hanger driven by two CIMs and the battery held up (for about one match :rolleyes:.) We had a compressor also. There’s no real reason to have it not just stay full.

Also, the rules say that you can have energy in the form of compressed air on the robot. They say nothing about how that compressed air got there. It would be easiest, though, to just turn on the robot in the pits and have it charge up. Then replace the battery if you really need to.

To my knowledge the pressure switch returns a DIO boolen value. I have been told by our team’s pneumatics crew that a pressure switch that told told you more would be really expensive and because of some pneumatics rules would be useless anyway.

Don’t the safety inspectors check to see if the air compressor given with the kit is ‘safe’ if you have any pneumatics on there?

Most definitely. The switch is 100% digital. Being the coder, communications analyst, mechanic, electrician, and pneumatics guru of the team (did I get all positions that don’t require talking to other people? :stuck_out_tongue: ), I know that the switch returns a digital value, and there would really be no purpose in having an analog switch. It wouldn’t be too pricey, just pointless.

Back to the ultimate question though, does my code look good?

I also noticed a Sync Group lead on the Set Output VI. Will this allow me to have those motors work in unison? If so, how do I use it?

Also, finally, Error In and Error Out. What do these do for me and do I need them? I understand they can help control which code starts first, but I thought the DevRefs would take care of that.

bump

The Sync Group is only used for CAN control. It’s not used for PWM control. With PWM, the motors are all updated at the same time.