質問するログイン新規登録

質問編集履歴

3

文の修正

2019/02/01 05:33

投稿

SinkuIzumi
SinkuIzumi

スコア10

title CHANGED
File without changes
body CHANGED
@@ -1,8 +1,6 @@
1
1
  leapmotionで親指と人差し指の座標から二点間距離を求めました。
2
- その距離データを使用し、THKのTRX-Sというロボットハンドをリアルタイム制御したいと考えています。
2
+ その距離データを使用し、ロボットハンドを制御したいと考えています。
3
- がTRX-Sを動かすためにはSEEDEdditerという専用の通信モジュールが必要で、SEEDコマンドを入力しないと動作しません。
4
- 現在は、if文などを使用何とか動かしましたが、精度が低く一度しか反応すしかきません。
3
+ ロボットハンドに対て造詣の深い方に助言を頂けると幸いす.
5
- どなたかSEEDコマンドに別端末の位置情報計算データを送る方法やハンドをリアルタイムで制御する方法などご教授いただければ幸いです。
6
4
  よろしくお願いします。
7
5
 
8
6
  ///////////////////////////////////////////////////////
@@ -83,175 +81,4 @@
83
81
 
84
82
  return 0;
85
83
 
86
- }
84
+ }
87
-
88
- ////////////////////////////////
89
- THK TRX-S動作プログラム
90
- ////////////////////////////////
91
- #include<windows.h>
92
- #include<conio.h>
93
- #include<stdio.h>
94
- #include<tchar.h>
95
-
96
- HANDLE hComm;
97
- COMMTIMEOUTS cto;
98
-
99
- int main(int argc, char* argv[])//int argc, _TCHAR*argv[]
100
- {
101
-
102
- hComm = CreateFile(_T("COM6"),
103
- GENERIC_READ | GENERIC_WRITE,
104
- 0,
105
- NULL,
106
- OPEN_EXISTING,
107
- FILE_ATTRIBUTE_NORMAL,
108
- NULL);
109
-
110
- if (hComm == INVALID_HANDLE_VALUE) {
111
- printf("No Serial Communication Response\n");
112
- CloseHandle(hComm);
113
- }
114
- else {
115
- printf("OK\n");
116
- }
117
-
118
- //シリアル通信の設定
119
- DCB dcb;// シリアルポートの構成情報が入る構造体
120
- GetCommState(hComm, &dcb); /*dcbを取得*/
121
-
122
- dcb.BaudRate = 9600; // 速度9600元
123
- dcb.ByteSize = 8; // データ長
124
- dcb.Parity = NOPARITY; // パリティ
125
- dcb.StopBits = ONESTOPBIT; // ストップビット長
126
- //dcb.fOutxCtsFlow = FALSE; // 送信時CTSフロー
127
- //dcb.fRtsControl = RTS_CONTROL_ENABLE; // RTSフロー
128
- SetCommState(hComm, &dcb); // 変更した設定値を書き込み
129
-
130
- DWORD errors;
131
- COMSTAT comStat;
132
- ClearCommError(hComm, &errors, &comStat);
133
- int lengthOfRecieved = comStat.cbInQue;
134
-
135
- char recievedData[100];
136
- DWORD numberOfPut;
137
- ReadFile(hComm, recievedData, lengthOfRecieved, &numberOfPut, NULL);
138
-
139
- const char* pszBuf1 = "S8\r";
140
- int pszBufSize1 = strlen(pszBuf1);
141
- DWORD numberOfPut1 = 4;
142
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);
143
-
144
- const char* pszBuf2 = "O\r";
145
- int pszBufSize2 = strlen(pszBuf2);
146
- DWORD numberOfPut2 = 3;
147
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);
148
-
149
-
150
- //モーター駆動ON//
151
- const char* pszBuf3 = "t3018F100500101000000";
152
- int pszBufSize3 = strlen(pszBuf3);
153
- DWORD numberOfPut3 = 22;
154
- WriteFile(hComm, pszBuf3, pszBufSize3, &numberOfPut3, NULL);
155
-
156
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);
157
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);
158
-
159
- while (1) {
160
- //ハンド閉動作//
161
- const char* pszBuf4 = "t3018F100662500002500"; //"t3018F1006C0064000000"
162
- int pszBufSize4 = strlen(pszBuf4);
163
- DWORD numberOfPut4 = 22;
164
- WriteFile(hComm, pszBuf4, pszBufSize4, &numberOfPut4, NULL);
165
-
166
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
167
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
168
-
169
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
170
-
171
- if (getchar()) {
172
- const char* pszBuf10 = "t3018F100510100000000";
173
- int pszBufSize10 = strlen(pszBuf10);
174
- DWORD numberOfPut10 = 22;
175
- WriteFile(hComm, pszBuf10, pszBufSize10, &numberOfPut10, NULL);
176
-
177
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
178
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
179
- //////////
180
- }
181
-
182
- const char* pszBuf9 = "t3018F100662500005000"; //"t3018F1006C0064000000"
183
- int pszBufSize9 = strlen(pszBuf9);
184
- DWORD numberOfPut9 = 22;
185
- WriteFile(hComm, pszBuf9, pszBufSize9, &numberOfPut9, NULL);
186
-
187
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
188
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
189
-
190
-
191
- //モーター停止(キーボード入力されたら)//
192
- if (getchar()) {
193
- const char* pszBuf5 = "t3018F100510100000000";
194
- int pszBufSize5 = strlen(pszBuf5);
195
- DWORD numberOfPut5 = 22;
196
- WriteFile(hComm, pszBuf5, pszBufSize5, &numberOfPut5, NULL);
197
-
198
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
199
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
200
- //////////
201
- }
202
-
203
- const char* pszBuf11 = "t3018F100662500007500"; //"t3018F1006C0064000000"
204
- int pszBufSize11 = strlen(pszBuf11);
205
- DWORD numberOfPut11 = 22;
206
- WriteFile(hComm, pszBuf11, pszBufSize11, &numberOfPut11, NULL);
207
-
208
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
209
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
210
-
211
-
212
- //モーター停止(キーボード入力されたら)//
213
- if (getchar()) {
214
- const char* pszBuf12 = "t3018F100510100000000";
215
- int pszBufSize12 = strlen(pszBuf12);
216
- DWORD numberOfPut12 = 22;
217
- WriteFile(hComm, pszBuf12, pszBufSize12, &numberOfPut12, NULL);
218
-
219
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
220
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
221
- //////////
222
- }
223
-
224
- const char* pszBuf6 = "t3018F100662500000000"; //"t3018F1006C0064000000"
225
- int pszBufSize6 = strlen(pszBuf6);
226
- DWORD numberOfPut6 = 22;
227
- WriteFile(hComm, pszBuf6, pszBufSize6, &numberOfPut6, NULL);
228
-
229
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
230
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通
231
-
232
- if (getchar()) {
233
- const char* pszBuf7 = "t3018F100510100000000";
234
- int pszBufSize7 = strlen(pszBuf7);
235
- DWORD numberOfPut7 = 22;
236
- WriteFile(hComm, pszBuf7, pszBufSize7, &numberOfPut7, NULL);
237
-
238
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
239
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
240
- //////////
241
- }
242
- }
243
- //モーター駆動OFF//
244
- const char* pszBuf8 = "t3018F100500100000000"; // 送信する文字列
245
- int pszBufSize8 = strlen(pszBuf8);
246
- DWORD numberOfPut8 = 22; // 送信する文字数
247
- WriteFile(hComm, pszBuf8, pszBufSize8, &numberOfPut8, NULL); // ポートへ送信
248
-
249
- WriteFile(hComm, pszBuf1, pszBufSize1, &numberOfPut1, NULL);//CAN通信
250
- WriteFile(hComm, pszBuf2, pszBufSize2, &numberOfPut2, NULL);//CAN通信
251
- //////////
252
-
253
- CloseHandle(hComm);
254
- return 0;
255
- }
256
- ///////////////////////////////////////////
257
- }![TRX-S通信方法](9cd700a8bb8b973b80fe2e172a13c3a3.png)

