|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Operating a relay/motor controller with two axises/buttons
It appears that the trigger buttons on the Xbox 360 controller are now two different axises according to LabVIEW. I need the triggers to run a motor in reverse and forward, though I cannot get them to work. I have thought about using a global variable for this, though I do not have a robot near me ATM. How would I go about this?
|
|
#2
|
|||||
|
|||||
|
Re: Operating a relay/motor controller with two axises/buttons
Subtract the left "trigger" axis value from the right one. That should give you a result that you can wire into the motor set.
(This assumes both triggers give a value from 0 to 1. If the left axis is actually a negative value, just add them instead of subtracting.) |
|
#3
|
||||
|
||||
|
Re: Operating a relay/motor controller with two axises/buttons
I'm assuming the trigger gives a negative value, so I'll add. Thank you for your input. I'll try it as soon as I can access a robot.
|
|
#4
|
|||||
|
|||||
|
Re: Operating a relay/motor controller with two axises/buttons
Both triggers return 0-1, positive values on axis 2 & axis 3.
|
|
#5
|
||||
|
||||
|
Re: Operating a relay/motor controller with two axises/buttons
Iirc the gamepad calibration says axis 3 is negative whilsr LabVIEW returns positive. Strange.
|
|
#6
|
||||
|
||||
|
Re: Operating a relay/motor controller with two axises/buttons
I'm going to try another solution in addition to the axises. Some people want buttons, others want axises. I just need to be able to do both in order to make everyone happy. Thanks, though!
I'm going to try and use buttons with a NOR gate to see if it works. The buttons would activate the appropriate global variable (reverse, forward, etc) and the NOR gate will change the global variable to a stop position if neither button is pressed. I'll see if it works. Last edited by pastelpony : 03-02-2015 at 13:24. |
|
#7
|
|||
|
|||
|
Re: Operating a relay/motor controller with two axises/buttons
Take the left trigger axis value and multiply it by -1.
Add it to the right trigger value. Voilą! (If you need to, you can change which side you multiply by -1.) |
|
#8
|
|||
|
|||
|
Re: Operating a relay/motor controller with two axises/buttons
There are differences in joystick axis values depending on how they are read. Specifically, Xbox controllers can be read using DirectInput libraries, and that is how it was done until this year. They can also be read using XInput libraries, and that is the more modern way that was adopted this year.
The driver station should give you an accurate way to predict the values that the joystick will return on your robot. Also some joysticks are configurable as to whether they enumerate as DirectInput or XInput. The Logitech F310 has a switch on the back that lets you choose. The primary difference of this choice is how the analog shoulder triggers are reported. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|