質問編集履歴

3

文の修正

2019/02/01 05:33

投稿

SinkuIzumi
SinkuIzumi

スコア10

test CHANGED
File without changes
test CHANGED
@@ -1,12 +1,8 @@
1
1
  leapmotionで親指と人差し指の座標から二点間距離を求めました。
2
2
 
3
- その距離データを使用し、THKのTRX-Sというロボットハンドをリアルタイム制御したいと考えています。
3
+ その距離データを使用し、ロボットハンドを制御したいと考えています。
4
4
 
5
- がTRX-Sを動かすためにはSEEDEdditerという専用の通信モジュールが必要で、SEEDコマンドを入力しないと動作しません。
6
-
7
- 現在は、if文など使用し何とか動かしましたが、精度が低く一度しか反応すしかきません。
5
+ ロボットハンドに対して造詣の深い方に助言頂けると幸いす.
8
-
9
- どなたかSEEDコマンドに別端末の位置情報計算データを送る方法やハンドをリアルタイムで制御する方法などご教授いただければ幸いです。
10
6
 
11
7
  よろしくお願いします。
12
8
 
@@ -169,345 +165,3 @@
169
165
 
170
166
 
171
167
  }
172
-
173
-
174
-
175
- ////////////////////////////////
176
-
177
- THK TRX-S動作プログラム
178
-
179
- ////////////////////////////////
180
-
181
- #include<windows.h>
182
-
183
- #include<conio.h>
184
-
185
- #include<stdio.h>
186
-
187
- #include<tchar.h>
188
-
189
-
190
-
191
- HANDLE hComm;
192
-
193
- COMMTIMEOUTS cto;
194
-
195
-
196
-
197
- int main(int argc, char* argv[])//int argc, _TCHAR*argv[]
198
-
199
- {
200
-
201
-
202
-
203
- hComm = CreateFile(_T("COM6"),
204
-
205
- GENERIC_READ | GENERIC_WRITE,
206
-
207
- 0,
208
-
209
- NULL,
210
-
211
- OPEN_EXISTING,
212
-
213
- FILE_ATTRIBUTE_NORMAL,
214
-
215
- NULL);
216
-
217
-
218
-
219
- if (hComm == INVALID_HANDLE_VALUE) {
220
-
221
- printf("No Serial Communication Response\n");
222
-
223
- CloseHandle(hComm);
224
-
225
- }
226
-
227
- else {
228
-
229
- printf("OK\n");
230
-
231
- }
232
-
233
-
234
-
235
- //シリアル通信の設定
236
-
237
- DCB dcb;// シリアルポートの構成情報が入る構造体
238
-
239
- GetCommState(hComm, &dcb); /*dcbを取得*/
240
-
241
-
242
-
243
- dcb.BaudRate = 9600; // 速度9600元
244
-
245
- dcb.ByteSize = 8; // データ長
246
-
247
- dcb.Parity = NOPARITY; // パリティ
248
-
249
- dcb.StopBits = ONESTOPBIT; // ストップビット長
250
-
251
- //dcb.fOutxCtsFlow = FALSE; // 送信時CTSフロー
252
-
253
- //dcb.fRtsControl = RTS_CONTROL_ENABLE; // RTSフロー
254
-
255
- SetCommState(hComm, &dcb); // 変更した設定値を書き込み
256
-
257
-
258
-
259
- DWORD errors;
260
-
261
- COMSTAT comStat;
262
-
263
- ClearCommError(hComm, &errors, &comStat);
264
-
265
- int lengthOfRecieved = comStat.cbInQue;
266
-
267
-
268
-
269
- char recievedData[100];
270
-
271
- DWORD numberOfPut;
272
-
273
- ReadFile(hComm, recievedData, lengthOfRecieved, &numberOfPut, NULL);
274
-
275
-
276
-
277
- const char* pszBuf1 = "S8\r";
278
-
279
- int pszBufSize1 = strlen(pszBuf1);
280
-
281
- DWORD numberOfPut1 = 4;
282
-
283
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);
284
-
285
-
286
-
287
- const char* pszBuf2 = "O\r";
288
-
289
- int pszBufSize2 = strlen(pszBuf2);
290
-
291
- DWORD numberOfPut2 = 3;
292
-
293
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);
294
-
295
-
296
-
297
-
298
-
299
- //モーター駆動ON//
300
-
301
- const char* pszBuf3 = "t3018F100500101000000";
302
-
303
- int pszBufSize3 = strlen(pszBuf3);
304
-
305
- DWORD numberOfPut3 = 22;
306
-
307
- WriteFile(hComm, pszBuf3, pszBufSize3, &numberOfPut3, NULL);
308
-
309
-
310
-
311
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);
312
-
313
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);
314
-
315
-
316
-
317
- while (1) {
318
-
319
- //ハンド閉動作//
320
-
321
- const char* pszBuf4 = "t3018F100662500002500"; //"t3018F1006C0064000000"
322
-
323
- int pszBufSize4 = strlen(pszBuf4);
324
-
325
- DWORD numberOfPut4 = 22;
326
-
327
- WriteFile(hComm, pszBuf4, pszBufSize4, &numberOfPut4, NULL);
328
-
329
-
330
-
331
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
332
-
333
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
334
-
335
-
336
-
337
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
338
-
339
-
340
-
341
- if (getchar()) {
342
-
343
- const char* pszBuf10 = "t3018F100510100000000";
344
-
345
- int pszBufSize10 = strlen(pszBuf10);
346
-
347
- DWORD numberOfPut10 = 22;
348
-
349
- WriteFile(hComm, pszBuf10, pszBufSize10, &numberOfPut10, NULL);
350
-
351
-
352
-
353
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
354
-
355
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
356
-
357
- //////////
358
-
359
- }
360
-
361
-
362
-
363
- const char* pszBuf9 = "t3018F100662500005000"; //"t3018F1006C0064000000"
364
-
365
- int pszBufSize9 = strlen(pszBuf9);
366
-
367
- DWORD numberOfPut9 = 22;
368
-
369
- WriteFile(hComm, pszBuf9, pszBufSize9, &numberOfPut9, NULL);
370
-
371
-
372
-
373
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
374
-
375
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
376
-
377
-
378
-
379
-
380
-
381
- //モーター停止(キーボード入力されたら)//
382
-
383
- if (getchar()) {
384
-
385
- const char* pszBuf5 = "t3018F100510100000000";
386
-
387
- int pszBufSize5 = strlen(pszBuf5);
388
-
389
- DWORD numberOfPut5 = 22;
390
-
391
- WriteFile(hComm, pszBuf5, pszBufSize5, &numberOfPut5, NULL);
392
-
393
-
394
-
395
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
396
-
397
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
398
-
399
- //////////
400
-
401
- }
402
-
403
-
404
-
405
- const char* pszBuf11 = "t3018F100662500007500"; //"t3018F1006C0064000000"
406
-
407
- int pszBufSize11 = strlen(pszBuf11);
408
-
409
- DWORD numberOfPut11 = 22;
410
-
411
- WriteFile(hComm, pszBuf11, pszBufSize11, &numberOfPut11, NULL);
412
-
413
-
414
-
415
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
416
-
417
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
418
-
419
-
420
-
421
-
422
-
423
- //モーター停止(キーボード入力されたら)//
424
-
425
- if (getchar()) {
426
-
427
- const char* pszBuf12 = "t3018F100510100000000";
428
-
429
- int pszBufSize12 = strlen(pszBuf12);
430
-
431
- DWORD numberOfPut12 = 22;
432
-
433
- WriteFile(hComm, pszBuf12, pszBufSize12, &numberOfPut12, NULL);
434
-
435
-
436
-
437
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
438
-
439
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
440
-
441
- //////////
442
-
443
- }
444
-
445
-
446
-
447
- const char* pszBuf6 = "t3018F100662500000000"; //"t3018F1006C0064000000"
448
-
449
- int pszBufSize6 = strlen(pszBuf6);
450
-
451
- DWORD numberOfPut6 = 22;
452
-
453
- WriteFile(hComm, pszBuf6, pszBufSize6, &numberOfPut6, NULL);
454
-
455
-
456
-
457
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
458
-
459
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
460
-
461
-
462
-
463
- if (getchar()) {
464
-
465
- const char* pszBuf7 = "t3018F100510100000000";
466
-
467
- int pszBufSize7 = strlen(pszBuf7);
468
-
469
- DWORD numberOfPut7 = 22;
470
-
471
- WriteFile(hComm, pszBuf7, pszBufSize7, &numberOfPut7, NULL);
472
-
473
-
474
-
475
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
476
-
477
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
478
-
479
- //////////
480
-
481
- }
482
-
483
- }
484
-
485
- //モーター駆動OFF//
486
-
487
- const char* pszBuf8 = "t3018F100500100000000"; // 送信する文字列
488
-
489
- int pszBufSize8 = strlen(pszBuf8);
490
-
491
- DWORD numberOfPut8 = 22; // 送信する文字数
492
-
493
- WriteFile(hComm, pszBuf8, pszBufSize8, &numberOfPut8, NULL); // ポートへ送信
494
-
495
-
496
-
497
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
498
-
499
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
500
-
501
- //////////
502
-
503
-
504
-
505
- CloseHandle(hComm);
506
-
507
- return 0;
508
-
509
- }
510
-
511
- ///////////////////////////////////////////
512
-
513
- }![TRX-S通信方法](9cd700a8bb8b973b80fe2e172a13c3a3.png)

