Main MRPT website > C++ reference for MRPT 1.5.7
CTuMicos.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #ifndef CTuMicos_H
11 #define CTuMicos_H
12 
16 
17 namespace mrpt
18 {
19  namespace hwdrivers
20  {
21  /** This class implements initialization and comunication methods to
22  * control a Tilt Unit model DT-80, working in radians .
23  * \ingroup mrpt_hwdrivers_grp
24  */
25  class HWDRIVERS_IMPEXP CTuMicos : public CPtuBase, public mrpt::utils::COutputLogger
26  {
27 
28  public:
29 
30  /** Default constructor */
31 
32  CTuMicos() {};
33 
34  /** Destructor */
35 
36  virtual ~CTuMicos(){ close(); }
37 
38  /*************************** Commands ***************************/
39 
40  public:
41 
42  /** Search limit forward */
43 
44  virtual bool rangeMeasure();
45 
46  /** Specification of positions in absolute terms */
47 
48  virtual bool moveToAbsPos(char axis,double nRad);
49 
50  /** Query position in absolute terms */
51 
52  virtual bool absPosQ(char axis,double &nRad);
53 
54  /** Specify desired axis position as an offset from the current position. \n
55  * This method recives the number of radians to move.
56  * \code
57  * Example of use:
58  * TT-500 *
59  * A *
60  * TO * Current Tilt position is -500
61  * TO500 *
62  * A *
63  * TT * Current Pan position is 1000
64  * \endcode
65  */
66 
67  virtual bool moveToOffPos(char axis,double nRad);
68 
69  /** Query position in relative terms */
70 
71  virtual bool offPosQ(char axis,double &nRad);
72 
73  /** Query max movement limit of a axis in absolute terms */
74 
75  virtual bool maxPosQ(char axis,double &nRad);
76 
77  /** Query min movement limit of a axis in absolute terms */
78 
79  virtual bool minPosQ(char axis,double &nRad);
80 
81  /** Query if exist movement limits */
82 
83  virtual bool enableLimitsQ(bool &enable); // Query if exist some limit
84 
85  /** Enable/Disable movement limits */
86 
87  virtual bool enableLimits(bool set);
88 
89  /** With I mode (default) instructs pan-tilt unit to immediately
90  * execute positional commands. \n
91  * In S mode instructs pan-tilt unit to execute positional commands
92  * only when an Await Position Command Completion command is executed
93  * or when put into Immediate Execution Mode. \n
94  * \code
95  * Example of use of S mode:
96  * DR *
97  * S *
98  * PP1500 *
99  * TP-900 *
100  * PP * Current Pan position is 0
101  * TP * Current Tilt position is 0
102  * A *
103  * PP * Current Pan position is 1500
104  * TP * Current Tilt position is -900
105  * \endcode
106  */
107 
108  virtual bool inmediateExecution(bool set);
109 
110  /** Wait the finish of the last position command to
111  * continue accept commands
112  */
113 
114  virtual bool aWait(void);
115 
116  /** Inmediately stop all */
117 
118  virtual bool haltAll();
119 
120  /** Inmediately stop */
121 
122  virtual bool halt(char axis);
123 
124  /** Specification of turn speed */
125 
126  virtual bool speed(char axis,double radSec);
127 
128  /** Query turn speed */
129 
130  virtual bool speedQ(char axis,double &radSec);
131 
132  /** Specification (de/a)celeration in turn */
133 
134  virtual bool aceleration(char axis,double radSec2);
135 
136  /** Query (de/a)celeration in turn */
137 
138  virtual bool acelerationQ(char axis,double &radSec2);
139 
140  /** Specification of velocity to which start and finish
141  * the (de/a)celeration
142  */
143 
144  virtual bool baseSpeed(char axis,double radSec);
145 
146  /** Query velocity to which start and finish
147  * the (de/a)celeration
148  */
149 
150  virtual bool baseSpeedQ(char axis,double &radSec);
151 
152  /** Specification of velocity upper limit */
153 
154  virtual bool upperSpeed(char axis,double radSec);
155 
156  /** Query velocity upper limit */
157 
158  virtual bool upperSpeedQ(char axis,double &radSec);
159 
160  /** Specification of velocity lower limit */
161 
162  virtual bool lowerSpeed(char axis,double radSec);
163 
164  /** Query velocity lower limit */
165 
166  virtual bool lowerSpeedQ(char axis,double &radSec);
167 
168  /** Reset PTU to initial state */
169 
170  virtual bool reset(void);
171 
172  /** Save or restart default values */
173 
174  virtual bool save(void);
175 
176  /** Restore default values */
177 
178  virtual bool restoreDefaults(void);
179 
180  /** Restore factory default values */
181 
182  virtual bool restoreFactoryDefaults(void);
183 
184  /** Version and CopyRights */
185 
186  virtual bool version(char * nVersion);
187 
188  /** Number of version */
189 
190  virtual void nversion(double &nVersion);
191 
192  /** Query power mode */
193 
194  virtual bool powerModeQ(bool transit,char &mode);
195 
196  /** Specification of power mode */
197 
198  virtual bool powerMode(bool transit,char mode);
199 
200  /** Clear controller internal stack */
201 
202  bool clear();
203 
204  /** Set limits of movement */
205 
206  virtual bool setLimits(char axis, double &l, double &u);
207 
208  /* Change motion direction */
209 
210  virtual bool changeMotionDir();
211 
212 
213  /**************************** State Queries ********************/
214 
215  virtual int checkErrors();
216 
217  /** Clear errors **/
218 
219  virtual void clearErrors() { }
220 
221 
222  /*************************** Other member methods *****************/
223 
224  public:
225 
226  /** PTU and serial port initialization */
227 
228  virtual bool init(const std::string &port);
229 
230  /** Close Connection with serial port */
231 
232  virtual void close();
233 
234  /** To obtains the mistake for use discrete values when the movement
235  * is expressed in radians. Parameters are the absolute position in
236  * radians and the axis desired
237  */
238 
239  virtual double radError(char axis,double nRadMoved);
240 
241  /** To obtain the discrete value for a number of radians */
242 
243  virtual long radToPos(char axis,double nRad);
244 
245  /** To obtain the number of radians for a discrete value */
246 
247  virtual double posToRad(char axis,long nPos);
248 
249  /** Performs a scan in the axis indicated and whit the precision desired. \n
250  * \param <axis> {Pan or Till} \n
251  * \param <tWait> {Wait time betwen commands} \n
252  * \param <initial> {initial position}
253  * \param <final> {final position}
254  * \param <radPre> {radians precision for the scan}
255  */
256 
257  virtual bool scan(char axis, int wait, float initial, float final, double radPre);
258 
259  /** Query verbose mode */
260 
261  virtual bool verboseQ(bool &modo);
262 
263  /** Set verbose. \n
264  * \conde
265  * Example of response with FV (verbose) active:
266  * FV *
267  * PP * Current pan position is 0
268  * Example of response with FT (terse) active:
269  * FT *
270  * PP * 0
271  * \endcode
272  */
273 
274  virtual bool verbose(bool set);
275 
276  /** Query echo mode */
277 
278  virtual bool echoModeQ(bool &mode);
279 
280  /** Enable/Disable echo response with command. \n
281  * \code
282  * Example of use (EE supposed):
283  * PP * 22
284  * ED *
285  * <pp entered again, but not echoed>* 22
286  * \endcode
287  */
288 
289  virtual bool echoMode(bool mode);
290 
291  /** Query the pan and tilt resolution per position moved
292  * and initialize local atributes
293  */
294 
295  virtual bool resolution(void);
296 
297  /** Check if ptu is moving */
298 
299  virtual double status(double &rad);
300 
301 
302  /*************************** Methods for internal use ****************/
303 
304  private:
305 
306  /** To transmition commands to the PTU */
307 
308  virtual bool transmit(const char * command);
309 
310  /** To receive the responseof the PTU */
311 
312  virtual bool receive(const char * command,char * response);
313 
314  /** Used to obtains a number of radians */
315 
316  virtual bool radQuerry(char axis,char command,double &nRad);
317 
318  /** Method used for asign a number of radians with a command */
319 
320  virtual bool radAsign(char axis,char command,double nRad);
321 
322  /** Convert string to double */
323 
324  static double convertToDouble(char *sDouble);
325 
326  /** Convert string to long */
327 
328  static long convertToLong(char *sLong);
329 
330  /**************************** Atributes ********************/
331 
332  public:
333 
334  /* Index of the Tilt axis in use */
335 
337 
338 
339  }; // End of class
340 
341  } // End of namespace
342 
343 } // End of namespace
344 
345 #endif
This class implements initialization and comunication methods to control a generic Pan and Tilt Unit...
Definition: CPtuBase.h:23
CTuMicos()
Default constructor.
Definition: CTuMicos.h:32
void clear()
Clear the contents of this container.
Definition: ts_hash_map.h:113
This class implements initialization and comunication methods to control a Tilt Unit model DT-80...
Definition: CTuMicos.h:25
int version
Definition: mrpt_jpeglib.h:898
GLsizei const GLchar ** string
Definition: glext.h:3919
long convertToLong(char *sLong)
Definition: CRovio.cpp:404
GLint mode
Definition: glext.h:5078
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLboolean reset
Definition: glext.h:3535
_u8 status
Definition: rplidar_cmd.h:21
virtual void clearErrors()
Clear errors.
Definition: CTuMicos.h:219
virtual ~CTuMicos()
Destructor.
Definition: CTuMicos.h:36



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 8277875f6 Mon Jun 11 02:47:32 2018 +0200 at lun oct 28 01:50:49 CET 2019