![]() |
Labview Joystick Buttons...
Hi can someone give me a printscreen of the diagrams in labview to make the joystick buttons work with....lets say a relay. I have a good start but I need some reference to complete what i've started
Thanks Team 877 |
Re: Labview Joystick Buttons...
Well, I'm on a mac right now but I can give you an explanation.
if I recall correctly, you need to use joystick->get raw data It gives you an array, if you unbundle by name I think you can access the proper buttons. The unbundle functions can be found under the array section, if you do a right click. Hope you can figure it out from that. If someone is in their dev environment, please post an image or feel free to correct me. |
Re: Labview Joystick Buttons...
As a start you can check out my post in THIS THREAD.
It's not a full reference, but its a bit. I'll see if I can get a better screenshot for you. - Austin |
Re: Labview Joystick Buttons...
i have all that, but some of the concepts i don't understand are which axis does what??? and how do i know that button 1 on my unbundle program is actually working there are too many things i don't understand at this point. also do you have a layout of which button 1-12 goes with what button on the controller?
|
Re: Labview Joystick Buttons...
I don't have a picture handy or know for certain if all of the buttons match up off the top of my head.
However, while I look for one there is a way you can find out for yourself. Instead of sending the data to the unbundle function (or I guess you could just have a second wire), right click on the data output of the "Get" VI and select: Create > Indicator. This should put an indicator with labels on you front panel that shows all of the outputs of the joystick. You cam just press the button and see which one lights up on the front panel. In the meantime I'll keep looking for a full example of what you're looking for. Hope that helps! - Austin |
Re: Labview Joystick Buttons...
Quote:
edit: oops... posted while austin was :P I'll try austin's and reply... edit2: I tried austin's technique and I got the buttons in the front panel, but apparently I can't wire out of the buttons indicator... |
Re: Labview Joystick Buttons...
yeah i can now get a relay to work off my axis....but not off a button. It's as if I can't wire a button anywhere to send the signal to the robot saying engage relay with button 1
|
Re: Labview Joystick Buttons...
Quote:
|
Re: Labview Joystick Buttons...
Quote:
That did help as the trigger is wxactly what I was looking for.. don't know about OP tho... However, I still can't figure out how to wire the button out to say, a motor, so that when that button is pressed it activates that motor... well wait.. with what I had before (where the buttons are put in the front panel) it wouldn't let me wire out... but when I do the actual buttons it does... I'm not making sense, am I. |
Re: Labview Joystick Buttons...
I'm having the same problem....
|
Re: Labview Joystick Buttons...
I know it's a little late, but here's my crudely done diagram:
![]() (Sorry, I did it in paint without a mouse :p ) Give me about 15 minutes or so and I'll get a picture of some way to hook a motor to a button. (It might not be the best way, but I do know a way) - Austin |
Re: Labview Joystick Buttons...
I had it wired to a servo, but I'm sure it wouldn't be too much different to wire it to a motor. I don't remember exactly how I did it right now, but I can figure it out once I install Labview onto this computer. It might take half an hour or so...
|
Re: Labview Joystick Buttons...
Quote:
|
Re: Labview Joystick Buttons...
i'm waiting for that button diagram haha
|
Re: Labview Joystick Buttons...
Ok, here we go.
I have two examples. One is of the standard code altered so that pressing Button 1 would simulate moving the joystick to one side of the x-axis: ![]() This next example get rid of the standard drive code completely and replaces it with a system in which Button 4 and Button 5 contol a left and right motors (respectively) to either on or off. (So like on our practice base, Button 4 would turn one side when pressed, Button 5 the other): ![]() Ok, so as you've probably noticed, the key is this little guy: ![]() This function converts a boolean value to a numerical value, 0 or 1 (0 false, true 1) It can be found by opening the functions palette and going to: Programming > Boolean and selecting "Boolean To (0,1)". I think that's what you guys are looking for. If you have any more question just ask! Good Luck! - Austin [EDIT] - And sorry it took me so long, I was needed elsewhere to help with cutting some stuff :P ) |
Re: Labview Joystick Buttons...
thank you so much :)
|
Re: Labview Joystick Buttons...
I can't wire it from the boolean to 0,1 to the close. I have drive close on the outside of my main loop, and it's wired to the drivedevref global variable, but when I try to wire to it the wire goes dotted. When I try to make another drive close inside the loop and wire to it I get the same problem
Edit: Or is it not possible to set it to drive close? I just wanted to do that so I could test the button input at our next meeting... |
Re: Labview Joystick Buttons...
The only thing that needs to be sent to the Close VI is the DevRef wire, which is the pink wire that comes out of the "Open Jaguar" or "Open 2 Motor", etc, VI.
![]() - Austin |
Re: Labview Joystick Buttons...
i can get the relay to turn off but not able to engage it...so when I press the button the relay shuts off
|
Re: Labview Joystick Buttons...
So you want to press a button to turn the relay on, release the button and do whatever else you need then be able to hit the same button to turn it off?
Or maybe I'm still misunderstanding you? - Austin |
Re: Labview Joystick Buttons...
What about pressing a button to turn on the compressor?
Then pressing another one to turn it off? Sorry if I'm derailing the thread, but I figured it was still somewhat related so instead of starting [another] thread on joystick buttons... |
Re: Labview Joystick Buttons...
I don't want to turn the relay on and off. I want it always on. But i want it to either have a forward polarity or a reverse polarity. (indicated by green for forward and red for reverse on the spike itself) Can you explain to me how to do this?
|
Re: Labview Joystick Buttons...
Oh, ok, I think I'm getting a better understanding.. Are you trying to make one button that toggles between forward and reverse, or are you trying to do one button for forward and another for reverse?
- Austin EDIT - Or forward when held down, reversed when unpressed? |
Re: Labview Joystick Buttons...
I would like to know how to do both!!! haha
|
Re: Labview Joystick Buttons...
Quote:
For the case structure, you would just put the relay function in the C/S, then wire a constant to the input. The boolean selector would be similar but smaller and simpler, and if you know what Im talking about, I'd use it. Go here for how to use the relay function (as well as any other first function):http://decibel.ni.com/content/docs/DOC-2631 If you right click on the input node and select create->constant it will put an enum there with forward and reverse settings. Because it is an enum, the three states will be 0, 1, 2 for forward, reverse and off, I think (in no particular order, check the enum for the real values). Hope that helps get you on your way. That should be enough to do both of those scenarios. |
Re: Labview Joystick Buttons...
A picture of this would be much appreciated :)
|
Re: Labview Joystick Buttons...
Can anyone just make one of these programs and make a printscreen.
I'm desperate to figure this out and so far i've been unsuccessful. I need to use a joystick button to engage a relay forward, and reverse, and off....Please help! |
Re: Labview Joystick Buttons...
1 Attachment(s)
Hey all, a bit late, but I have made a simple VI for retrieving a single button's boolean state based on it's enumerated value. It hooks up just like the Get Axis sub-VI, but with an Unsigned Byte (8-bit) input hook for a button enumerator control.
Here's a screenshot: Here's a copy of the VI: |
Re: Labview Joystick Buttons...
1 Attachment(s)
Quote:
Usually I would just post a screenshot and explain in the post, but since there's cases inside of cases I wouldn't be able to show you everything without a screenshot for every possible combination, so Instead you can just download the code. (I'll attatch it to this post) I have comments in the code that explain everything I did and why. I don't know that this is the best or most efficient way to do what you are trying to do, but it is one solution. If you have and questions about the code feel free to ask! And if you find any errors please let me know! - Austin |
Re: Labview Joystick Buttons...
1 Attachment(s)
this is what i have so far if anyone can build from this that would be absolutely amazing
|
Re: Labview Joystick Buttons...
EDIT 2 - I just went back and checked out a previous post which led me to the programming manual. (Which I havent read :p ... I'm more of a learn through experiance person) Anyways, using -1 and 1 may not work. But seeing as I don't have a way to test it I added on more to the bottom explaining how to do it so that it's at least in-line with the manual.
Ok, maybe I jumped ahead and went a little too fast with my last example. Lets build on what you have and start with something simple. First off, I think it would be a good idea to clean up your code. When I'm testing things out I find it easier to test for one thing at a time to avoid clutter. I took your picture and marked some of the things I think you should take out in red. (The box with the question mark you could keep, I wasn't really sure what you were doing with it so I would just say delete it unless its important to you.) The blue box signifies what I want you to change. EDIT - And don't forget, for EVERY Open function you need a matching Close function. ![]() As a first step we'll set this up to go one way when the button is pressed and another way when then button is released (unpressed). In the blue box go ahead and get rid of the "boolean to num" function and instead add a case statement. To get that open up your palette and go to: Programming > Structures and select "Case Structure". In the True case of the case structure and a numerical constant (Function palette > Mathematics > Numeric and select "Numeric Constant") and enter in 1 as its value. Then click one of the little arrows next to where it says "True" on the case structure to switch it to the false case. In the false case add a numerical constant and enter in -1 as its value. Wire up both of the numeric constants to the right wall of the case structure and then wire the new tunnel output to the Set Relay function. Here's what it look like: (True case shown) ![]() (False case shown) ![]() Let me know how this works and then we can work from there. EDIT 2: In the blue box go ahead and get rid of the "boolean to num" function and instead add a case statement. To get that open up your palette and go to: Programming > Structures and select "Case Structure". In the True case of the case structure and a enum constant (Function palette > Mathematics > Numeric and select "Enum Constant") and enter in "Forward" as its value. Then click one of the little arrows next to where it says "True" on the case structure to switch it to the false case. In the false case add a enum constant and enter in "Reverse" as its value. Wire up both of the numeric constants to the right wall of the case structure and then wire the new tunnel output to the Set Relay function. Here's what it look like: (True case shown) http://img261.imageshack.us/img261/9...onhelp5if7.gif (False case shown) http://img504.imageshack.us/img504/8...onhelp4kk1.gif (^^^ There's a max amount of images per post, so I linked these instead) - Austin |
Re: Labview Joystick Buttons...
If the case with two constants works for you, then may I suggest looking at the ternary assignment -- a fancy name for the ? : operator in C. It is actually called the Select operator. LV puts it in the Comparison palette, and it is handy for selecting one of two values without the space and hidden constant of the case structure.
Of course this is just for readability, it is equivalent at runtime. Greg McKaskle |
Re: Labview Joystick Buttons...
1 Attachment(s)
...Yeah.... okay... Trying to program the joysticks' buttons... More specifically, trying to get a spike/relay to be able to be controlled by a button. (Forward/Reverse would be nice for one, Forward/Neutral/Reverse for the other) so I've looked at just about every tutorial/help guide thing that I could find... At the moment, we have two spikes on our electrical board, one of which, when attached to any of the DIO things it will stay a constant red (reverse) which does run a motor, albeit all the time and only in reverse. Code-wise, here's what I have so far (In attachments). [In the inner-most case structure, the false case is set to a constant of 'Reverse' as I believe you have said to do. Also tried 1 and -1, but to no avail.] Any help or advice would be greatly appreciated. Thank you~
|
Re: Labview Joystick Buttons...
Were trying to do something very similar but with out the relay.
We want to have a button that on one press it turns on our traction control code, and when you press the button again it turns off our traction control code and turns on our manual speed control code. we have our two pieces of code in a case structure where true is traction control and false is manual speed control. we then wired this to a joystick button and it works other than you have to continue to hold the button down to get it to stay engaged. is there an easy way to make the joystick buttons into on/off buttons rather than momentary buttons. |
Re: Labview Joystick Buttons...
Quote:
- Austin |
Re: Labview Joystick Buttons...
TotalChaos,
Yup. That is exactly what we are trying to do. we want to take the momentary button and make it a toggle. i opened that vi and it looks like what i need i just need to pull out the extra items for the buttons 2 and 3. Thanks. |
Re: Labview Joystick Buttons...
Quote:
|
| All times are GMT -5. The time now is 10:57. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi