source: flair-src/branches/mavlink/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h@ 82

Last change on this file since 82 was 15, checked in by Bayard Gildas, 9 years ago

sources reformatted with flair-format-dir script

File size: 3.8 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5/*!
6 * \file HokuyoUTM30Lx.h
7 * \brief Classe intégrant le telemetre laser Hokuyo UTM 30lx
8 * \author César Richard, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2014/07/22
10 * \version 1.0
11 */
12
13#ifndef HOKUYOUTM30LX_H
14#define HOKUYOUTM30LX_H
15
16#include <Thread.h>
17#include <LaserRangeFinder.h>
18#include <Mutex.h>
19
20#include <queue>
21#include <vector>
22
23namespace flair {
24namespace core {
25class cvmatrix;
26class FrameworkManager;
27class SerialPort;
28class Mutex;
29}
30namespace gui {
31class Tab;
32class TabWidget;
33class RangeFinderPlot;
34}
35}
36
37namespace flair {
38namespace sensor {
39/*! \class HokuyoUTM30Lx
40*
41* \brief Classe intégrant le telemetre laser Hokuyo UTM 30lx
42*/
43class HokuyoUTM30Lx : public core::Thread, public LaserRangeFinder {
44public:
45 /*!
46 * \brief Constructor
47 *
48 * Construct a Hokuyo UTM30-Lx.
49 *
50 * \param parent parent
51 * \param name name
52 * \param serialport serialport
53 * \param priority priority of the Thread
54 */
55 HokuyoUTM30Lx(const core::FrameworkManager *parent, std::string name,
56 core::SerialPort *serialport, uint8_t priority);
57 void getMesure(int startStep, int endStep, int clusterCount, int interval,
58 int scanNumber = 0);
59 core::cvmatrix *getDatas(void);
60
61 /*!
62 * \brief Use default plot
63 *
64 */
65 void UseDefaultPlot(void);
66 /*!
67 * \brief Destructor
68 *
69 */
70 ~HokuyoUTM30Lx();
71
72private:
73 core::SerialPort *serialport;
74 core::Mutex *bufRetMut;
75 core::Mutex *sendingCmdMut;
76 gui::Tab *main_tab;
77 gui::TabWidget *tab;
78 gui::RangeFinderPlot *plot;
79
80 // matrix
81 core::cvmatrix *output;
82
83 std::queue<std::string> bufRet;
84
85 /*!
86 * \brief Run function
87 *
88 * Reimplemented from Thread.
89 *
90 */
91 void Run(void);
92 /*!
93 * \brief Send a command
94 * \param command Command to send (see Hokuyo UTM 30-LX doc for more
95 * informations)
96 * \return Return code
97 */
98 std::string sendCommand(std::string command);
99 /*!
100 * \brief Start the laser
101 *
102 */
103 void startLaser(void);
104 /*!
105 * \brief Stop the laser
106 *
107 */
108 void stopLaser(void);
109 /*!
110* \brief Stop and reset the laser's settings
111*
112*/
113 void resetConfig(void);
114 /*!
115* \brief Decode incomming datas
116* \param datas Datas to decode
117* \param startStep Set the first mesured point
118* Decode mesured points from incoming datas and fill the output matrix
119*/
120 void decodeDatas(std::vector<std::string> datas, int startStep);
121 /*!
122 * \brief Explode a string into a vector
123 * \param str The string to explode
124 * \param delimiter The character separating elements
125 * \return A vector containing the elements
126 */
127 static std::vector<std::string> explode(const std::string str,
128 char delimiter);
129 /*!
130* \brief Calculate the checksum
131* \param code Data from which calculate
132* \param byte Data's size
133* \return A character corresponding to the code's checksum
134*/
135 static int encodeSum(const char *code, int byte);
136 /*!
137* \brief Check if a data correspond to its checksum
138* \param data Datas to check
139*/
140 static bool checkSum(std::string data);
141 /*!
142* \brief Decode datas using the 2 character encoding
143* \param data Datas to decode
144* \return Decoded datas
145*/
146 static float decode2car(const char *data);
147 /*!
148* \brief Decode datas using the 3 character encoding
149* \param data Datas to decode
150* \return Decoded datas
151*/
152 static float decode3car(const char *data);
153 /*!
154* \brief Decode datas using the 4 character encoding
155* \param data Datas to decode
156* \return Decoded datas
157*/
158 static float decode4car(const char *data);
159
160 /*!
161* \brief Update using provided datas
162*
163* Reimplemented from IODevice.
164*
165* \param data data from the parent to process
166*/
167 void UpdateFrom(const core::io_data *data){};
168};
169} // end namespace sensor
170} // end namespace framewor
171#endif // HOKUYOUTM30LX_H
Note: See TracBrowser for help on using the repository browser.