Go to Post Super Bowl, P-Diddy, Diet Pepsi. Super Bowl of Smarts, Dave Lavery, Diet Coke. - Gary Dillard [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-02-2015, 09:46
pastelpony's Avatar
pastelpony pastelpony is offline
Programmer/Electrical
AKA: Zach M
FRC #3525 (Nuts and Bolts of Fury)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Waterbury, Connecticut
Posts: 152
pastelpony will become famous soon enough
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?
__________________
Team 3525 Head Programmer (2014- ) - Java (Formerly LabVIEW)
Reply With Quote
  #2   Spotlight this post!  
Unread 03-02-2015, 11:18
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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.)
Reply With Quote
  #3   Spotlight this post!  
Unread 03-02-2015, 11:58
pastelpony's Avatar
pastelpony pastelpony is offline
Programmer/Electrical
AKA: Zach M
FRC #3525 (Nuts and Bolts of Fury)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Waterbury, Connecticut
Posts: 152
pastelpony will become famous soon enough
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.
__________________
Team 3525 Head Programmer (2014- ) - Java (Formerly LabVIEW)
Reply With Quote
  #4   Spotlight this post!  
Unread 03-02-2015, 12:04
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Operating a relay/motor controller with two axises/buttons

Quote:
Originally Posted by pastelpony View Post
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.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2015, 12:56
pastelpony's Avatar
pastelpony pastelpony is offline
Programmer/Electrical
AKA: Zach M
FRC #3525 (Nuts and Bolts of Fury)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Waterbury, Connecticut
Posts: 152
pastelpony will become famous soon enough
Re: Operating a relay/motor controller with two axises/buttons

Iirc the gamepad calibration says axis 3 is negative whilsr LabVIEW returns positive. Strange.
__________________
Team 3525 Head Programmer (2014- ) - Java (Formerly LabVIEW)
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2015, 13:20
pastelpony's Avatar
pastelpony pastelpony is offline
Programmer/Electrical
AKA: Zach M
FRC #3525 (Nuts and Bolts of Fury)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Waterbury, Connecticut
Posts: 152
pastelpony will become famous soon enough
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.
__________________
Team 3525 Head Programmer (2014- ) - Java (Formerly LabVIEW)

Last edited by pastelpony : 03-02-2015 at 13:24.
Reply With Quote
  #7   Spotlight this post!  
Unread 03-02-2015, 18:37
orangeandblack5 orangeandblack5 is offline
Hates LabView - Uses It Anyway
AKA: Ian Stewart
FRC #5498 (Wired Devils)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Grosse Ile, MI
Posts: 15
orangeandblack5 will become famous soon enough
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.)
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2015, 06:16
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:28.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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