Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IselLinearControl.hh
1 #ifndef __ISEL_LINEAR_CONTROL_hh__
2 #define __ISEL_LINEAR_CONTROL_hh__
3 
4 #ifndef WIN32
5 #include <unistd.h>
6 #endif
7 #include <stdio.h>
8 #include <iostream>
9 #include <vector>
10 #include <Base/Debug/Debug.hh>
11 
12 extern "C"
13 {
14 #include "include/ptu.h"
15 #ifndef WIN32
16 #include "include/linuxser.h"
17 #else
18 #include "include/W32SERIA.H"
19 #endif
20 }
21 
22 namespace BIAS{
23 
24  /**
25  @class IselLinearControl
26  This class controls the Isel Linear Unit
27  @author fkellner, 09/09
28  */
29  class BIASPanTilt_EXPORT IselLinearControl : public BIAS::Debug {
30  public:
31 
32  /**
33  standard constructor / destructor
34  */
37 
38  /**
39  Start Reference Tour
40  @return bool indicating success of reset
41  */
42  int Reset();
43 
44  /**
45  opens the serial port and initialises unit
46  @param int the number of the serial port
47  */
48  int Init(int nCOMportNumber);
49 
50  /**
51  opens the given port and initialises pan tilt unit
52  @param char[] the name of the port
53  */
54  int Init(const char *COMportName);
55 
56  /**
57  closes the comport stream connected to ptu
58  */
59  void Close();
60 
61  //do exactly what you think, just move millimeters in direction
62  int MoveLeft(float millimeters);
63  int MoveRight(float millimeters);
64 
65  //set basic stuff for movement
66  int SetSpeed(int speed);
67  int SetAcceleration(int accel);
68 
69  /**
70  @returns the current speed
71  */
72  void GetSpeed(int &speed);
73 
74  /**
75  @returns the current Acceleration
76  */
77  void GetAcceleration(int &accel);
78 
79  /**
80  @return the current position of the Unit
81  */
82  void GetCurrentPosition(int &pos);
83 
84  int SetPosition(int pos, bool bWaitComplete=true);
85 
86  /**
87  Send a command string, terminated by <cr> character
88  */
89  void SendRawCommand(std::string cmd);
90 
91  /**
92  Read a line from the serial port, returns length of read string,
93  zero on nothing to read
94  */
95  int ReadRawLine(std::string &cmd);
96 
97  protected:
98 
99  int CheckStatus();
100  int speed_;
101  portstream_fd COMstream_;
102  unsigned int steps_per_mm_;
103  };//end class
104 
105 }// end namespace BIAS
106 
107 #endif // __ISEL_LINEAR_CONTROL_hh__
This class controls the Isel Linear Unit.