|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
||||
|
||||
|
Joystick Button Programming in Labview Help Needed
...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~
|
|
#2
|
||||
|
||||
|
Re: Joystick Button Programming in Labview Help Needed
I can tell you how to get the true/false inputs from buttons right now. I'm not at my main computer with labview so I can't tell you everything.
First right click on the white window (memory is bad for me, even at 16). Go to WPI Robotics library. Click on driver station and then joysticks. Place the VI labeled get in your teleop code. There is a pink output on the right side of the VI, called buttons. Right click on that on go to the menu labeled something like cluster, group and such. Go to the one labeled "unbundle" and click on it. There you go! If you hook up the VI like the other joystick VI's, you should be good. |
|
#3
|
||||
|
||||
|
Re: Joystick Button Programming in Labview Help Needed
Ah yes, we have tried this multiple times... the opening of the GET Joystick and then the unbundling of the buttons... Still don't know why it's not working. Have tried to hook up relays and (jaguar controlled) motors to the buttons (in separate files, of course, not both relays and motors at once), and still can't get buttons to work. See attached pictures for what we've tried.
|
|
#4
|
|||
|
|||
|
Re: Joystick Button Programming in Labview Help Needed
You have the right idea, but have not executed it quite correctly. The best way would be to make a case statement and pass the boolean into the checker (for lack of a better term). Then you can set the motor speed to whatever amount you wish when it is true, and stop it when it is false.
Here's an image of what I'm talking about: ![]() The question is talked about more here: http://www.chiefdelphi.com/forums/sh...ad.php?t=70564 |
|
#5
|
|||
|
|||
|
Re: Joystick Button Programming in Labview Help Needed
Have you tried probing the buttons while the code is running to confirm that you are getting the True/False as you expect?
Can you drive the robot with the Joysticks? |
|
#6
|
||||
|
||||
|
Re: Joystick Button Programming in Labview Help Needed
I have not used a relay yet. Are you sure that they are wired correctly? In the right slot and whatnot? Also test every relay you have wired.
|
|
#7
|
||||
|
||||
|
Re: Joystick Button Programming in Labview Help Needed
Ok,
So I finally got a chance to test out the Spikes on our practice base and here's what I've found. In this other thread I first said you could wire a numerical constant as the input for the Set VI. Then I read that it needed an Enum constant. It turns out I was half right both times. The input to the Set VI accepts two types of data, numerical constants and enum constants. If you right click on the input node and select Create > Constant it gives you an enum constant (the drop down menu thingy) that has 4 choices: Off, On, Forward and Reverse. My best guess for Off and On is that Off means it's completely off and that On means the brakes are applied. (Though this could be reversed) Forward and Backwards are self explanatory. Now if you're going to use an enum constant inside of a case statement I found out one crucial thing that I didn't know about before. If you make the enum constant from scratch it seems that you have to add all the possible selections and set it to the one you want. (To add options you can right click the enum constant and select "Add item before" or "Add item after") They may also have to be in the correct order. (I didn't test this but the order would be Off, On, Forward, Reverse from top to bottom). As it turns out, you can also just use numerical constants for inputs as well. They match up pretty simply: 0 - "Off" 1 - "On" 2 - "Forward" 3 - "Reverse" So if you hooked up a value of 2 to the input it would be the same as hooking up an enum constant with "Forward" Selected. I hope this clears things up a bit more. If you have any more questions or something I said didn't make sense just let me know! - Austin |
|
#8
|
||||
|
||||
|
Re: Joystick Button Programming in Labview Help Needed
we usually stuck to the enums from create.
a note that our team may have not said earlier is that we hooked them to DIO and they had a solid reverse, but we couldn't change it then either. then again, that may just be because it is a constant 0 or something making it go in reverse..... |
|
#9
|
||||
|
||||
|
Re: Joystick Button Programming in Labview Help Needed
@DavidAllen: Hrmmrrr... have tried a few different case statement configurations but perhaps I was not doing them correctly... Will try this when Electrical gives me the board back. > . >
@mgurgol: Probing the buttons? Have definitely pressed like... every button with every combination of code I've ever put into it... and zilch. (And yeah, the joysticks will control the jaguars and we can drive with them, but one set of two jaguars keep going in reverse when we push the joystick -usb slot 2- and we don't know why... Especially since we are only trying to control PWM signals 1 and 2 for the motors... and have deleted all the pre-done driving code in hopes that we could just call the individual PWMs etc on our own just for those two jaguars... and it still wants to control all four for some reason... though that's a separate issue... /rant) @brdn666: Pretty sure they were wired correctly, though many of our all day 'why can't we figure this out??' problems that have been blamed on programming were actually just a backwards PWM cable... But I'm pretty sure there's no real way to mess up the wiring on these. Just going from the spike directly into the correct numbered relay-slot-thing that I specified in the code, right? When we plugged a spike into any of the DIO-slot-things, it would go in full reverse... which is better than nothing, but we're still looking for a way to make them go forward, neutral, and stop, as well as a way to toggle between these modes (ie. buttons... haha) @TotalChaos: Hrmrrr... Yeah I was a bit confused on what the difference was between On/Off and Forward/Reverse. We want the CIM motor attached to the spike to be toggle-able from Reverse/Neutral/Forward... So I suppose that'd be Reverse/On/Forward or 3/1/2...? So if we wanted to do this... We'd like... make a case structure thing with three cases (one for each of the states) and then... I guess... Well I suppose the trouble is that I don't know how I would wire a single button to it in order to be able to trigger all three of these states. Mechanical wants it to be neutral until say... button two is pressed (pressed once, not held down... another issue I'm not sure how to do...) and then it would go forward. They also want it to be able to then (with the same button, presumabley) be able to turn the motor in reverse somehow.... yeahh... not sure if that's possible. But if it isn't, I suppose I'd have to do sorta like... two different buttons, one of which will toggle the spike from neutral to forward and one from neutral to reverse...? Thank you all again for the quick responses and all your help~~~ |
|
#10
|
|||
|
|||
|
Re: Joystick Button Programming in Labview Help Needed
Quote:
<R54> A. Each CIM motor and Fisher-Price motor must be connected to one Victor or Jaguar speed controller. They must not be connected to relay modules. |
|
#11
|
||||
|
||||
|
Re: Joystick Button Programming in Labview Help Needed
@MikeZ: Okee... thanks for the info on the rules about that... Looks like we are probably going to only use one spike now, and attach the CIM to one of the Jaguars...
|
|
#12
|
|||
|
|||
|
Re: Joystick Button Programming in Labview Help Needed
is there a way to program the motor to go forward on button six and reverse on button seven.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming a joystick button... | programmr | Programming | 2 | 05-01-2009 16:13 |
| programming help needed | krunal | Programming | 3 | 29-01-2007 00:18 |
| HELP-URGENT PROGRAMMING HELP NEEDED | Rohith Surampudi | Lego Mindstorm Discussion | 1 | 24-03-2006 23:05 |
| Joystick Button programming | Bharat Nain | Programming | 5 | 18-02-2005 11:48 |
| URgent Programming Help needed | rcubes85 | Programming | 4 | 15-02-2005 23:21 |