View Single Post
  #2   Spotlight this post!  
Unread 22-09-2011, 01:16
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: HOw to create a program in labview for ps3 controller

Long Answer:

Before you test anything relating to FRC, you have to make sure your C-RIO and things are set up. If you don't have that already done, some great resources are in usfirst.org/frc/kitofparts If you just want to figure out how to manage the ps3 controller, then all you really need is the C-RIO (properly imaged, etc), a programming laptop, and the Driver Station (classmate 2go PC). Of course, in order to get the C-RIO running, you'll need power as well.

Now, actually reading the values of the PS3 controller is pretty simple. Go to robot main, then into periodic tasks. Make a while loop in there, with a false constant on the "stop" block. Also, add a wait (ms) block in it (under Porgramming -> Timing) with a wait of 100 ms. Then, in the functions palette, go to WPI Robotics Library, DriverStation, Joystick, then grab a Joystick Get function. Move your mouse over the top left corner (over JoystickDevRef) until you get the "thread"/"wire" mouse, right click, and select create -> constant. Do the same with the Axes and Buttons wires, except create an indicator.

Now go to robot main and run the program. Once it's done downloading, open up the front panel of periodic tasks and you should see all the buttons and axes there. Plug in your PS3 controller and try moving the joysticks around and pressing the buttons. The values on the front panel should change with the joysticks. Note that the buttons might be listed as axes as well, since I have heard that they're analog (they have force gauges in them).

Once you've tried it out and such, it may be a better programming practice to use the joystick Open, registry set, and registry get, but I haven't found a use for them in this case (they're very important for motors and such though!)

Short Answer:
They act like joysticks, so use those vis.
Reply With Quote