2

文字修正

2019/02/01 05:33

投稿

SinkuIzumi
SinkuIzumi

スコア10

test CHANGED
@@ -1 +1 @@
1
- leapmotionによるTRX-sの操作
1
+ leapmotionによるロボットハンド操作
test CHANGED
File without changes

1

文字終生

2018/12/20 06:54

投稿

SinkuIzumi
SinkuIzumi

スコア10

test CHANGED
File without changes
test CHANGED
@@ -1,17 +1,19 @@
1
1
  leapmotionで親指と人差し指の座標から二点間距離を求めました。
2
2
 
3
- その距離データを使用し、THKのTRX-Sというロボットハンドを制御したいと考えています。
3
+ その距離データを使用し、THKのTRX-Sというロボットハンドをリアルタイム制御したいと考えています。
4
4
 
5
5
  がTRX-Sを動かすためにはSEEDEdditerという専用の通信モジュールが必要で、SEEDコマンドを入力しないと動作しません。
6
6
 
7
- 現在は、if文などを使用し何とか動かしましたが、精度が低く一度しか反応しません。
7
+ 現在は、if文などを使用し何とか動かしましたが、精度が低く一度しか反応することかできません。
8
-
8
+
9
- どなたかSEEDコマンドに別端末の位置情報データを送る方法やハンドをリアルタイムで制御する方法などご教授いただければ幸いです。
9
+ どなたかSEEDコマンドに別端末の位置情報計算データを送る方法やハンドをリアルタイムで制御する方法などご教授いただければ幸いです。
10
10
 
11
11
  よろしくお願いします。
12
12
 
13
13
 
14
14
 
15
+ ///////////////////////////////////////////////////////
16
+
15
17
  LeapMotionプログラム
16
18
 
17
19
  ///////////////////////////////////////////////////////
@@ -168,6 +170,8 @@
168
170
 
169
171
  }
170
172
 
173
+
174
+
171
175
  ////////////////////////////////
172
176
 
173
177
  THK TRX-S動作プログラム
@@ -502,4 +506,8 @@
502
506
 
503
507
  return 0;
504
508
 
509
+ }
510
+
511
+ ///////////////////////////////////////////
512
+
505
513
  }![TRX-S通信方法](9cd700a8bb8b973b80fe2e172a13c3a3.png)