Go to Post Remember, let function drive design, not the other way around. - Tom Bottiglieri [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 02-02-2012, 15:03
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Joystick Buttons to Control Jaguars

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.
Attached Thumbnails
Click image for larger version

Name:	buttons and motors.png
Views:	209
Size:	24.7 KB
ID:	11683  
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2012, 15:15
chall3613 chall3613 is offline
Registered User
AKA: Candace
FRC #3613 (Team Wolf Pack)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: New York
Posts: 28
chall3613 is an unknown quantity at this point
Re: Joystick Buttons to Control Jaguars

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?

Last edited by chall3613 : 02-02-2012 at 15:25.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2012, 15:33
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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

Last edited by Alan Anderson : 02-02-2012 at 15:35.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2012, 16:05
chall3613 chall3613 is offline
Registered User
AKA: Candace
FRC #3613 (Team Wolf Pack)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: New York
Posts: 28
chall3613 is an unknown quantity at this point
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.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2012, 16:41
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Joystick Buttons to Control Jaguars

Quote:
Originally Posted by chall3613 View Post
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2012, 13:58
chall3613 chall3613 is offline
Registered User
AKA: Candace
FRC #3613 (Team Wolf Pack)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: New York
Posts: 28
chall3613 is an unknown quantity at this point
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."
Reply With Quote
  #7   Spotlight this post!  
Unread 03-02-2012, 17:41
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2012, 10:16
chall3613 chall3613 is offline
Registered User
AKA: Candace
FRC #3613 (Team Wolf Pack)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: New York
Posts: 28
chall3613 is an unknown quantity at this point
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!
Reply With Quote
  #9   Spotlight this post!  
Unread 17-02-2012, 11:30
tmohall tmohall is offline
Registered User
AKA: Trevon Hall
FRC #3963 (urbanRobots)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Milwaukee, WI
Posts: 3
tmohall is an unknown quantity at this point
Send a message via MSN to tmohall
Re: Joystick Buttons to Control Jaguars

Quote:
Originally Posted by Alan Anderson View Post
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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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