00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CJOYSTICK_H 00029 #define CJOYSTICK_H 00030 00031 #include <mrpt/config.h> 00032 #include <mrpt/utils/utils_defs.h> 00033 #include <mrpt/hwdrivers/link_pragmas.h> 00034 00035 /*--------------------------------------------------------------- 00036 Class 00037 ---------------------------------------------------------------*/ 00038 namespace mrpt 00039 { 00040 namespace hwdrivers 00041 { 00045 class HWDLLIMPEXP CJoystick 00046 { 00047 private: 00050 int m_x_min,m_x_max,m_y_min,m_y_max,m_z_min,m_z_max; 00051 00052 00053 #ifdef MRPT_OS_LINUX 00054 int m_joy_fd; 00055 int m_joy_index; 00056 00057 vector_bool m_joystate_btns; 00059 vector_int m_joystate_axes; 00060 #endif 00061 00062 public: 00065 CJoystick(); 00066 00069 virtual ~CJoystick(); 00070 00073 static int getJoysticksCount(); 00074 00092 bool getJoystickPosition( 00093 int nJoy, 00094 float &x, 00095 float &y, 00096 float &z, 00097 std::vector<bool> &buttons, 00098 int *raw_x_pos=NULL, 00099 int *raw_y_pos=NULL, 00100 int *raw_z_pos=NULL ); 00101 00107 #ifdef MRPT_OS_WINDOWS 00108 void 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 ); 00109 #else 00110 void 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); 00111 #endif 00112 }; // End of class def. 00113 00114 } // End of namespace 00115 } // End of namespace 00116 00117 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.6.5 SVN: at Mon Feb 23 13:35:09 EST 2009 |