Main MRPT website > C++ reference
MRPT logo
CGyroKVHDSP3000.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 
29 #ifndef CGyroKVHDSP3000_H
30 #define CGyroKVHDSP3000_H
31 
32 
35 
36 #include <mrpt/poses/CPose3D.h>
38 
39 namespace mrpt
40 {
41  namespace hwdrivers
42  {
44  /** A class for interfacing KVH DSP 3000 gyroscope with an assynchronous serial communication (product SN : 02-1222-01).
45  * It uses a serial port connection to the device. The class implements the generic sensor class.
46  * See also the application "rawlog-grabber" for a ready-to-use application to gather data from the scanner.
47  * The generated observation is a CObservationIMU, but only the yaw angular velocity and the absolute yaw position are
48  * are set in the vector CObservationIMU::rawMeasurements.
49  * The sensor process rate is imposed by hardware at 100Hz.
50  * For now, this sensor is only supported on posix system.
51  * \code
52  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
53  * -------------------------------------------------------
54  * [supplied_section_name]
55  * process_rate = 100 ; MUST be 100 Hz.
56  * pose_x=0 ; Sensor 3D position relative to the robot (meters)
57  * pose_y=0
58  * pose_z=0
59  * pose_yaw=0 ; Angles in degrees
60  * pose_pitch=0
61  * pose_roll=0
62  * sensorLabel = <label> ; Label of the sensor
63  * COM_port_LIN = /dev/ttyUSB0 ; COM PORT in LINUX
64  * operatingMode = <"rate"/"integrated", "incremental"> ; Default mode is Rate.
65  * \endcode
66  * In most of the communs applications, this class will be used as :
67  * \code
68  * CGyroKVHDSP3000 kvh;
69  * /// ...
70  * CConfigFile conf("conf.ini");
71  * /// ...
72  * kvh.loadConfig_sensorSpecific(conf, "KVH");
73  * /// ...
74  * while(1) {
75  * kvh.doProcess();
76  * TListObservations rateObs;
77  * kvh.getObservations(rateObs);
78  * // ....
79  * \endcode
80  * \ingroup mrpt_hwdrivers_grp
81  */
83  {
85  protected:
86 
87  /** This serial port will be attempted to be opened automatically when this class is first used to request data from the device.
88  * \sa hwdrivers::CSerialPort
89  */
91  std::string m_com_port;
92 
94 
95  /** Search the port where the sensor is located and connect to it
96  */
97  bool searchPortAndConnect();
98 
99  CSerialPort* m_serialPort; //!< The serial port connection
102 
104 
105  public:
106  /** Constructor
107  */
108  CGyroKVHDSP3000( );
109 
110  /** Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes)
111  * See hwdrivers::CGyroKVHDSP3000 for the possible parameters
112  */
113  void loadConfig_sensorSpecific(
114  const mrpt::utils::CConfigFileBase &configSource,
115  const std::string &iniSection );
116 
117  /** Destructor
118  */
119  virtual ~CGyroKVHDSP3000();
120 
121 
122  /** This method will be invoked at a minimum rate of "process_rate" (Hz)
123  * \exception This method must throw an exception with a descriptive message if some critical error is found.
124  */
125  void doProcess();
126 
127  /** Turns on the KVH DSP 3000 device and configure it for getting orientation data. you must have called loadConfig_sensorSpecific before
128  * calling this function.
129  */
130  void initialize();
131  /** Send to the sensor the command 'Z' wich reset the integrated angle. (in both rate mode and incremental, this function has no effect) */
132  void resetIncrementalAngle(void);
133  void changeMode(GYRO_MODE _newMode);
134 
135 
136  }; // end of class
137 
138  } // end of namespace
139 } // end of namespace
140 
141 #endif
142 
143 



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013