So, my team is trying to use the Xbox 360 controller over the provided joysticks for running our robot.
The left joystick is used for our drive motors, both x and y.
We would like to use the “A” button digitally to toggle on/off another motor for collecting balls off of the ground. However, I have no clue how to do this, and really need help.
Another problem is programming the right stick on the controller to control a window motor as an analog value.
The only “preset” programming that works with LabVIEW is the left stick, and I would love to know how to add more variety using A, B, X, Y, and the right stick.
I’m using a logitech f510 and the button layout may be very similar (windows installed the xbox driver for it) although I can’t confirm.
I suggest that to make sure you create a vi that with indicators for the joystick get axes and buttons and then map it yourself. http://i39.tinypic.com/2123j6.jpg
Once windows finishes installing drivers, plug the controller into the driver station and take a look at the joystick VI. Click on the two axis that are selected by default and change them to 1,2 for the left stick and 4,5 for the right stick (I think, I can’t quite recall, but play with it a bit). Also, you might want to take a look at the “button latch” example that comes with labview to see how NI recommends you to make buttons act as latches.
The layout CLRS97 shows is not what we got for our xBox controller. The approach of using the joystick.vi to test your actual controller is what we did. That way you know for sure what your computer and controller are registering.
On the subject of the toggle, that is a little more complex. First, you’ll need a rising edge trigger, so that the toggle doesn’t get called multiple times in rapid succession. Then you’ll need to send that value into the future, a shift register or something. Last, run both into an exclusive or. This is how you would do it (see attached).
How do we find this out, what VI are you using and how can we get it to test the outputs. I assume someone can use both joysticks on the Xbox controller right? If someone could also tell us how to get this information in a vi that would be great as we also want to use both joysticks on the controller one to drive arcade style and one to control a window motor attached to a jaguar. Is that possible. Thanks a ton in advance.
I don’t know if the WPILibrary has a FluxCapacitor.vi in it.
A better choice of wording is that a Shift Register (or Global Variables or Local Variables) can be used to store data that can be used the next time the loop is ran.
as for polling the values from the joystick, just probe the cluster coming off of the joystick get while the robot is running and move the joysticks around. It will quickly become apparent what axis is what.
You should know that the POV hat is read as a joystick. You might want this to help with that (see attachment).
Run the Robot Main vi. Open Teleop and probe the Axes and Buttons outputs from the Joystick Get while the robot is enabled. You will see the results in the probe window.
A way you could tell what buttons are which in LabVIEW is to open the joystick and get button and axis information using the “Open” and “Get” VI’s in the WPI robotics library. You can connect an “unbundle by name” block from the cluster palette to get the button/axis info after you get the info from “Get” VI. Then you can hook up some booleans to the info to see button info. And as for joystick info, you can create a boolean light, then on the block diagram, right click, “create”, “property node”, “position”, then “left”, and “top”. Right click those nodes, and click “change to write” so the joysticks can control their position on the front panel (you might need a scalar to make the joysticks less sensitive). Although, your right joystick should be able to get the motor to work… (Hope this helped).
this is my first time programming a xbox 360 controller can any one help me on figuring out what to put in the begin vi and the telop vi so i can use the controllers left joystick as the front and back and the right joystick as the left and right motion
Look back a couple of posts (and a couple of years) for a suggestion on how to determine which controls appear on which axes of the Joystick Get function.
Axis 1: Left Thumbstick Left-Right
Axis 4: Right Thumbstick Left-Right
Axis 2: Left Thumb Stick Up-Down(Needs to be negated or else up-down controls are inverted)
Axis 5: Right Thumb Stick Up-Down(Needs to be negated or else up-down controls are inverted)
Axis 3(>0): Left Trigger
Axis 3(<0): Right Trigger
1: A Button
2: B Button
3: X Button
4: Y Button
5: Left Bumper
6: Right Bumper
7: Stop/Back Button
8: Start Button
9: Left Thumbstick Button
10: Right Thumbstick Button
DPAD:
-1: No Thumbpad Button
0: North Thumbpad Button
45: North-East Thumbpad Button
90: East Thumbpad Button
135: South-East Thumbpad Button
180: South Thumbpad Button
225: South-West Thumbpad Button
270: West Thumbpad Button
315: North-West Thumbpad Button