View Single Post
  #5   Spotlight this post!  
Unread 18-02-2012, 18:14
jesusrambo jesusrambo is offline
Self-Proclaimed Programmer Messiah
AKA: JD Russo
FRC #2035 (Robo Rockin' Bots)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Carmel, CA
Posts: 114
jesusrambo is an unknown quantity at this point
Re: Can't read joystick values in Java

Quote:
Originally Posted by compboy07 View Post
The getX() method is for the kinectStick.
No, getX() is inherited in both Joystick and kinectStick from GenericHID.

Look in the libraries at Joystick.java and you'll find

Code:
/**
     * Get the X value of the joystick.
     * This depends on the mapping of the joystick connected to the current port.
     *
     * @param hand Unused
     * @return The X value of the joystick.
     */
    public double getX(Hand hand) {
        return getRawAxis(m_axes[AxisType.kX.value]);
    }

    /**
     * Get the Y value of the joystick.
     * This depends on the mapping of the joystick connected to the current port.
     *
     * @param hand Unused
     * @return The Y value of the joystick.
     */
    public double getY(Hand hand) {
        return getRawAxis(m_axes[AxisType.kY.value]);
    }
TL;DR getX() works for joysticks, not just kinectSticks.
Reply With Quote