![]() |
Logitech Controller Programming
My team does not have any Attack3 controllers for some reason, due to them getting lost. We did find and alternative as the Logitech controller for the FTC competitions. The issues are that the whole controller takes only one Joystick slot and I wanted to know if the there is code to separate the two joysticks on the controller for Tank Drive. And as a side question: Can you use XBOX or PS3 controllers for any movement.
Thanks in advanced! |
Re: Logitech Controller Programming
As for the logitech controllers: Yes, there is code to separate the joysticks. However, you simply treat the whole controller as a single Joystick object.
Example: Joystick logitechController = new Joystick(1); //Read the y axis on the left joystick logitechController.getRawAxis(leftYAxis); //<-- Experiment to find the exact //axis value //Read the y axis on the right joystick logitechController.getRawAxis(rightYAxis); // <-- find the right axis number You'll have to experiment a bit to find the correct axis numbers to make it work properly, and possibly invert the outputs (sometimes down is positive), but each joystick is really just two independent axis' on the same "joystick" controller. |
Re: Logitech Controller Programming
I have a convenient class for you.
Created after some extensive testing: https://github.com/FRCTeam4069/Robot...ontroller.java |
Re: Logitech Controller Programming
Also, you should be able to use any USB controller. Last year we used an XBOX controller. We just had to install a driver from the xbox/microsoft website.
|
Re: Logitech Controller Programming
We are using the logitech F310.
left Y axis is Axis 2, right Y axis is Axis 5 Code:
Joystick joy1 = new Joystick(1); // create a joystick on USB port 1 (configured through driverstation) |
Re: Logitech Controller Programming
You could also make all the axis and buttons contants, so it's easier for everyone to know what axis/button you're calling.
Just add this to either the same file, or an interface: Code:
// Gamepad axisSo if those are in an interface and you implement it, this is how you can call it: Code:
joy1.getRawAxis(kGamepadAxisLeftStickY); |
Re: Logitech Controller Programming
Thank you very much for the replies! We may end up buying Joysticks, but in the meantime, this may help us test out bot.
Thank you very much for your detail and input! |
Re: Logitech Controller Programming
We were able to get to the right joystick on the controller by using
GetZ() for the X axis of the right stick and GetTwist() for the Y axis of the right stick. Hope this helps! |
Re: Logitech Controller Programming
Team 2185 is also looking forward at using the F310 controllers. But we are using labview. Could u help me in the lanugage of labview:eek:
|
Re: Logitech Controller Programming
Quote:
|
| All times are GMT -5. The time now is 09:13. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi