Go to Post You know, I love the fact that FIRST has always got your back. :D - Beth Sweet [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-03-2014, 21:00
DarthCoder DarthCoder is offline
Registered User
FRC #4309
 
Join Date: Aug 2012
Location: Washington
Posts: 37
DarthCoder is an unknown quantity at this point
Get joystick name and index in wpilib C++

Hi, we're trying to figure out how to access the joystick name, or some sort of hardware identifier in wpilib from C++. Basically, we want to be able to tell the difference between the logitech joystick, and the Xbox 360 controller when the robot initializes. We plan to convert a joystick into a switch box to store settings for autonomous mode each match, and we don't want to have to check the stick indices every time. Is there any way to get an identifier to tell which stick is shown as which index?

Also, I'm not incorrect in interpreting the rules as meaning that a box of switches set before the match during strategy talks would be fine to use because no human is touching the driver station or moving beyond the white line during autonomous mode am I?
  #2   Spotlight this post!  
Unread 08-03-2014, 21:22
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 989
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Get joystick name and index in wpilib C++

Quote:
Originally Posted by DarthCoder View Post
Is there any way to get an identifier to tell which stick is shown as which index?
Unless you can find a unique value to key off of (The throttle on the joystick may be an option here) there is no great way to do this. The best bet may be to use the throttle on the logitech joystick to identify it. Secure it all the way down with tape and then look for that value.

EDIT: Just re-read and realized you're talking about harvesting the joystick internals for a custom device. The same thought applies, just tie one of the axes to 0 or 5V (or whatever the max voltage on the internal pots is) and key off of that.

Quote:
Also, I'm not incorrect in interpreting the rules as meaning that a box of switches set before the match during strategy talks would be fine to use because no human is touching the driver station or moving beyond the white line during autonomous mode am I?
Nope, lots of teams use this type of technique to select autonomous modes.
  #3   Spotlight this post!  
Unread 09-03-2014, 08:59
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,751
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: Get joystick name and index in wpilib C++

Just to confirm. No information about the Vendor or Model of the joystick is ever sent to the robot. The DS displays it, but it is not part of the protocol. If your team plugs the joysticks into the same ports each time, I'd expect that you do not need to redo the ordering. Have you seen different?

To cut through the inverted inversions of the sentence. Joystick and I/O settings are sent to the robot during disabled mode and are latched during auto. A custom control box, with switches and pots is often used. If the I/O is not connected and the I/O is configured for Compatible mode, you can also make the settings directly onscreen. The Boolean and sliders can be named and their names and settings are stored to the ini file.

Greg McKaskle
  #4   Spotlight this post!  
Unread 09-03-2014, 13:20
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Get joystick name and index in wpilib C++

Quote:
Originally Posted by DarthCoder View Post
Hi, we're trying to figure out how to access the joystick name, or some sort of hardware identifier in wpilib from C++. Basically, we want to be able to tell the difference between the logitech joystick, and the Xbox 360 controller when the robot initializes. We plan to convert a joystick into a switch box to store settings for autonomous mode each match, and we don't want to have to check the stick indices every time. Is there any way to get an identifier to tell which stick is shown as which index?
I have wanted to do the same thing. It's not using WPIlib but the way I came up with was to have a seperate program running on the driver station that asked Windows what the joysticks were and then sent this to the robot seperately from the control data.

It turned out that it's not hard to write a program on the PC to query the joystick information but we never got around to putting together the pieces to send it to the robot because we ended up only using one joystick.
Closed Thread


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 02:33.

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