We (team 3175) have been testing the use of an Xbox 360 controller to control our arm and have found issues with the trigger buttons. When using the trigger buttons to control a window motor, we find that our program is reading axis z-axis values that do not correspond to how we are pressing the trigger buttons.
In one case, we let go of the trigger buttons and the value sent to the TeleOp.vi was 1. However, when looking at the controller through the control panel while running the program, it shows that the z-axis is in a neutral position.
Why is this happening? Is this a fault of the controller’s hardware, the programming (which I have attached to this thread), or something else? We’d really appreciate some answers.
You don’t show what is in the other case frame, so I can’t be sure whether you stop the motor or leave it running.
You also don’t really describe what the buttons are supposed to do to the motor.
What I’d suggest is to put some joystick code into your disabled routine. If using LV, just drop the Joystick get into disabled and you can open it to see the values at runtime. Otherwise add some printfs or use some debugging features of the IDE to observe the joystick values while disabled.
Once you can run the robot, leave it disabled, and see what the XBox controller is sending. If that looks correct, the issue is with the code or possibly the HW.
With a programming buddy, think through what commands are being sent to the motor with different inputs. For example. If the last command told the motor to spin, and releasing the button is supposed to make it stop, show them the code that sets the speed to zero. If you can’t find the code, you have found a problem.
As far as I know, the XNA driver for the Xbox 360 controller (the one that Windows uses) has the two controllers input as one axis. The Xbox controller outputs five axes, two for each stick and one that is the combined triggers. i believe that it returns 0 for neither trigger pulled and each trigger adds or subtracts one from this value when pulled (i.e. you pull both triggers and the value is still 0).