i want to be able to push a button on a joystick and have the cylinder fire and stay out without having to keep the button pushed. also another thing i would like to do is use a non-joystick input device for driving and all i can find in labview is a joystick vi. do i just have to call it a joystick and point it to the usb port it is plugged into or is there something more to it? Any help is appreciated.
Thanks!
Cory S.
~Team 1529~
Maybe something like this?
A shift register works as well.
The joystick.vi works with any standard game controller, such as a steering wheel or an xbox controller.
Thanks! i haven’t seen some of those symbols before, but i will take a look and tinker with it. thank you very much for a quick response!
Cory S.
same button will fire as well as retract the cylendars, right? I’m at home and dont have a robot to test code on.
another thing. how could you tell what buttons are what on a game pad, ie. Button 1 = (Left Trigger)on xbox-like controller? is there a simple way to test what button is what?
Cory S.
They’re all on the Programming sub-palettes.
Probably the most unusual one is the:
Programming -> Structures -> Feedback Node
It stores a value from one vi call to the next, so your code can remember what happened last time.
The button will toggle. One push will set the solenoid to on, the next push will set it to off.
The easiest way to identify game controller buttons is using the Windows utility
Start -> Control Panel -> Game Controllers
That’s the one called a Feedback Node.
You’ll see it in the palette as just an arrow, but when you paste it into a block diagram it’ll have the diamond underneath it. The diamond is a way to set the initial value you want it to start with.
After you place a feedback node it will be black and you won’t be able to do much with it until you tell it what data type it will be saving for you.
Follow up by adding a Boolean True or False from the Programming palette and wire it to the diamond. Then the Feedback Node will turn green, the color of boolean data types. That is what the Solenoids are expecting as inputs to the Set vi.
If you use a double solenoid, it does it automatically.
it is a little messy, but should this work?
http://img685.imageshack.us/f/togglepiston.png/
Cory S.
You just need to add the False CASE.
That’s a wire straight through from the tunnel on the left to the tunnel on the right.
Seems fine otherwise.
I don’t follow. i just added a wire from the diamond pointing left to the true/false (currently false) toggle switch thing.
In the picture you posted there is a hollow green box (called a tunnel) on the right side of the CASE structure. I circled it in a copy of your photo below.
When it’s hollow like that it means you haven’t attached it in all the CASES, so it’s incomplete. You’ll also see there’s a broken arrow for the vi in the upper left menu bar.
You’ve done the TRUE case, but you need to switch it to the FALSE case and just connect a wire across from the left green box to the right green box.
ohh, thanks. i just added that and i have no errors now. thanks for the help! There is one more thing i’m trying to figure out. I don’t know how to run the compressor in autonomous mode. Is that a complicated process or is it simple? i can’t find any threads about that. I tried to do the same thing i did in teleop but it didn’t work. you can see the teleop compressor code labeled GAS in the picture I posted.
Thanks again for all your help. I hope to learn as much as i can about labVIEW and programming before the next build season so the programming skill is not restricting to the robot’s capabilities. You have helpedme alot!
Cory S.
The compressor code belongs in Begin.vi, so that it’s active all the time to support both Auto and Teleop.
Here’s a link to an example of how you start it in Begin.vi: http://team358.org/files/programming/ControlSystem2009-/LabVIEW/CompressorExample2.jpg
There are some other examples on that page you might find useful: http://team358.org/files/programming/ControlSystem2009-/LabVIEW/
oh, wow. I never knew you could do that! Thank you very much!
Cory S.
i just looked at my code. it is the same except i had compressor code in teleop.vi and i did not have anything in finish.vi. if i delete the code in teleop and add the finish code it will then run all the time? Why wouldn’t it run in autonomous as-is though?
I can’t see how the compressor is used in the Teleop photo you posted.
What’s shown is nothing at all, but I can’t see what’s in the other Teleop cases.
It’s probably something you don’t realize is even happening.
The Finish.vi part won’t affect compressor operation. That’s only when the program shuts down.