Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IselLinearControlTwoAxis.hh
1 #ifndef __ISEL_LINEAR_CONTROL_TWO_AXIS_hh__
2 #define __ISEL_LINEAR_CONTROL_TWO_AXIS_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 "../../BIAS/PanTilt/include/ptu.h"
15 #ifndef WIN32
16 #include "../../BIAS/PanTilt/include/linuxser.h"
17 #else
18 #include "../../BIAS/PanTilt/include/W32SERIA.H"
19 #endif
20 }
21 
22 namespace BIAS{
23 
24  /**
25  @class IselLinearControlTwoAxis
26  This class controls the Isel iMC-S8 Linear Unit (two axis controll)
27  @author tboer, 02/12
28  */
29  class BIASPanTilt_EXPORT IselLinearControlTwoAxis : public BIAS::Debug {
30  public:
31 
32  /**
33  standard constructor, steps_per_mm set to default values
34  */
36 
37  /**
38  constructor
39  @param int the steps per mm of the first axis
40  @param int the steps per mm of the second axis
41  */
42  IselLinearControlTwoAxis(const int steps_per_mm_x, const int steps_per_mm_y);
43 
44  /**
45  standard destructor
46  */
48 
49  /**
50  Start Reference Tour on given axis (1-x, 2-y, or 3 x+y)
51  @return bool indicating success of reset
52  */
53  int Reset(const int axis = 3);
54 
55  /**
56  opens the serial port and initialises unit
57  @param int the number of the serial port
58  */
59  int Init(const int nCOMportNumber);
60 
61  /**
62  opens the given port and initialises unit
63  @param char[] the name of the port
64  */
65  int Init(const char *COMportName);
66 
67  /**
68  closes the comport stream
69  */
70  void Close();
71 
72  /**
73  move millimeters in directions
74  @param float the millimeters to move on the first axis
75  @param float the millimeters to move on the second axis
76  */
77  int Move(const float millimetersX, const float millimetersY);
78 
79  /**
80  sets the maximum/desired speed for all movements in millimeter per second
81  @param float the speed for the first axis
82  @param float the speed for the second axis
83  */
84  int SetSpeed(const float speedX, const float speedY);
85  int SetAcceleration(const int accel);
86 
87  /**
88  @returns the current speed
89  */
90  void GetSpeed(float &speedX, float &speedY);
91 
92  /**
93  @returns the current Acceleration
94  */
95  void GetAcceleration(int &accel);
96 
97  /**
98  @return the current position of the Unit
99  */
100  void GetCurrentPosition(float &millimetersX, float &millimetersY);
101 
102  int SetPosition(const float millimetersX, const float millimetersY, const bool bWaitComplete=true);
103 
104  /**
105  Send a command string, terminated by <cr> character
106  */
107  void SendRawCommand(const std::string cmd);
108 
109  /**
110  Read a line from the serial port, returns length of read string,
111  zero on nothing to read
112  */
113  int ReadRawLine(std::string &cmd);
114 
115  protected:
116 
117  int CheckStatus();
118  int steps_per_second_x_, steps_per_second_y_;
119  portstream_fd COMstream_;
120  int steps_per_mm_x_, steps_per_mm_y_;
121  };//end class
122 
123 }// end namespace BIAS
124 
125 #endif // __ISEL_LINEAR_CONTROL_TWO_AXIS_hh__
This class controls the Isel iMC-S8 Linear Unit (two axis controll)