Main MRPT website > C++ reference
MRPT logo
CBoardDLMS.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 CBoardDLMS_H
30 #define CBoardDLMS_H
31 
35 #include <mrpt/poses/CPose3D.h>
36 
37 namespace mrpt
38 {
39  namespace hwdrivers
40  {
41  /** An interface to a custom board which interfaces two SICK laser scanners.
42  * Implemented for the board v1.0 designed by 2008 @ ISA (University of Malaga).
43  *
44  * \code
45  * PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
46  * -------------------------------------------------------
47  * [DualLMS]
48  * driver = CBoardDLMS
49  * process_rate = 30 ; Hz
50  * USB_serialname = DLMS-001
51  *
52  * mPose_x = 0 ; Master laser range scaner 6D position on the robot (meters)
53  * mPose_y = 0
54  * mPose_z = 0
55  * mPose_yaw = 0
56  * mPose_pitch = 0
57  * mPose_roll = 0
58  *
59  * sPose_x = 0 ; Slave laser range scaner 6D position on the robot (meters)
60  * sPose_y = 0
61  * sPose_z = 0
62  * sPose_yaw = 0
63  * sPose_pitch = 0
64  * sPose_roll = 0
65  * \endcode
66  *
67  * \ingroup mrpt_hwdrivers_grp
68  */
70  {
72  protected:
73  /** A copy of the device serial number (to open the USB FTDI chip)
74  */
75  std::string m_usbSerialNumber;
76  uint32_t m_timeStartUI;
78 
80 
81  /** Tries to connect to the USB device (if disconnected).
82  * \return True on connection OK, false on error.
83  */
84  bool checkConnectionAndConnect();
85 
86  bool checkCRC( const std::vector<unsigned char> &frame );
87 
88  /** 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)
89  * See hwdrivers::CBoardDLMS for the possible parameters
90  */
91  void loadConfig_sensorSpecific(
92  const mrpt::utils::CConfigFileBase &configSource,
93  const std::string &iniSection );
94 
95  public:
96  /** Constructor
97  * \param serialNumberUSBdevice The serial number (text) of the device to open.
98  * The constructor will try to open the device. You can check if it failed calling "isOpen()".
99  */
100  CBoardDLMS( );
101 
102  /** Destructor
103  */
104  virtual ~CBoardDLMS();
105 
106  /** This method should be called periodically (at least at 1Hz to capture ALL the real-time data)
107  * It is thread safe, i.e. you can call this from one thread, then to other methods from other threads.
108  * This method processes data from the GPS and update the object state accordingly.
109  */
110  void doProcess();
111 
112  /** This method can or cannot be implemented in the derived class, depending on the need for it.
113  * \exception This method must throw an exception with a descriptive message if some critical error is found.
114  */
115  virtual void initialize();
116 
117  /** Query the firmware version on the device (can be used to test communications).
118  * \return true on success, false on communications errors or device not found.
119  */
120  bool queryFirmwareVersion( std::string &out_firmwareVersion );
121 
122  /** Send a command to the DLMS Board
123  * \return true on success, false on communications errors or device not found.
124  */
125  bool sendCommand( uint8_t command, std::vector<unsigned char> &response );
126 
127  bool queryTimeStamp( mrpt::system::TTimeStamp &tstamp );
128 
129  }; // end of class
130 
131  } // end of namespace
132 } // End of namespace
133 
134 #endif



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