51 /** Returns the number of Joysticks in the computer.
52 */
53staticint getJoysticksCount();
54
55 /** Gets joystick information.
56 *
57 * This method will try first to open the joystick, so you can safely call it while the joystick is plugged and removed arbitrarly.
58 *
59 * \param nJoy The index of the joystick to query: The first one is 0, the second 1, etc... See CJoystick::getJoysticksCount to discover the number of joysticks in the system.
60 * \param x The x axis position, range [-1,1]
61 * \param y The y axis position, range [-1,1]
62 * \param z The z axis position, range [-1,1]
63 * \param buttons Each element will hold true if buttons are pressed. The size of the vector will be set automatically to the number of buttons.
64 * \param raw_x_pos If it is desired the raw integer measurement from JoyStick, set this pointer to a desired placeholder.
65 * \param raw_y_pos If it is desired the raw integer measurement from JoyStick, set this pointer to a desired placeholder.
66 * \param raw_z_pos If it is desired the raw integer measurement from JoyStick, set this pointer to a desired placeholder.
67 *
68 * \return Returns true if successfull, false on error, for example, if joystick is not present.
69 *
70 * \sa setLimits
71 */
72bool getJoystickPosition(
73int nJoy,
74float &x,
75float &y,
76float &z,
77 std::vector<bool> &buttons,
78int *raw_x_pos=NULL,
79int *raw_y_pos=NULL,
80int *raw_z_pos=NULL );
81
82 /** Set the axis limit values, for computing a [-1,1] position index easily (Only required to calibrate analog joystick).
83 * It seems that these values must been calibrated for each joystick model.
84 *
85 * \sa getJoystickPosition
86 */
87 #ifdef MRPT_OS_WINDOWS
88void setLimits( int x_min = 0,int x_max = 0xFFFF, int y_min=0,int y_max = 0xFFFF,int z_min=0,int z_max = 0xFFFF );
89 #else
90void setLimits( int x_min = -32767,int x_max = 32767, int y_min=-32767,int y_max = 32767,int z_min=-32767,int z_max = 32767);