Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Operating a relay/motor controller with two axises/buttons (http://www.chiefdelphi.com/forums/showthread.php?t=133902)

pastelpony 03-02-2015 09:46

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?

Alan Anderson 03-02-2015 11:18

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.)

pastelpony 03-02-2015 11:58

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.

Mark McLeod 03-02-2015 12:04

Re: Operating a relay/motor controller with two axises/buttons
 
Quote:

Originally Posted by pastelpony (Post 1437659)
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.

Both triggers return 0-1, positive values on axis 2 & axis 3.

pastelpony 03-02-2015 12:56

Re: Operating a relay/motor controller with two axises/buttons
 
Iirc the gamepad calibration says axis 3 is negative whilsr LabVIEW returns positive. Strange.

pastelpony 03-02-2015 13:20

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.

orangeandblack5 03-02-2015 18:37

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.)

Greg McKaskle 04-02-2015 06:16

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


All times are GMT -5. The time now is 10:24.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi