Log in

View Full Version : Joystick getThrottle() returns 0


Brian Selle
17-02-2012, 11:50
I'm having an issue getting the throttle position of the joystick. When I call the getThrottle() method on joystick the value is always 0 regardless of the throttle position. Below is the code I am using:

OI.getInstance().getDriverJoystick().getThrottle() ;
OI.getInstance().getDriverJoystick().getAxis(Joyst ick.AxisType.kThrottle);

When I make a call to get the stick x-axis position it works fine. Value is between -1 and 1.

OI.getInstance().getDriverJoystick().getAxis(Joyst ick.AxisType.kY);

Is there something I am missing here?

Joe Ross
17-02-2012, 12:55
What joystick are you using? Does the throttle show up on any of the 6 axes?

Brian Selle
17-02-2012, 15:11
It's the Logitech Attack 3.

Not sure what you mean by "the throttle show up on any of the 6 axes"...

In software I'm using the wpilibj Joystick class. Below are the default axes:


static final byte kDefaultXAxis = 1;
static final byte kDefaultYAxis = 2;
static final byte kDefaultZAxis = 3;
static final byte kDefaultTwistAxis = 3;
static final byte kDefaultThrottleAxis = 4;
static final int kDefaultTriggerButton = 1;
static final int kDefaultTopButton = 2;


Is the throttle a different axis on this controller?

Patrick Chiang
17-02-2012, 15:24
Well, I'm looking at our Logitech Attack 3, and I'm not seeing a throttle. You should just use getX, getY, and getZ.

This is what a joystick throttle looks like. (http://lib.store.yahoo.net/lib/directron/x5201.jpg)

Brian Selle
17-02-2012, 15:33
I figured it out... the throttle on the Logitech Attack 3 is axis 3 (defined as the twist axis in the wpilibj Joystick class).

Patrick: Not sure how to attach an image... but ours is a single stick "fighter jet" style controller different than your picture.

Thanks for the help!

Brian Selle
17-02-2012, 15:38
Picture of our Logitech Attack 3

http://www.logitech.com/gaming/joysticks/devices/302

Patrick Chiang
17-02-2012, 15:41
Glad you figured it out.
I know what an Attack 3 looks like; I'm looking at one. The picture I linked is what a throttle looks like, and an Attack 3 doesn't have one of those.

Brian Selle
17-02-2012, 16:07
My confusion mainly came from the image of the Logitech Attack 3 in the WPILib User's Guide. It annotates the dial/lever on the rear of the controller as a "throttle".

http://http://firstforge.wpi.edu/sf/docman/do/downloadDocument/projects.wpilib/docman.root.c_and_java_documentation/doc1196/2

Joe Ross
17-02-2012, 16:23
I know what an Attack 3 looks like; I'm looking at one. The picture I linked is what a throttle looks like, and an Attack 3 doesn't have one of those.

Logitech never explicit labels the wheel at the base of Attack 3. What would you call it? Colloquially, many people call it a throttle. http://www.amazon.com/gp/community-content-search/results/ref=cm_srch_q_rtr/?query=throttle&search-alias=community-reviews&Go.x=0&Go.y=0&idx.asin=B0000ALFC5

nickpeq
17-02-2012, 18:50
It can be referenced with getRawAxis(3) or more simply getZ()
It is the 3rd axis since the Logitec Attack doesn't have a Z/twist.

Also, I don't understand what you're calling the joystick through. What is OI? :P