Develop and Download Open Source Software

Browse Subversion Repository

Contents of /rangesCtrl/RangeSensorInterface.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 267 - (show annotations) (download) (as text)
Thu Mar 6 22:05:56 2008 UTC (16 years, 1 month ago) by satofumi
File MIME type: text/x-chdr
File size: 3406 byte(s)
fix document
1 #ifndef RANGE_SENSOR_INTERFACE_H
2 #define RANGE_SENSOR_INTERFACE_H
3
4 /*!
5 \file
6 \brief レンジセンサ用インターフェース
7
8 \author Satofumi KAMIMURA
9
10 $Id$
11 */
12
13 #include <string>
14 #include <vector>
15
16 namespace beego {
17 class ConnectionInterface;
18
19 /*!
20 \brief 測域センサ・インターフェース
21 */
22 class RangeSensorInterface {
23 public:
24 virtual ~RangeSensorInterface(void) {}
25
26 /*!
27 \brief 内部状態を返す
28
29 \return 内部状態を示す文字列
30
31 使用例
32 \code
33 UrgCtrl sensor;
34 if (! sensor.connect(device, baudrate)) {
35 printf("connect: %s\n", sensor.what());
36 exit(1);
37 }
38 \endcode
39 */
40 virtual const char* what(void) = 0;
41
42 /*!
43 \brief 接続
44
45 \param device [i] 接続デバイス名
46 \param baudrate [i] 接続ボーレート
47
48 \retval true 接続成功
49 \retval false 接続に失敗
50
51 使用例
52 \code
53 const char device[] = "/dev/ttyACM0";
54 const long baudrate = 115200;
55 UrgCtrl sensor;
56 if (! sensor.connect(device, baudrate)) {
57 printf("connect: %s\n", sensor.what());
58 exit(1);
59 }
60 \endcode
61 */
62 virtual bool connect(const char* device, long baudrate) = 0;
63
64 /*!
65 \brief 接続
66
67 \param con [i] 接続オブジェクト
68
69 \retval true 接続成功
70 \retval false 接続に失敗
71 */
72 virtual bool connect(ConnectionInterface* con) = 0;
73
74 /*!
75 \brief 切断
76 */
77 virtual void disconnect(void) = 0;
78
79 /*!
80 \brief 接続状態を返す
81
82 \retval true 接続中
83 \retval false 切断中
84 */
85 virtual bool isConnected(void) = 0;
86
87 /*!
88 \brief バージョン情報の取得
89
90 \param lines [o] バージョン情報
91
92 \retval true 正常終了
93 \retval false 情報の取得に失敗
94
95 使用例
96 \code
97 UrgCtrl sensor;
98 if (! sensor.connect(device)) {
99 ...
100 }
101 ...
102
103 std::vector<std::string> lines;
104 if (sensor.getVersionInfo(lines)) {
105 for (std::vector<std::string> >::iterator it = lines.begin();
106 it != lines.end(); ++it) {
107 std::cout << *it << std::endl;
108 }
109 }
110 \endcode
111 */
112 virtual bool getVersionInfo(std::vector<std::string>& lines) = 0;
113
114 /*!
115 \brief 有効距離の最小値を取得
116
117 \return 有効距離の最小値
118 */
119 virtual long getMinDistance(void) const = 0;
120
121 /*!
122 \brief 有効距離の最大値を取得
123
124 \return 有効距離の最大値
125 */
126 virtual long getMaxDistance(void) const = 0;
127
128 /*!
129 \brief 1スキャンの最大データサイズを返す
130
131 \return 1スキャンの最大データサイズ
132 */
133 virtual int getMaxDataLength(void) const = 0;
134
135 virtual int capture(long data[], size_t max_size) = 0;
136
137 virtual void adjustTimestamp(int set_value = 0) = 0;
138 virtual long getTimestamp(void) = 0;
139
140 /*!
141 \brief データインデックスのラジアン角度変換
142
143 \param index [i] データインデックス
144
145 \return ラジアン角度
146
147 センサ前面が、0.0 [rad] に相当する。
148
149 \image html sensor_radian.png センサ上面からの角度対応図
150 */
151 virtual double index2rad(const int index) const = 0;
152
153 /*!
154 \brief ラジアン角度のデータインデックス変換
155
156 \param radian [i] ラジアン角度
157
158 \return データインデックス
159
160 センサ前面が、0.0 [rad] に相当する。
161
162 \image html sensor_radian.png センサ上面からの角度対応図
163 */
164 virtual int rad2index(const double radian) const = 0;
165 };
166 };
167
168 #endif /* !RANGE_SENSOR_INTERFACE_H */

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26