source: flair-src/trunk/lib/FlairSensorActuator/src/HokuyoUTM30Lx.h@ 42

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

sources reformatted with flair-format-dir script

File size: 3.8 KB
RevLine 
[3]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[3]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
[15]23namespace flair {
24namespace core {
25class cvmatrix;
26class FrameworkManager;
27class SerialPort;
28class Mutex;
[3]29}
[15]30namespace gui {
31class Tab;
32class TabWidget;
33class RangeFinderPlot;
34}
35}
[3]36
[15]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);
[3]60
[15]61 /*!
62 * \brief Use default plot
63 *
64 */
65 void UseDefaultPlot(void);
66 /*!
67 * \brief Destructor
68 *
69 */
70 ~HokuyoUTM30Lx();
[3]71
[15]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;
[3]79
[15]80 // matrix
81 core::cvmatrix *output;
[3]82
[15]83 std::queue<std::string> bufRet;
[3]84
[15]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);
[3]159
[15]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};
[3]169} // end namespace sensor
170} // end namespace framewor
171#endif // HOKUYOUTM30LX_H
Note: See TracBrowser for help on using the repository browser.