2

文字修正

2019/02/01 05:33

投稿

SinkuIzumi
SinkuIzumi

スコア10

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

1

文字終生

2018/12/20 06:54

投稿

SinkuIzumi
SinkuIzumi

スコア10

title CHANGED
File without changes
body CHANGED
@@ -1,10 +1,11 @@
1
1
  leapmotionで親指と人差し指の座標から二点間距離を求めました。
2
- その距離データを使用し、THKのTRX-Sというロボットハンドを制御したいと考えています。
2
+ その距離データを使用し、THKのTRX-Sというロボットハンドをリアルタイム制御したいと考えています。
3
3
  がTRX-Sを動かすためにはSEEDEdditerという専用の通信モジュールが必要で、SEEDコマンドを入力しないと動作しません。
4
- 現在は、if文などを使用し何とか動かしましたが、精度が低く一度しか反応しません。
4
+ 現在は、if文などを使用し何とか動かしましたが、精度が低く一度しか反応することかできません。
5
- どなたかSEEDコマンドに別端末の位置情報データを送る方法やハンドをリアルタイムで制御する方法などご教授いただければ幸いです。
5
+ どなたかSEEDコマンドに別端末の位置情報計算データを送る方法やハンドをリアルタイムで制御する方法などご教授いただければ幸いです。
6
6
  よろしくお願いします。
7
7
 
8
+ ///////////////////////////////////////////////////////
8
9
  LeapMotionプログラム
9
10
  ///////////////////////////////////////////////////////
10
11
  #include<iostream>
@@ -83,6 +84,7 @@
83
84
  return 0;
84
85
 
85
86
  }
87
+
86
88
  ////////////////////////////////
87
89
  THK TRX-S動作プログラム
88
90
  ////////////////////////////////
@@ -250,4 +252,6 @@
250
252
 
251
253
  CloseHandle(hComm);
252
254
  return 0;
255
+ }
256
+ ///////////////////////////////////////////
253
257
  }![TRX-S通信方法](9cd700a8bb8b973b80fe2e172a13c3a3.png)