Develop and Download Open Source Software

Browse Subversion Repository

Contents of /runCtrl/RunCtrl.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 379 - (show annotations) (download) (as text)
Mon Apr 19 19:53:12 2010 UTC (14 years, 1 month ago) by satofumi
File MIME type: text/x-c++src
File size: 16122 byte(s)
コンパイルエラーを修正
1 /*!
2 \file
3 \brief ‘–s§Œäƒ‰ƒCƒuƒ‰ƒŠ
4
5 \author Satofumi KAMIMURA
6
7 $Id$
8 */
9
10 #include "RunCtrl.h"
11 #include "SerialCtrl.h"
12 #include "TransmitCtrl.h"
13 #include "CalculateGeometry.h"
14 #include "structTable.h"
15 #include "tRunCtrl.h"
16 #include "FileToArgs.h"
17 #include "SearchFilePath.h"
18 #include <cstring>
19 #include <cstdlib>
20
21 using namespace beego;
22
23
24 struct RunCtrl::pImpl {
25 enum {
26 Timeout = 100,
27 RetryTimes = 3,
28 };
29 std::string error_message;
30 ConnectionInterface* con;
31
32 typedef std::vector<unsigned char> CommandMessage;
33 CommandMessage last_command;
34 TransmitCtrl* transmit;
35 tRunCtrl_t top;
36
37 /*!
38 \brief RunCtrl ‚Ěˆř”ŠÇ—
39 */
40 class ArgsInfo {
41 public:
42 std::string port;
43 long baudrate;
44
45 ArgsInfo(void) : baudrate(DefaultBaudrate) {
46 }
47 };
48
49 pImpl(void)
50 : error_message("no error."), con(new SerialCtrl), transmit(NULL) {
51 }
52
53 ~pImpl(void) {
54 delete transmit;
55 delete con;
56 }
57
58 void parseArgs(ArgsInfo& args_info, int argc, char *argv[]) {
59
60 for (int i = 1; i < argc; ++i) {
61 if (! strncmp("--run_port=", argv[i], 11)) {
62 args_info.port = &argv[i][11];
63 } else if (! strncmp("--run_baudrate=", argv[i], 15)) {
64 args_info.baudrate = atoi(&argv[i][15]);
65 }
66 }
67 }
68
69 bool connect(ConnectionInterface* con) {
70
71 transmit = new TransmitCtrl(con, reinterpret_cast<unsigned char*>(&top));
72 // !!! ă‹L‚̐śŹ‚ÉŽ¸”s‚ľ‚˝‚çAƒƒO‹L˜^‚đs‚¤
73
74 // ƒo[ƒWƒ‡ƒ“ƒ`ƒFƒbƒN
75 // !!!
76 // !!! ‰ž“š‚Ş‚Č‚Ż‚ę‚΁A“dŒš‚Ş“ü‚Á‚Ä‚˘‚邊H ‚Ć‚ĚƒGƒ‰[ƒƒbƒZ[ƒW
77 // !!! ƒo[ƒWƒ‡ƒ“‚ŞˆŮ‚Č‚ę‚΁AÄ‚Ť’ź‚ľ‚ĂˁA‚Ć‚ĚƒGƒ‰[ƒƒbƒZ[ƒW
78 // !!!
79 // !!! RunIdHandler ‚ЁH
80
81 // ’ʐMƒe[ƒuƒ‹‚Ě––”öƒIƒtƒZƒbƒg‚ĚŠm”F
82 int target_lastOffset = getTargetLastOffset();
83 int host_lastOffset = getHostLastOffset();
84 if (target_lastOffset != host_lastOffset) {
85 error_message = "struct tables is mismatch between host and target.";
86 return false;
87 }
88
89 // Ŕ•WŒnˆĘ’u‚̏‰Šú‰ť
90 // !!!
91
92 // Watch Dog Timer ‚̏‰Šú‰ť
93 // !!!
94
95 // ƒ^ƒCƒ€ƒXƒ^ƒ“ƒv‚̏‰Šú‰ť
96 // !!!
97
98 return true;
99 }
100
101 bool isConnected(void) {
102 return con->isConnected();
103 }
104
105 bool isNotConnected(void) {
106 if (! isConnected()) {
107 error_message = "not connected.";
108 return true;
109 } else {
110 return false;
111 }
112 }
113
114 int getTargetLastOffset(void) {
115 transmit->initPacket(READ_PACKET);
116 ADD_READ_VARIABLE((*transmit), top.last_offset);
117 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
118
119 return top.last_offset;
120 }
121
122 int getHostLastOffset(void) {
123 return (reinterpret_cast<unsigned char*>(&top.last_offset)
124 - reinterpret_cast<unsigned char*>(&top));
125 }
126
127 int to_div16(const Angle& angle) {
128 return static_cast<int>(65536.0 * angle.to_rad() / (2.0 * M_PI));
129 }
130
131 void setStraightHoldVelocity(StraightCtrlMode mode,
132 const int velocity, const int acceleration) {
133
134 ADD_WRITE_VARIABLE((*transmit), top.mode.straight.mode, mode);
135 ADD_WRITE_VARIABLE((*transmit), top.mode.straight.vel.ref_vel, velocity);
136 ADD_WRITE_VARIABLE((*transmit), top.mode.straight.vel.acc, acceleration);
137 ADD_WRITE_VARIABLE((*transmit), top.mode.straight.vel.is_stable, FALSE);
138 }
139
140 void setRotateCtrl(RotateCtrlMode mode,
141 const Angle& velocity, const Angle& acceleration) {
142
143 ADD_WRITE_VARIABLE((*transmit), top.mode.rotate.mode, mode);
144 ADD_WRITE_VARIABLE((*transmit),
145 top.mode.rotate.vel.ref_vel, to_div16(velocity));
146 ADD_WRITE_VARIABLE((*transmit),
147 top.mode.rotate.vel.acc, to_div16(acceleration));
148 ADD_WRITE_VARIABLE((*transmit), top.mode.rotate.vel.is_stable, FALSE);
149 }
150
151 void stop(void) {
152 transmit->initPacket(WRITE_PACKET);
153 ADD_WRITE_VARIABLE((*transmit), top.mode.ctrl, NORMAL_CONTROL);
154
155 // !!! –{—ˆ‚́Aƒpƒ‰ƒ[ƒ^‚Š‚ç‰Á‘Ź“x‚đŽó‚ŻŽć‚é
156 int acceleration_mm = 600;
157 setStraightHoldVelocity(STRAIGHT_HOLD_VELOCITY_FIRST, 0, acceleration_mm);
158
159 // !!! –{—ˆ‚́Aƒpƒ‰ƒ[ƒ^‚Š‚ç‰Á‘Ź“x‚đŽó‚ŻŽć‚é
160 Angle acceleration_angle = deg(90);
161 setRotateCtrl(ROTATE_HOLD_VELOCITY_FIRST, deg(0), acceleration_angle);
162
163 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
164 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
165 }
166
167 void set_servoFree(void) {
168 transmit->initPacket(WRITE_PACKET);
169 ADD_WRITE_VARIABLE((*transmit), top.mode.ctrl, DIRECT_SERVO_FREE);
170 ADD_WRITE_VARIABLE((*transmit), top.mode.straight.vel.is_stable, TRUE);
171 ADD_WRITE_VARIABLE((*transmit), top.mode.rotate.vel.is_stable, TRUE);
172
173 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
174 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
175 }
176
177 size_t getRawTimestamp(void) {
178 transmit->initPacket(READ_PACKET);
179 ADD_READ_VARIABLE((*transmit), top.sec);
180 ADD_READ_VARIABLE((*transmit), top.msec);
181
182 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
183 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
184
185 return (top.sec * 1000) + top.msec;
186 }
187
188 int getMmLength(const gridPosition_t& position, int index) {
189
190 int mm_length = position.mm[index] +
191 (1000 * (position.m[index] + (1000 * position.km[index])));
192
193 return mm_length;
194 }
195
196 void initIsStable(void) {
197 ADD_WRITE_VARIABLE((*transmit), top.mode.straight.vel.is_stable, FALSE);
198 ADD_WRITE_VARIABLE((*transmit), top.mode.rotate.vel.is_stable, FALSE);
199 }
200
201 bool isStable(void) {
202 transmit->initPacket(READ_PACKET);
203 // !!! sec, msec ‚ŕŽóM‚ˇ‚é
204 ADD_READ_VARIABLE((*transmit), top.mode.straight.vel.is_stable);
205 ADD_READ_VARIABLE((*transmit), top.mode.rotate.vel.is_stable);
206
207 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
208 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
209
210 #if 0
211 fprintf(stderr, "%d, %d\n",
212 top.mode.straight.vel.is_stable,
213 top.mode.rotate.vel.is_stable);
214 #endif
215
216 return ((top.mode.straight.vel.is_stable == TRUE) &&
217 (top.mode.rotate.vel.is_stable == TRUE)) ? true : false;
218 }
219
220 void getPosition(Position<int>& position) {
221 transmit->initPacket(READ_PACKET);
222 // !!! sec, msec ‚ŕŽóM‚ˇ‚é
223 for (int i = 0; i < 2; ++i) {
224 ADD_READ_VARIABLE((*transmit), top.bodyPosition.robot.km[i]);
225 ADD_READ_VARIABLE((*transmit), top.bodyPosition.robot.m[i]);
226 ADD_READ_VARIABLE((*transmit), top.bodyPosition.robot.mm[i]);
227 ADD_READ_VARIABLE((*transmit), top.bodyPosition.cnt_integer[i]);
228 ADD_READ_VARIABLE((*transmit), top.bodyPosition.cnt_decimal[i]);
229 }
230 ADD_READ_VARIABLE((*transmit), top.bodyPosition.robot.div16);
231 ADD_READ_VARIABLE((*transmit), top.bodyPosition.straight_vel);
232
233 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
234 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
235
236 position.x = getMmLength(top.bodyPosition.robot, X);
237 position.y = getMmLength(top.bodyPosition.robot, Y);
238 position.angle = rad(2.0 * M_PI * top.bodyPosition.robot.div16 / 65536);
239 }
240
241 int getVelocity_straight(void) {
242 transmit->initPacket(READ_PACKET);
243 ADD_READ_VARIABLE((*transmit), top.straight_vel.averaged_vel);
244
245 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
246 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
247
248 return top.straight_vel.averaged_vel;
249 }
250
251 void direct_setWheelVelocity(const int id, int velocity_mm) {
252 transmit->initPacket(WRITE_PACKET);
253 ADD_WRITE_VARIABLE((*transmit), top.mode.ctrl, DIRECT_WHEEL_CONTROL);
254 ADD_WRITE_VARIABLE((*transmit),
255 top.direct[id].whl_target_mm_sec, velocity_mm);
256 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
257 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
258 }
259
260 void direct_setStraightVelocity(const int velocity_mm) {
261 transmit->initPacket(WRITE_PACKET);
262 ADD_WRITE_VARIABLE((*transmit), top.mode.ctrl, NORMAL_CONTROL);
263 // !!! –{—ˆ‚́Aƒpƒ‰ƒ[ƒ^‚Š‚ç‰Á‘Ź“x‚đŽó‚ŻŽć‚é
264 int acceleration_mm = 600;
265 setStraightHoldVelocity(STRAIGHT_HOLD_VELOCITY_FIRST,
266 velocity_mm, acceleration_mm);
267
268 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
269 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
270 }
271
272 void direct_setRotateVelocity(const Angle& velocity) {
273 transmit->initPacket(WRITE_PACKET);
274 ADD_WRITE_VARIABLE((*transmit), top.mode.ctrl, NORMAL_CONTROL);
275 // !!! –{—ˆ‚́Aƒpƒ‰ƒ[ƒ^‚Š‚ç‰Á‘Ź“x‚đŽó‚ŻŽć‚é
276 Angle acceleration = deg(90);
277 setRotateCtrl(ROTATE_HOLD_VELOCITY_FIRST, velocity, acceleration);
278
279 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
280 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
281 }
282
283 void stop_toAngle(const Angle& target) {
284
285 // !!! ‚ą‚ą‚Ö‚Ě target ‚́A‚Ü‚ŸARunCtrl ‚̍Ŕ•W‚Č‚Ě‚ŠH
286 // !!! Ŕ•WŒa‚Ü‚í‚č‚ĚƒhƒLƒ…ƒƒ“ƒg‚ɂĒč‹`‚ˇ‚ׂŤ
287
288 transmit->initPacket(WRITE_PACKET);
289 ADD_WRITE_VARIABLE((*transmit), top.mode.ctrl, NORMAL_CONTROL);
290
291 // !!! •Ŕi‚ÉŠÖ‚ˇ‚éƒpƒ‰ƒ[ƒ^§Œä‚Ü‚í‚č‚ŕ’˛Ž‚ˇ‚é
292
293 // !!! –{—ˆ‚́Aƒpƒ‰ƒ[ƒ^‚Š‚ç‰Á‘Ź“x‚đŽó‚ŻŽć‚é
294 Angle acceleration = deg(90);
295 // !!! –{—ˆ‚́Aƒpƒ‰ƒ[ƒ^‚Š‚ç–Ú•W‘Ź“x‚đŽó‚ŻŽć‚é
296 Angle velocity = deg(180);
297 setRotateCtrl(ROTATE_HOLD_POSITION_FIRST, velocity, acceleration);
298
299 // !!! ‘Š‘ÎˆĘ’u‚đ‘‚Ťž‚Ţ
300 // !!! –{—ˆ‚́A“KŘ‚ɐݒ股‚ׂŤ
301 // !!! X-Y ‚ŕ
302 // !!! –{—ˆ‚́AAngle ‚É operator - ‚đ’č‹`‚ˇ‚ׂŤ‚ž‚ށA•Ű—Ż
303 ADD_WRITE_VARIABLE((*transmit), top.commandBase_offset.div16,
304 -to_div16(target));
305 // !!! ‚Â‚ŠAŠp“xŽw’č‚̍Ŕ•WŒn‚đ‚Ç‚¤‚ˇ‚邊‚́AŒľ–§‚É’č‹`‚ˇ‚ׂŤ
306
307 initIsStable();
308
309 transmit->sendWithRetry(last_command, RetryTimes, Timeout);
310 // !!! ‘—ŽóM‚ÉŽ¸”s‚ľ‚˝‚çA‰˝‚Ě–˝—ß‚đˆ—’†‚ž‚Á‚˝‚Š‚đ•\ŽŚ‚ľ‚Ä—áŠO‚𓊂°‚é
311 }
312 };
313
314
315 RunCtrl::RunCtrl(void) : pimpl(new pImpl) {
316 }
317
318
319 RunCtrl::~RunCtrl(void) {
320 }
321
322
323 const char* RunCtrl::what(void) {
324 return pimpl->error_message.c_str();
325 }
326
327
328 bool RunCtrl::connect(int argc, char *argv[]) {
329
330 // ƒfƒtƒHƒ‹ƒgÝ’č‚Ě“Ç‚Ýo‚ľ
331 std::vector<std::string> search_path;
332 search_path.push_back("./");
333 search_path.push_back("~/.beego/");
334
335 pImpl::ArgsInfo args_info;
336 std::string config_file;
337 // !!! beegoconf ‚Ě–ź‘O‚đ•Ď‚Ś‚ç‚ę‚é‚悤‚É‚ľ‚Ä‚¨‚­‚ׂŤ‚ЁH ‚ť‚Ě‚¤‚ż...
338 if (searchFilePath(config_file, "beegoconf", search_path)) {
339 // Ý’čƒtƒ@ƒCƒ‹‚Ě“ŕ—e‚đˆř”‚Ć‚ľ‚Ĉľ‚¤
340 FileToArgs fileArgs;
341 fileArgs.load(config_file.c_str(), argv[0]);
342 pimpl->parseArgs(args_info, fileArgs.argc, fileArgs.argv);
343 }
344 pimpl->parseArgs(args_info, argc, argv);
345
346 return connect(args_info.port.c_str(), args_info.baudrate);
347 }
348
349
350 bool RunCtrl::connect(const char* device, long baudrate) {
351
352 pimpl->con->disconnect();
353 bool ret = pimpl->con->connect(device, baudrate);
354 if (ret == false) {
355 pimpl->error_message = pimpl->con->what();
356 return false;
357 }
358 return connect(pimpl->con);
359 }
360
361
362 bool RunCtrl::connect(ConnectionInterface* con) {
363
364 bool ret = pimpl->connect(con);
365 if (! ret) {
366 return false;
367 }
368
369 // ƒT[ƒ{‚đ‚Š‚Ż‚é
370 stop();
371 return true;
372 }
373
374
375 void RunCtrl::disconnect(void) {
376
377 pimpl->con->disconnect();
378
379 delete pimpl->transmit;
380 pimpl->transmit = NULL;
381
382 pimpl->error_message = "disconnected.";
383 }
384
385
386 bool RunCtrl::isConnected(void) {
387 return pimpl->isConnected();
388 }
389
390
391 ConnectionInterface*& RunCtrl::getConnection(void) {
392 return pimpl->con;
393 }
394
395
396 void RunCtrl::push_runState(void) {
397 // !!!
398 }
399
400
401 void RunCtrl::pop_runState(void) {
402 // !!!
403 }
404
405
406 void RunCtrl::set_sendRetryTimes(size_t times) {
407 // !!!
408 }
409
410
411 void RunCtrl::set_recvTimeout(size_t msec) {
412 // !!!
413 }
414
415
416 void RunCtrl::set_watchDogTimer(size_t msec) {
417 // !!!
418 }
419
420
421 void RunCtrl::stop(void) {
422 if (pimpl->isNotConnected()) {
423 return;
424 }
425 pimpl->stop();
426 }
427
428
429 void RunCtrl::set_servoFree(void) {
430 if (pimpl->isNotConnected()) {
431 return;
432 }
433 pimpl->set_servoFree();
434 }
435
436
437 void RunCtrl::follow_line(const CoordinateCtrl* crd,
438 const Position<int>& position) {
439 if (pimpl->isNotConnected()) {
440 return;
441 }
442
443 // •Ŕi‚Í‘Ź“x§Œä
444 // !!!
445
446 // ‰ń“]‚Í’źü’Ǐ]
447 // !!!
448 }
449
450
451 void RunCtrl::follow_circle(const CoordinateCtrl* crd,
452 const Grid<int>& point, const int radius) {
453 if (pimpl->isNotConnected()) {
454 return;
455 }
456
457 // •Ŕi‚Í‘Ź“x§Œä
458 // !!!
459
460 // ‰ń“]‚͉~ŒĘ’Ǐ]
461 // !!!
462 }
463
464
465 void RunCtrl::stop_toLine(const CoordinateCtrl* crd,
466 const Position<int>& position) {
467 if (pimpl->isNotConnected()) {
468 return;
469 }
470
471 // •Ŕi‚ÍˆĘ’u§Œä
472 // !!!
473
474 // ‰ń“]‚ÍˆĘ’u§Œä
475 // !!!
476 }
477
478
479 void RunCtrl::stop_toPoint(const CoordinateCtrl* crd,
480 const Grid<int>& point) {
481 if (pimpl->isNotConnected()) {
482 return;
483 }
484
485 // •Ŕi‚ÍˆĘ’u§Œä
486 // !!!
487
488 // ‰ń“]‚ÍˆĘ’u§Œä
489 // !!!
490 }
491
492
493 void RunCtrl::move_length(const int length) {
494 if (pimpl->isNotConnected()) {
495 return;
496 }
497
498 // •Ŕi‚ÍˆĘ’u§Œä
499 // !!!
500
501 // ‰ń“]‚ÍˆĘ’u§Œä
502 // !!!
503 }
504
505
506 void RunCtrl::rotate_angle(const Angle& angle) {
507 if (pimpl->isNotConnected()) {
508 return;
509 }
510
511 // •Ŕi‚͐§Œä‚Č‚ľ
512 // !!!
513
514 // ‰ń“]‚ÍˆĘ’u§Œä
515 // !!!
516 }
517
518
519 void RunCtrl::stop_toAngle(const CoordinateCtrl* crd, const Angle& angle) {
520 if (pimpl->isNotConnected()) {
521 return;
522 }
523
524 // •Ŕi‚͐§Œä‚Č‚ľ
525 // !!!
526
527 // ‰ń“]‚ÍˆĘ’u§Œä
528 // !!!
529 pimpl->stop_toAngle(angle);
530 }
531
532
533 bool RunCtrl::isStable(void) {
534 if (pimpl->isNotConnected()) {
535 return false;
536 }
537 return pimpl->isStable();
538 }
539
540
541
542 int RunCtrl::getLength_toLine(const CoordinateCtrl* crd,
543 const Position<int>& position) {
544 if (pimpl->isNotConnected()) {
545 return -1;
546 }
547
548 Position<int> own_pos = getPosition(crd);
549 return calculate_getLength_toPosition(own_pos, position);
550 }
551
552
553 int RunCtrl::getLength_toPoint(const CoordinateCtrl* crd,
554 const Grid<int>& point) {
555 if (pimpl->isNotConnected()) {
556 return -1;
557 }
558
559 Position<int> own_pos = getPosition(crd);
560 return calculate_getLength_toPoint(own_pos, point);
561 }
562
563
564 Angle RunCtrl::getAngle_toDirection(void) {
565 if (pimpl->isNotConnected()) {
566 // !!! —áŠO‚𓊂°‚é‚ׂŤ‚ЁH “Š‚°‚˝‚­‚Č‚˘‚Ş...
567 return Angle(deg(-1));
568 }
569
570 // !!!
571 return Angle();
572 }
573
574
575 Angle RunCtrl::getAngle_toPoint(void) {
576 if (pimpl->isNotConnected()) {
577 return Angle(deg(-1));
578 }
579
580 // !!!
581 return Angle();
582 }
583
584
585 Angle RunCtrl::getAngle_toLine(void) {
586 if (pimpl->isNotConnected()) {
587 return Angle(deg(-1));
588 }
589
590 // !!!
591 return Angle();
592 }
593
594
595 int RunCtrl::getVelocityDiff_straight(const int velocity) {
596 if (pimpl->isNotConnected()) {
597 return -1;
598 }
599
600 // !!!
601 return 0;
602 }
603
604
605 Angle RunCtrl::getVelocityDiff_rotate(const Angle velocity) {
606 if (pimpl->isNotConnected()) {
607 return Angle(deg(-1));
608 }
609
610 // !!!
611 return Angle();
612 }
613
614
615 int RunCtrl::getVelocity_straight(void) {
616 if (pimpl->isNotConnected()) {
617 return -1;
618 }
619
620 return pimpl->getVelocity_straight();
621 }
622
623
624 Angle RunCtrl::getVelocity_rotate(void) {
625 if (pimpl->isNotConnected()) {
626 return Angle(deg(-1));
627 }
628
629 // !!!
630 return Angle();
631 }
632
633
634 // void GetParams::RunCtrl::*
635 // void SetParams::RunCtrl::*
636
637 Position<int> RunCtrl::getPosition(const CoordinateCtrl* crd) {
638 if (pimpl->isNotConnected()) {
639 // !!! —áŠO‚𓊂°‚é‚ׂŤ‚ЁH “Š‚°‚˝‚­‚Č‚˘‚Ş...
640 return Position<int>(-1, -1, deg(-1));
641 }
642
643 Position<int> position;
644 pimpl->getPosition(position);
645
646 // !!! crd ‚đl—ś‚ľ‚˝ˆĘ’u‚đ•Ô‚ˇ‚悤‚ɏCł
647 // !!!
648 return position;
649 }
650
651
652 size_t RunCtrl::getRawTimestamp(void) {
653 return pimpl->getRawTimestamp();
654 }
655
656
657 void RunCtrl::direct_setWheelVelocity(const int id, const int velocity_mm) {
658 if (pimpl->isNotConnected()) {
659 return;
660 }
661 pimpl->direct_setWheelVelocity(id, velocity_mm);
662 }
663
664
665 void RunCtrl::direct_setStraightVelocity(const int velocity_mm) {
666 if (pimpl->isNotConnected()) {
667 return;
668 }
669 pimpl->direct_setStraightVelocity(velocity_mm);
670 // !!!
671 }
672
673
674 void RunCtrl::direct_setRotateVelocity(const Angle& velocity_angle) {
675 if (pimpl->isNotConnected()) {
676 return;
677 }
678 pimpl->direct_setRotateVelocity(velocity_angle);
679 }

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