Develop and Download Open Source Software

Browse Subversion Repository

Contents of /rangesCtrl/UrgCtrl.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 279 - (show annotations) (download) (as text)
Wed Mar 12 05:28:19 2008 UTC (16 years, 1 month ago) by satofumi
File MIME type: text/x-chdr
File size: 4991 byte(s)
adjust tab index
1 #ifndef URG_CTRL_H
2 #define URG_CTRL_H
3
4 /*!
5 \file
6 \brief URG 制御
7
8 \author Satofumi KAMIMURA
9
10 $Id$
11
12 \todo タイムスタンプまわりを、timestampAdjust/ に移動させる
13 */
14
15 #include "RangeSensorInterface.h"
16 #include <memory>
17
18 namespace beego {
19 class ConnectionInterface;
20 class SensorParameter;
21
22 /*!
23 \brief SCIP2.0 規格による URG 制御
24 */
25 class UrgCtrl : public RangeSensorInterface {
26 UrgCtrl(const UrgCtrl& rhs);
27 UrgCtrl& operator = (const UrgCtrl& rhs);
28
29 struct pImpl;
30 const std::auto_ptr<pImpl> pimpl;
31
32 public:
33 enum {
34 DefaultBaudrate = 115200, //!< デフォルトボーレート
35
36 VEND = 0, //!< ベンダ情報
37 PROD, //!< 製品情報
38 FIRM, //!< ファームウェアバージョン
39 PROT, //!< プロトコルバージョン
40 SERI, //!< センサ固有シリアル番号
41 };
42
43 /*!
44 \brief データの取得形式
45 */
46 typedef enum {
47 ManualCapture, //!< 逐次取得
48 AutoCapture, //!< 自動取得
49 } CaptureMode;
50
51 UrgCtrl(void);
52 ~UrgCtrl(void);
53 const char* what(void);
54
55 /*!
56 \brief 接続
57
58 引数を解析しての接続処理。以下のオプションを解析可能
59
60 - --urg_port=<port> ... 接続ポートを指定
61 - --urg_baudrate=<port> ... 接続ボーレートを指定
62 - --urg_handstand ... URG の取得データの配置を開始と終了で反転させる
63
64 \retval true 接続成功
65 \retval false 接続に失敗
66 */
67 bool connect(int argc, char* argv[]);
68 bool connect(const char* device, long baudrate = DefaultBaudrate);
69 bool connect(ConnectionInterface* con);
70 void disconnect(void);
71 bool isConnected(void);
72
73 /*!
74 \brief バージョン情報の文字列を返す
75
76 \param lines [o] バージョン情報の文字列
77
78 \todo もう少し詳しく記述する。具体例も交えて
79 */
80 bool getVersionInfo(std::vector<std::string>& lines);
81
82 long getMinDistance(void) const;
83 long getMaxDistance(void) const;
84
85 // !!! Length っていう名前は、サイズを連想しにくいので、改名しましょう
86 int getMaxDataLength(void) const;
87
88 /*!
89 \brief データ取得
90
91 データ取得を行い、バッファに格納する
92
93 \param data [o] 取得データ用バッファ
94 \param max_size [i] 取得データ用バッファの最大サイズ
95
96 \return 取得データ数
97 \retval < 0 取得失敗
98 */
99 int capture(long data[], size_t max_size);
100
101 // 角度変換
102 double index2rad(const int index) const;
103 int rad2index(const double radian) const;
104
105 /*!
106 \brief タイムスタンプの調整
107
108 getTimestamp() で返されるタイムスタンプについて、このメソッドを評価した瞬間の値が、set_value の値になるように設定する
109
110 \param set_value [i] タイムスタンプ基準値の設定値
111
112 \todo 説明がわかりにくいのを、なんとかする。図が必要かも
113 */
114 void adjustTimestamp(int set_value = 0);
115
116 /*!
117 \brief PC 時刻で調整したタイムスタンプの取得
118
119 \attention capture() 後でなければ、この値は無効
120 */
121 long getTimestamp(void);
122
123 /*!
124 \brief センサパラメータの取得
125
126 \todo 説明する
127 */
128 bool loadSensorParameter(SensorParameter* parameter);
129
130 /*!
131 \brief センサパラメータの設定
132
133 \todo 説明する
134 */
135 void setSensorParameter(const SensorParameter* parameter);
136
137 /*!
138 \brief 取得データを反転させる
139
140 \param on [i] 反転させるとき true
141
142 \todo 説明がわかりにくい。図があった方がよい
143
144 \attention 真面目に動作確認をしてないかも...。使い方によっては問題か?
145 */
146 void setHandstand(bool on = true);
147
148 /*!
149 \brief 取得モードの設定
150
151 \param mode [i] 取得モード設定 (AutoCapture / ManualCapture)
152
153 \code
154 UrgCtrl urg;
155 urg.setCaptureMode(UrgCtrl::AutoCapture);
156 \endcode
157
158 取得モードの詳細は \ref compare_auto_manual_page を参照のこと。
159 */
160 void setCaptureMode(CaptureMode mode);
161
162 int getCaptureMode(void);
163
164 /*!
165 \brief 取得バッファ数の設定
166
167 内部に格納できるバッファ(周期データ数)を設定
168
169 \param size [i] バッファ数
170
171 \todo 概念図を用いて説明する
172 */
173 void setMaxBufferNum(size_t size);
174
175 // フレームの間引き回数
176 void setFrameSkipFrames(size_t skip_frames);
177
178 /*!
179 \brief データをまとめるグループ数
180
181 \param [i] groups まとめるグループ数
182
183 \todo ちゃんと説明する
184 */
185 void setDataGroups(size_t groups);
186
187 // 取得範囲の指定
188 void setCaptureRange(int first_index, int last_index);
189
190 /*!
191 \brief レーザの出力制御
192
193 \param on [i] true のとき、レーザ出力を ON
194 */
195 void setLaserOutput(bool on);
196
197 /*!
198 \brief データ取得の開始
199 */
200 void startCaptures(void);
201
202 /*!
203 \brief データ取得の開始
204 */
205 void stopCaptures(void);
206
207 // 直前 capture() 時のタイムスタンプを返す
208 unsigned long getRawTimestamp(void);
209
210 /*!
211 \brief 測距の周期時間を取得
212
213 \return 測距の周期時間
214 */
215 int getScanMsec(void);
216
217 ConnectionInterface* getConnection(void);
218 };
219 };
220
221 #endif /* !URG_CTRL_H */

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