Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   How do I code for a more complex joystick? (http://www.chiefdelphi.com/forums/showthread.php?t=100339)

CardcaptorRLH85 16-01-2012 03:01

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.

EricVanWyk 16-01-2012 03:13

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?

CardcaptorRLH85 16-01-2012 03:39

Re: How do I code for a more complex joystick?
 
Quote:

Originally Posted by EricVanWyk (Post 1106647)
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 ^_^

enrique 16-01-2012 14:57

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? :D

CardcaptorRLH85 16-01-2012 15:41

Re: How do I code for a more complex joystick?
 
Quote:

Originally Posted by enrique (Post 1106995)
Hmm, haven't encountered that. On another note, would you like to get the rumble to rumble? :D

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 ^_^

enrique 16-01-2012 17:48

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.

CardcaptorRLH85 16-01-2012 18:02

Re: How do I code for a more complex joystick?
 
Quote:

Originally Posted by enrique (Post 1107100)
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.

enrique 16-01-2012 18:23

Re: How do I code for a more complex joystick?
 
Quote:

Originally Posted by CardcaptorRLH85 (Post 1107108)
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.

enrique 16-01-2012 23:59

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.

CardcaptorRLH85 17-01-2012 00:37

Re: How do I code for a more complex joystick?
 
Quote:

Originally Posted by enrique (Post 1107457)
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.


All times are GMT -5. The time now is 17:34.

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