Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Joystick Buttons to Control Jaguars (http://www.chiefdelphi.com/forums/showthread.php?t=101711)

chall3613 01-02-2012 15:43

Joystick Buttons to Control Jaguars
 
I would like to know how to program one joystick's button's to control one motor back and forth and then the other joystick only needs to move the motor one way.

We have the two rubber wheels spinning to collect a ball. They are on a pole in a Fisher Price Gear Box thats moved by a Fisher Price motor. Then, we have the same thing (the gear box and motor on a bar) with sprokets and a belt thats going to bring the ball up like a elevator.

We want to have the wheels able to go both ways and the belt only one way.

I am not so fluent with Labveiw lingo. Also, we are going to need to apply a button for the pneumatics, activating it for the catapult.

Please, and, Thank You!

Alan Anderson 01-02-2012 23:12

Re: Joystick Buttons to Control Jaguars
 
I think you need to be a little more detailed about exactly what you want. Do you want one motor to move "forward" as long as a button is pressed, and stop when you release the button? Do you want one button to start the motor going "forward", and another to start it going "backward", with the motor continuing to run while the buttons are released? Do you want a button on the second joystick to act exactly the same way as one of the buttons on the first joystick?

Controlling motors using joystick buttons is pretty simple, as long as you can define what it is that should happen each time a button is pressed or released.

chall3613 02-02-2012 14:15

Re: Joystick Buttons to Control Jaguars
 
Yes. I want them to stop when the buttons are released. i want one motor to move one way with a touch of the trigger.
Then another motor to go forward and back with the buttons #2 and #3 on the opposite joystick. Because, I want to save that trigger for the neumatics.

Alan Anderson 02-02-2012 15:03

Re: Joystick Buttons to Control Jaguars
 
1 Attachment(s)
For an application like this, some people would suggest Case blocks, but I prefer using Select functions. They switch between one of two input values based on a boolean input. The cascaded Select for the Wheels motor will output 1 whenever Button 2 is pressed, -1 when Button 2 is not pressed and Button 3 is, and 0 when neither button is pressed. Change the constants to make the motors run at something less than full speed.

chall3613 02-02-2012 15:15

Re: Joystick Buttons to Control Jaguars
 
:ahh: Holy cow. Thank you. But my numeric constants keep changing to blue when I change the numer from 0 to 1 or -1. Is that normal in the 2012 version?

Also...What do I put in the Begin.vi so it doesn't confuse the other open 4 motor with these two?

Alan Anderson 02-02-2012 15:33

Re: Joystick Buttons to Control Jaguars
 
If you place a standalone numeric constant and make it an integer, it will be blue. The constants in the snippet I posted were made as the very last step of creating the code, by right-clicking the Select function's input terminal and choosing Create Constant from the popup menu. Doing that makes them match the numeric representation of what they're being wired to. In this case, that's orange for floating point.

For these, you want to open a Motor, not a Drive. That's a couple of levels deeper in the function palette:

WPI Robotics Library -> RobotDrive -> Advanced -> Motor Control

chall3613 02-02-2012 16:05

Re: Joystick Buttons to Control Jaguars
 
oh no...i just tried building the program and it said the vi was broken.

Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference:

Error 1003 occurred at AB_Targetfile.lvclass:Open_Top_Level_VIs.vi -> AB_Build.lvclass:Build.vi -> AB_Application.lvclass:Build.vi -> AB_RTEXE.lvclass:Build.vi -> AB_Engine_Build.vi -> AB_Build_Invoke.vi -> AB_Build_Invoke.vi.ProxyCaller

Possible reason(s):

LabVIEW: The VI is not executable. Most likely the VI is broken or one of its subVIs cannot be located. Select File>>Open to open the VI and then verify that you are able to run it.

Alan Anderson 02-02-2012 16:41

Re: Joystick Buttons to Control Jaguars
 
Quote:

Originally Posted by chall3613 (Post 1118630)
oh no...i just tried building the program and it said the vi was broken.

Open the vi and click the broken run arrow at the top of the window. You'll be able to see a list of the errors. Double-click an error and you'll be taken to the spot with the problem.

chall3613 03-02-2012 13:58

Re: Joystick Buttons to Control Jaguars
 
It says both the MotorControlRefNumSet and Get dont have the correct wireing.

"The designer of this subVI has specified that this terminal must be wired. Show the Context Help window to see what the required connections should be."

Alan Anderson 03-02-2012 17:41

Re: Joystick Buttons to Control Jaguars
 
So do what it says. What required connections did you leave unwired?

Did you know that the picture I posted isn't just a screen capture? It's actual LabVIEW code. You can save the attachment as a .png file, then just drag the file into your Teleop vi using Windows.

chall3613 04-02-2012 10:16

Re: Joystick Buttons to Control Jaguars
 
Thank you very much I was just missing the refnum name. Thank you for all the help.

I really do apreciate it. Ill let you know how the test drive ends up.

Have a good day!

tmohall 17-02-2012 11:30

Re: Joystick Buttons to Control Jaguars
 
Quote:

Originally Posted by Alan Anderson (Post 1118580)
For an application like this, some people would suggest Case blocks, but I prefer using Select functions. They switch between one of two input values based on a boolean input. The cascaded Select for the Wheels motor will output 1 whenever Button 2 is pressed, -1 when Button 2 is not pressed and Button 3 is, and 0 when neither button is pressed. Change the constants to make the motors run at something less than full speed.

I tried building the code but it didnt work and we have an arm and we want the one of the buttons to pick up the ball, shot the ball, and load it so we can shot the ball

Caleb Roberts 10-03-2012 14:20

Re: Joystick Buttons to Control Jaguars
 
1 Attachment(s)
We want to drive with our joystick, but we also want to operate additional motors with buttons on the joystick. I found an example for getting a motor to work from a button. But now nothing works. We are stuck. Can someone help us out.

Alan Anderson 11-03-2012 11:14

Re: Joystick Buttons to Control Jaguars
 
Quote:

Originally Posted by Caleb Roberts (Post 1141727)
I found an example for getting a motor to work from a button.

Where did you find that example? There are specific instructions in the LabVIEW tutorials for integrating examples into team robot code, and what you posted isn't in a form that will work in the Teleop vi. It also seems to have things in there twice. You're showing only the False case of a case structure hardwired with a True input, so the part that would run isn't visible. I suggest that you forget that example entirely and try reading the earlier posts in the thread (and in other threads asking the same thing). If you don't understand the code shown then ask specific questions.


All times are GMT -5. The time now is 11:42.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi