Go to Post It is proper to have a disagreement, but it is improper to be disrespectful. - Bill Moore [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 11-03-2012, 14:12
EdenKlingenberg EdenKlingenberg is offline
Team 2344 Alumni/Robotics Junkie
FRC #3985
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2008
Location: Montreal
Posts: 3
EdenKlingenberg is an unknown quantity at this point
Adding third joystick and button controls

Hey everybody,

I was just hoping somebody could help me out with some programming things. None of the students have taken to programming (they're a first year team as well) and my limited experience with it has proven insufficient.

We would like to add a third joystick into our program. On this joystick, we plan to only use the buttons. We want a button to run our shooter motor at full speed when it's pressed, and to stop running when the button is released. We would also like a button for running our pick up motor full speed, and for the motor to stop when the button is released. Lastly, we would like to have two buttons to move our motor driven ramp mechanism forwards and backwards in the same fashion).

Any help would be greatly appreciated. Thank you.
__________________
2008-2010: Saunders Droid Factory, Team 2344
2012: Mentor for teams 3983, 3985, 3531
2013: Mentor for team 3985 Sonic Howl
Reply With Quote
  #2   Spotlight this post!  
Unread 11-03-2012, 15:08
Sconrad Sconrad is offline
Registered User
AKA: Connor Young
FRC #0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Yorktown
Posts: 40
Sconrad is an unknown quantity at this point
Re: Adding third joystick and button controls

As far as using another joystick in the code, it is as simple as repeating the process you used with the first two joysticks (Open, SetRefNum in Begin.vi, getRefNum in Teleop.vi, getRefNum and Close in Finish.vi)

In order to get the button values, use the Joystick Get vi. One of the outputs is a cluster of booleans labeled buttons. In order to actually use the data inside the cluster, go to Programming->Cluster,Class->Unbundle By Name.vi.

To set the motors, you must Open them and set their refnum in Begin and the get the refnum in Teleop, similar to the joystick. to set speed, go to WPI Robotics -> Actuators -> Motor Control -> Set Speed vi. Passing the boolean values from the buttons is done by transferring the true/false boolean to a 1/0 integer value. There is a vi to do this in the Programming -> Boolean Pallette. In order to make the motors run in the correct direction, you may have to negate one or more of the values using the Negate vi found in Programming -> Numeric. If the motors run faster too fast for what you need them to do, you may wish to scale them by multiplying the integer value by a number less than 1 (.5 will run at 50% power, .75 at 75%, etc.). As a note, this method will cause the motors to run at the set speed as long as the button is pressed and to not move otherwise.

Hope this helps!
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 08:44.

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