Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Ps3/360 controller with robot programmed in Java (http://www.chiefdelphi.com/forums/showthread.php?t=90439)

americandevilz 01-29-2011 04:19 PM

Ps3/360 controller with robot programmed in Java
 
Hi all,

We're interested in knowing how our team could drive our robot using a Ps3 controller/Xbox 360 controller. We are programming our robot in Java. Can anyone help us out? Thanks.

sjspry 01-29-2011 05:32 PM

Re: Ps3/360 controller with robot programmed in Java
 
The driver station should see it as a Joystick. Install any drivers you would normally need (google for them), and then the controller should have its hats (the sticks) enumerated as axes and buttons numbered.

Patrick Chiang 01-29-2011 08:55 PM

Re: Ps3/360 controller with robot programmed in Java
 
If you're having problems figuring out which axis/buttons on the controllers are which, go to Control Panel > Game Controllers.

Then, you select the game controller and click properties. Now, you can calibrate your device and see which axes is which number, and which button is which.

Hint: Look at the documentation for the Joystick class for more information on how to read Joystick inputs.

architek501 01-30-2011 03:00 PM

Re: Ps3/360 controller with robot programmed in Java
 
Quote:

Originally Posted by Patrick Chiang (Post 1011390)
If you're having problems figuring out which axis/buttons on the controllers are which, go to Control Panel > Game Controllers.

Then, you select the game controller and click properties. Now, you can calibrate your device and see which axes is which number, and which button is which.

Hint: Look at the documentation for the Joystick class for more information on how to read Joystick inputs.

My edits are getting a bit excessive, sorry. I'm in a situation similar to OP's, and I wanted to get the D-Pad working properly.

I thought I had found the solution to my problem. I just need to find out what the "Point of View Hat" (The D-Pad) is according to the WPI Libraries.

I know that Left-Right movement is read as Axis 6, but Up-Down movement is either not recognized by the Joystick class (being an axis higher than 6), or something else that I'm not thinking of.

Robototes2412 01-30-2011 06:13 PM

Re: Ps3/360 controller with robot programmed in Java
 
it only has six axes

architek501 01-30-2011 06:23 PM

Re: Ps3/360 controller with robot programmed in Java
 
Quote:

Originally Posted by Robototes2412 (Post 1011924)
it only has six axes

One would think... but I actually found 7.

Left Analog Up/Down (Axis 2)
Left Analog Left/Right (Axis 1)
Right Analog Up/Down (Axis 5)
Right Analog Left/Right (Axis 4)
D-Pad Up/Down (Axis 7?)
D-Pad Left/Right (Axis 6)
Left/Right Triggers (yes, for some reason, these form their own set of axes, where pressing the left trigger outputs a positive value, and pressing the right trigger outputs a negative value) (Axis 3)

ProgrammerMatt 01-31-2011 10:55 AM

Re: Ps3/360 controller with robot programmed in Java
 
If you would like to use a PS/3 controller you need a program called motionjoy to use its full funtionality. Our team is using a PS/3 controller with its 7 axis capibilities its very stable and easy to use.

Programmer Matt
Gus Robotics, team228.org

ProgrammerMatt 01-31-2011 10:57 AM

Re: Ps3/360 controller with robot programmed in Java
 
Quote:

Originally Posted by architek501 (Post 1011929)
One would think... but I actually found 7.

Left Analog Up/Down (Axis 2)
Left Analog Left/Right (Axis 1)
Right Analog Up/Down (Axis 5)
Right Analog Left/Right (Axis 4)
D-Pad Up/Down (Axis 7?)
D-Pad Left/Right (Axis 6)
Left/Right Triggers (yes, for some reason, these form their own set of axes, where pressing the left trigger outputs a positive value, and pressing the right trigger outputs a negative value) (Axis 3)

Sorry but the D-Pad is not an axis the 7 axis's are
Left Right joysticks would be 4
tilt foward back side side would be 2
and the variable triggers is 1

Programmer Matt,
Gus Robotics, team228.org

architek501 01-31-2011 06:22 PM

Re: Ps3/360 controller with robot programmed in Java
 
Quote:

Originally Posted by ProgrammerMatt (Post 1012388)
S
tilt foward back side side would be 2

If I were using a PS3 controller, that would definitely be the case.

Code:

    public static int getDPad1( )
    {
        return 6;
    }

This is a snippet of code I'm using in a config file that is imported into our main robot code, referenced here:

Code:

if ( opControl.getRawAxis( ControllerConfig.getDPad1( ) ) >= 0.03 )
            {
                System.out.println( "This is Axis #6." );
            }

In this case, when the robot is running in teleoperated mode, and the D-Pad is pressed to the right, it prints "This is Axis #6." This is placeholder code, but it's apparent that if I try to create and call a 7th axis, it won't work. I just want to know if there's some sort of workaround so I can use the Up-Down axis of the D-Pad.


All times are GMT -5. The time now is 08:18 AM.

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