Go to Post Stratagy drives design, not features. - Wetzel [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 16-01-2012, 03:01
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
How do I code for a more complex joystick?

Our team is using two Logitech Gamepad F310's for our drivers station this year. We did use one last year and I think that I instantiated it correctly then however, on occasion I had strange errors concerning which axis did what. I'm simply asking if there's a better way than

Code:
m_driveStick = new Joystick(1, 5, 8)
/*
 * Where 1 is the USB port number, 5 is the number of axes, 
 * and 8 is the number of buttons.
*/
to create this Joystick object.

Also, as far as I can tell, the left and right triggers on this controller are simply + and - on the same axis.

For some reason this way just seems...overly complex but I can't seem to come up with a method to simplify it that doesn't appear to add other unnecessary complexity.
__________________

Reply With Quote
  #2   Spotlight this post!  
Unread 16-01-2012, 03:13
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: How do I code for a more complex joystick?

I think that that game controller has a switch underneath that changes the way the triggers are mapped. Does switching it help?
Reply With Quote
  #3   Spotlight this post!  
Unread 16-01-2012, 03:39
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
Re: How do I code for a more complex joystick?

Quote:
Originally Posted by EricVanWyk View Post
I think that that game controller has a switch underneath that changes the way the triggers are mapped. Does switching it help?
I'll have to check when I get my hands on it again tomorrow but I think that will explain our mysterious 'axes changing their indexing' issues. I had forgotten about that switch since the Logitech RumblePad 2 that I own and tend to use for at home testing doesn't have one. Thanks ^_^
__________________

Reply With Quote
  #4   Spotlight this post!  
Unread 16-01-2012, 14:57
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Lightbulb Re: How do I code for a more complex joystick?

Hmm, haven't encountered that. On another note, would you like to get the rumble to rumble?
Reply With Quote
  #5   Spotlight this post!  
Unread 16-01-2012, 15:41
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
Re: How do I code for a more complex joystick?

Quote:
Originally Posted by enrique View Post
Hmm, haven't encountered that. On another note, would you like to get the rumble to rumble?
Actually, yes I would. Since our team doesn't use controllers with vibration functions, it's been on the back burner but I would like to try it out for my testing controller ^_^
__________________


Last edited by CardcaptorRLH85 : 16-01-2012 at 15:41. Reason: I hit submit too quickly....
Reply With Quote
  #6   Spotlight this post!  
Unread 16-01-2012, 17:48
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Smile Re: How do I code for a more complex joystick?

I did the code back in 2010 and haven't touched it since. Let me test it then I'll send it over. It uses the output from the gyro, but I was thinking of using it this year with a piezio vibration sensor I saw online. I'll get back to you.
Reply With Quote
  #7   Spotlight this post!  
Unread 16-01-2012, 18:02
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
Re: How do I code for a more complex joystick?

Quote:
Originally Posted by enrique View Post
I did the code back in 2010 and haven't touched it since. Let me test it then I'll send it over. It uses the output from the gyro, but I was thinking of using it this year with a piezio vibration sensor I saw online. I'll get back to you.
Thanks, I'm doing more coding this year than last since I'm adjusting our code to fit the new Command Based Robot template since it seems like it'll be easier to update in the future than my current code so I don't have as much time for the projects like the vibration controller.
__________________

Reply With Quote
  #8   Spotlight this post!  
Unread 16-01-2012, 18:23
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Re: How do I code for a more complex joystick?

Quote:
Originally Posted by CardcaptorRLH85 View Post
Thanks, I'm doing more coding this year than last since I'm adjusting our code to fit the new Command Based Robot template since it seems like it'll be easier to update in the future than my current code so I don't have as much time for the projects like the vibration controller.
Yea I hear you. I'm still contemplating if I'm doing that command stuff this year. Or during the summer while there is no gun to my head.
Reply With Quote
  #9   Spotlight this post!  
Unread 16-01-2012, 23:59
enrique's Avatar
enrique enrique is offline
Registered User
FRC #1251 (Tech Tigers)
Team Role: Electrical
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Florida
Posts: 87
enrique will become famous soon enough
Send a message via Yahoo to enrique
Post Re: How do I code for a more complex joystick?

Here try this.
http://www.techtigers.com/ResourceFi.../EngXInput.rar

From the robot code I was using this to send the angle of the gyro:
float angle = 0;
angle = (m_HeadingGyro.GetAngle());
m_TechTigerDashBoard.AddCluster();
m_TechTigerDashBoard.AddDouble(angle);
m_TechTigerDashBoard.FinalizeCluster();

you will receive the heading in the dashboard and I would multiply it by a very high number to in a sense make the gyro super sensitive and in essence using the gyro as a bump sensor and shaking the joystick.

I made several dlls that used directx and what not. If the EngXInput.dll does not work on your joystick let me know and I will send the other ones. But if I remember correctly, this one worked with most joysticks.
Reply With Quote
  #10   Spotlight this post!  
Unread 17-01-2012, 00:37
CardcaptorRLH85's Avatar
CardcaptorRLH85 CardcaptorRLH85 is offline
The master of the cards ^_^
AKA: Raa'Shaun H.
FRC #0322 (F.I.R.E. "Flint Inspires Real Engineers")
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Michigan, USA
Posts: 59
CardcaptorRLH85 is an unknown quantity at this point
Send a message via ICQ to CardcaptorRLH85 Send a message via AIM to CardcaptorRLH85 Send a message via MSN to CardcaptorRLH85 Send a message via Yahoo to CardcaptorRLH85
Re: How do I code for a more complex joystick?

Quote:
Originally Posted by enrique View Post
Here try this.
http://www.techtigers.com/ResourceFi.../EngXInput.rar

From the robot code I was using this to send the angle of the gyro:
float angle = 0;
angle = (m_HeadingGyro.GetAngle());
m_TechTigerDashBoard.AddCluster();
m_TechTigerDashBoard.AddDouble(angle);
m_TechTigerDashBoard.FinalizeCluster();

you will receive the heading in the dashboard and I would multiply it by a very high number to in a sense make the gyro super sensitive and in essence using the gyro as a bump sensor and shaking the joystick.

I made several dlls that used directx and what not. If the EngXInput.dll does not work on your joystick let me know and I will send the other ones. But if I remember correctly, this one worked with most joysticks.
Thanks, I'll try this out when I get a chance to test our robot later today.
__________________

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 03:00.

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