|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Buttons on Joystick
Hmm,
I just highlighted execution as I was running the code. The Teleop seems to be in the init loop. Isn't it supposed to be in Execute? Or is this normal? =/ |
|
#2
|
|||
|
|||
|
Re: Buttons on Joystick
Hilight execution runs the code about 10,000,000 times slower than normal, so you may notice things that are normally just a blip. The init code runs once, then the normal execute runs for each packet. Finally, before going to another state, the Finalize state (whatever it is called) is called once.
Greg McKaskle |
|
#3
|
|||||
|
|||||
|
Re: Buttons on Joystick
When your code is working correctly, you should see two of the LEDs on the cRIO module in slot 8 working. One should light while the other is off and vice versa. You probably need to set the initial state in Begin.vi as well, but they default to Off, so they'll begin as both LEDs off.
If those lights are working, then move on to checking the wiring. One solenoid side of your double is wired to Solenoid Breakout pin(s) 1 and the other side to pin(s) 2. The compressor probably isn't messing up the solenoids. Normally, in Begin.vi, we do an Open Compressor, then a Start Compressor, then the Refnum. The Start is actually a periodic task all it's own and continues to run the entire time your code is active. |
|
#4
|
|||
|
|||
|
Re: Buttons on Joystick
We have managed to get the Solenoid with Compressor example working.
We've also gotten the solenoid to accuate but we are having difficulties making the second solenoid do the release. Also - in the Begin, we've noticed a strange discrepency. In this year's template, we need to use the Solenoid VI that has the number sign and an arrow, yes? When we double click on that VI and view the front panel, we notice that some of the settings such as Solenoid Channel or Refnum name change. We have two solenoids opening in begin and it seems that...when we double click one of the Solenoid VIs with the number sign/arrow we open the same front panel that we would get if we double clicked the other Solenoid VI with the number sign/arrow. They don't seem to be two independent things even though the Block Diagram in Begin seems to distinguish them seperately. |
|
#5
|
|||||
|
|||||
|
Re: Buttons on Joystick
Sorry, I've taken so long. I had a nice dinner and a productive night in the shop.
The Solenoid Refnum vi is actually the same vi no matter how many times you see it pasted onto the block diagram. So it's really only getting called once at a time. It is just making an entry for solenoids in a registry of all open devices. What you initially see in the various fields are just the default values. When the code actually executes those default values get overridden by the inputs you gave to the Open, e.g., the name you chose and the particular solenoid pin number, etc. There is an option under File -> VI Properties that allows you to make a vi reentrant. That means every time you paste it into the code you get a different unique copy of it. Then those reentrant copies do run independently of each other. We use that for when we have to preserve unique data stored inside the vi between calls and don't want it being called in another place and replacing the data we've preserved in the vi. For instance, if you make a vi that ramps up the speed of a motor and you want to use it for both the drive motors and for an arm motor. You'd be calling it every time you came back into Teleop, but you wouldn't want the last arm motor speed to get mixed up with the last drive motor speed when you ramp up one more step. Last edited by Mark McLeod : 16-02-2010 at 08:22. |
|
#6
|
|||
|
|||
|
Re: Buttons on Joystick
is there any way to control a motor with a button using labview.
|
|
#7
|
|||
|
|||
|
Both solenoids work (when tested one at a time) on the Solenoid with Compressor example code perfectly.
In our Teleop, we have coded it in such a way that pressing Button One should accuate the solenoid. We have also changed the code so that the Button's T/F value is directly wired into a Solenoid set rather than using a case structure. However, we have had no success with that. We also are not seeing the proper LED lighting on the 9472 module. But the Solenoid breakout indicator does light up. (The compressor works beatifully though! )So, we definitely know that it is not the solenoid wiring because the examples work just fine...But our code looks okay as well. Our programming is definitely at a loss right now. Any and all suggestions will be greatly appreciated. Thanks! Edit - some added information: We have placed a Solenoid Set in the Begin VI and have set the value to True. When we do this, both of our Solenoids (accuate and retract) work and the appropriate LEDs light up on the 9472 module. The strange thing is - the 7/8 LEDs are lit up both on our Driver Station Dashboard and on the 9472 module even though we haven't coded anything in these two areas. Last edited by helenajoy : 16-02-2010 at 22:19. |
|
#8
|
|||
|
|||
|
Re: Buttons on Joystick
Okay, so we no longer thing that solenoids are the problem. Like I said, the solenoids work in the example. Also, our solenoids work in our Autonomous Independent VI.
We are thinking that are problem is with the Teleop VI. When we run the Joystick Input example, we get a reading for all three of our joysticks. We also added code to the Joystick Input Example to indicate when buttons are being pressed. We got a green light whenever we pressed the buttons. We added an Joystick button indicator within our Teleop and tested it. When we pressed a button on the joystick and viewed the Teleop Front Panel, the indicator does not turn green. |
|
#9
|
|||||
|
|||||
|
Re: Buttons on Joystick
If it's Teleop and not Auto, then I think you're right to look at the joysticks.
Double check the USB selections for your joysticks and the names given each of them. Even an extra space will make the name unique and not reference the joystick correctly. |
|
#10
|
|||
|
|||
|
Re: Buttons on Joystick
We have just checked the joysticks as well. We have tested them and have made sure that they are in the proper USBs. And we have made sure that the names are exactly the same. When we run our Teleop, we get a Watchdog Not Fed message. We are not sure where in the code we need to feed the Watchdog or what we are doing wrong that is starving the Watchdog.
Last edited by helenajoy : 17-02-2010 at 20:41. |
|
#11
|
|||
|
|||
|
Yay! We've finally figured out our problem!
We figured out that it was actually electronic problems with the camera that were holding us up. Since it wasn't wired properly, the Watchdog stopped our code. Thanks, everybody! ![]() |
|
#12
|
|||||
|
|||||
|
Re: Buttons on Joystick
Do you have any While loops in your Teleop or anything that takes awhile to finish?
Whatever you do in Teleop shouldn't take more than 1/50 of a second to complete, otherwise, you'll be missing driver commands and robot response will be really bad. P.S. Never mind. Glad the problem was found! |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Joystick Buttons? | grosh | NI LabVIEW | 7 | 16-02-2009 16:59 |
| Joystick buttons | Team_2547 | NI LabVIEW | 1 | 24-01-2009 19:42 |
| Joystick Buttons | KRibordy | C/C++ | 6 | 24-01-2009 10:06 |
| Programing joystick buttons | Shivang1923 | Programming | 8 | 09-02-2008 16:21 |
| Buttons to Pins on Joystick | yarb65 | Electrical | 1 | 24-08-2007 20:39 |