commands.cpp
Go to the documentation of this file.
1 /**********************************************************************************
2  * Katana Native Interface - A C++ interface to the robot arm Katana.
3  * Copyright (C) 2005-2008 Neuronics AG
4  * Check out the AUTHORS file for detailed contact information.
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  **********************************************************************************/
18 // commands.cpp
19 // demo program for KNI libraries
21 #include "kniBase.h"
22 #include "../../include/KNI/kmlMotBase.h"
23 #include <iostream>
24 #include <cstdio>
25 #include <memory>
27 #ifdef WIN32
28 # include <conio.h>
29 #else //LINUX
30 # include "keyboard.h"
31 #endif
32 //Katana object
34 std::unique_ptr<CLMBase> katana;
36 void DisplayHelp() {
37  std::cout << std::endl;
38  std::cout << "-------------------------------------------" << std::endl;
39  std::cout << "Esc: quit program" << std::endl;
40  std::cout << "?: Display this help" << std::endl;
41  std::cout << "j: Calibrate the Katana" << std::endl;
42  std::cout << "c: Set target position, freeze or switch motor off (C Command)" << std::endl;
43  std::cout << "C: Set encoder offset (C Command (motNr. + 128))" << std::endl;
44  std::cout << "d: Read the position, velocity and pwm duty cycle of a motor (D Command)" << std::endl;
45  std::cout << "s: Set and read parameters and limits (S Command)" << std::endl;
46  std::cout << "n: Get all motors command flags or positions at once (N Command)" << std::endl;
47  std::cout << "g: Set the single polynomial movement parameters (G Command)" << std::endl;
48  std::cout << "G: Start the single polynomial movement (G+128 Command)" << std::endl;
49  std::cout << "a: Switch collision detection On and Off (A Command)" << std::endl;
50  std::cout << "z: Read Echo (Z Command)" << std::endl;
51  std::cout << "y: Read the Identification String (Y Command)" << std::endl;
52  std::cout << "x: Read the Katana Command Table (X Command)" << std::endl;
53  std::cout << "e: Read Gripper Sensor Data (E Command)" << std::endl;
54  std::cout << "b: Read the Master firmware-version (B Command)" << std::endl;
55  std::cout << "v: Read the Slave firmware-version (V Command)" << std::endl;
56  std::cout << "i: Get motCommand from slave (I Command)" << std::endl;
57  std::cout << "m: Modbus read and write (M Command)" << std::endl;
58  std::cout << "t: Katana 1.2 I/O (T Command)" << std::endl;
59  std::cout << "o: Navigation Control (O Command)" << std::endl;
60  std::cout << "-------------------------------------------" << std::endl;
61 }
63 // convert two bytes (hi and lo) to short
64 short b2s(byte hi, byte lo) {
65  return (((short) hi) << 8) + ((short) lo);
66 }
68 int main(int argc, char *argv[]) {
69 
70  if (argc != 3) {
71  std::cout << "usage for socketcommands: socketcommands CONFIGFILE"
72  << " IP_ADDR" << std::endl;
73  return 0;
74  }
75 
76  std::cout << "---------------------------" << std::endl;
77  std::cout << "SOCKETCOMMANDS DEMO STARTED" << std::endl;
78  std::cout << "---------------------------" << std::endl;
79 
80  //----------------------------------------------------------------//
81  //open device: a serial port is opened in this case
82  //----------------------------------------------------------------//
83 
84 
85  std::unique_ptr<CCdlSocket> device;
86  std::unique_ptr<CCplSerialCRC> protocol;
87 
88  try {
89 
90  int port = 5566;
91  device.reset(new CCdlSocket(argv[2], port));
92 
93  std::cout << "-------------------------------------------" << std::endl;
94  std::cout << "success: port " << port << " open" << std::endl;
95  std::cout << "-------------------------------------------" << std::endl;
96 
97  //--------------------------------------------------------//
98  //init protocol:
99  //--------------------------------------------------------//
100 
101  protocol.reset(new CCplSerialCRC());
102  protocol->init(device.get());
103  std::cout << "-------------------------------------------" << std::endl;
104  std::cout << "success: protocol initiated" << std::endl;
105  std::cout << "-------------------------------------------" << std::endl;
106 
107 
108  //--------------------------------------------------------//
109  //init robot:
110  //--------------------------------------------------------//
111 
112  katana.reset(new CLMBase());
113  katana->create(argv[1], protocol.get());
114 
115 
116  } catch(Exception &e) {
117  std::cout << "ERROR: " << e.message() << std::endl;
118  return -1;
119  }
120  std::cout << "-------------------------------------------" << std::endl;
121  std::cout << "success: katana initiated" << std::endl;
122  std::cout << "-------------------------------------------" << std::endl;
123 
124  DisplayHelp();
125 
126  // declare variables used in loop
127  byte packet[32]; //packet
128  byte buffer[256]; //readbuf
129  byte size = 0; //readbuf size
130  short param1, param2, param3, param4, param5, param6, param7;
131  char p1, p2;
132  int i;
133 
134  bool loop = true;
135 
136  while (loop) {
137 
138  int input = _getch();
139 
140  try {
141  switch (input) {
142  case 27: //VK_ESCAPE
143  loop = false;
144  break;
145 
146  case '?':
147  DisplayHelp();
148  break;
149 
150  case 'j': //VK_J (Calibration)
151  std::cout << std::endl;
152  std::cout << "Calibrating Katana... ";
153  katana->calibrate();
154  std::cout << "finished." << std::endl;
155  break;
156 
157  case 'c': //VK_C (C Command)
158  std::cout << std::endl;
159  std::cout << "Set target position of a motor, freeze or "
160  << "switch motors off (C Command)" << std::endl;
161 
162  // get parameters
163  std::cout << " motor number: ";
164  std::cin >> param1;
165  if ((param1 < 1) || (param1 > 6)) {
166  break;
167  }
168  std::cout << " motor command flag: ";
169  std::cin >> param2;
170  std::cout << " targetposition: ";
171  std::cin >> param3;
172 
173  // create packet
174  packet[0] = 'C';
175  packet[1] = (byte) param1;
176  packet[2] = (byte) param2;
177  packet[3] = (byte) (param3 >> 8);
178  packet[4] = (byte) param3;
179 
180  // communicate packet
181  protocol->comm(packet, buffer, &size);
182  if (!buffer[0] || ((short) size != 3)) {
183  std::cout << " command failed!" << std::endl;
184  } else {
185  std::cout << " answer:" << std::endl << " >" << buffer[0]
186  << "," << (short) buffer[1] << "," << (short) buffer[2]
187  << "<" << std::endl;
188  }
189  buffer[0] = 0x00;
190  break;
191 
192  case 'C': //VK_C (C Command (motNr. + 128))
193  std::cout << std::endl;
194  std::cout << "Set encoder offset (C Command (motNr. + 128))"
195  << std::endl;
196 
197  // get parameters
198  std::cout << " motor number: ";
199  std::cin >> param1;
200  if ((param1 < 1) || (param1 > 6)) {
201  break;
202  }
203  param1 += 128;
204  std::cout << " motor command flag: ";
205  std::cin >> param2;
206  std::cout << " offset position: ";
207  std::cin >> param3;
208 
209  // create packet
210  packet[0] = 'C';
211  packet[1] = (byte) param1;
212  packet[2] = (byte) param2;
213  packet[3] = (byte) (param3 >> 8);
214  packet[4] = (byte) param3;
215 
216  // communicate packet
217  protocol->comm(packet, buffer, &size);
218  if (!buffer[0] || ((short) size != 3)) {
219  std::cout << " command failed!" << std::endl;
220  } else {
221  std::cout << " answer:" << std::endl << " >" << buffer[0]
222  << "," << (short) buffer[1] - 128 << "," << (short) buffer[2]
223  << "<" << std::endl;
224  }
225  buffer[0] = 0x00;
226  break;
227 
228  case 'd': //VK_D (D Command)
229  std::cout << std::endl;
230  std::cout << "Read the position, velocity and pwm duty cycle "
231  << "of a motor (D Command)" << std::endl;
232 
233  // get parameters
234  std::cout << " motor number: ";
235  std::cin >> param1;
236  if ((param1 < 1) || (param1 > 6)) {
237  break;
238  }
239 
240  // create packet
241  packet[0] = 'D';
242  packet[1] = (byte) param1;
243 
244  // communicate packet
245  protocol->comm(packet, buffer, &size);
246  if (!buffer[0] || ((short) size != 8)) {
247  std::cout << " command failed!" << std::endl;
248  } else {
249  std::cout << " answer:" << std::endl << " >" << buffer[0]
250  << "," << (short) buffer[1] << "," << (short) buffer[2]
251  << "," << b2s(buffer[3], buffer[4]) << ","
252  << b2s(buffer[5], buffer[6]) << ","
253  << (short) buffer[7] << "<" << std::endl;
254  }
255  buffer[0] = 0x00;
256  break;
257 
258  case 's': //VK_S (S Command)
259  std::cout << std::endl;
260  std::cout << "Set and read parameters and limits (S Command)"
261  << std::endl;
262 
263  // get parameters
264  std::cout << " motor number: ";
265  std::cin >> param1;
266  if ((param1 < 1) || (param1 > 6)) {
267  break;
268  }
269  std::cout << " subcommand: ";
270  std::cin >> param2;
271  std::cout << " P1: ";
272  std::cin >> param3;
273  std::cout << " P2: ";
274  std::cin >> param4;
275  std::cout << " P3: ";
276  std::cin >> param5;
277 
278  // create packet
279  packet[0] = 'S';
280  packet[1] = (byte) param1;
281  packet[2] = (byte) param2;
282  packet[3] = (byte) param3;
283  packet[4] = (byte) param4;
284  packet[5] = (byte) param5;
285 
286  // communicate packet
287  protocol->comm(packet, buffer, &size);
288  if (!buffer[0] || ((short) size != 6)) {
289  std::cout << " command failed!" << std::endl;
290  } else {
291  std::cout << " answer:" << std::endl << " >" << buffer[0]
292  << "," << (short) buffer[1] << "," << (short) buffer[2]
293  << "," << (short) buffer[3] << "," << (short) buffer[4]
294  << "," << (short) buffer[5] << "<" << std::endl;
295  }
296  buffer[0] = 0x00;
297  break;
298 
299  case 'n': //VK_N (N Command)
300  std::cout << std::endl;
301  std::cout << "Get all motors command flags or positions at "
302  << "once (N Command)" << std::endl;
303 
304  // get parameters
305  std::cout << " subcommand: ";
306  std::cin >> param1;
307  std::cout << " subsubcommand: ";
308  std::cin >> param2;
309 
310  // create packet
311  packet[0] = 'N';
312  packet[1] = (byte) param1;
313  packet[2] = (byte) param2;
314 
315  // communicate packet
316  protocol->comm(packet, buffer, &size);
317  if (!buffer[0] || ((short) size < 2)) {
318  std::cout << " command failed!" << std::endl;
319  } else {
320  std::cout << " answer:" << std::endl << " >" << buffer[0];
321  for (i = 1; i < (short) size; i++) {
322  std::cout << "," << (short) buffer[i];
323  }
324  std::cout << "<" << std::endl;
325  }
326  buffer[0] = 0x00;
327  break;
328 
329  case 'g': //VK_G (G Command)
330  std::cout << std::endl;
331  std::cout << "Set the single polynomial movement parameters "
332  << "(G Command)" << std::endl;
333 
334  // get parameters
335  std::cout << " motor number: ";
336  std::cin >> param1;
337  if ((param1 < 1) || (param1 > 6)) {
338  break;
339  }
340  std::cout << " target pos: ";
341  std::cin >> param2;
342  std::cout << " time: ";
343  std::cin >> param3;
344  std::cout << " P10: ";
345  std::cin >> param4;
346  std::cout << " P11: ";
347  std::cin >> param5;
348  std::cout << " P12: ";
349  std::cin >> param6;
350  std::cout << " P13: ";
351  std::cin >> param7;
352 
353  // create packet
354  packet[0] = 'G';
355  packet[1] = (byte) param1;
356  packet[2] = (byte) (param2 >> 8);
357  packet[3] = (byte) param2;
358  packet[4] = (byte) (param3 >> 8);
359  packet[5] = (byte) param3;
360  packet[6] = (byte) (param4 >> 8);
361  packet[7] = (byte) param4;
362  packet[8] = (byte) (param5 >> 8);
363  packet[9] = (byte) param5;
364  packet[10] = (byte) (param6 >> 8);
365  packet[11] = (byte) param6;
366  packet[12] = (byte) (param7 >> 8);
367  packet[13] = (byte) param7;
368 
369  // communicate packet
370  protocol->comm(packet, buffer, &size);
371  if (!buffer[0] || ((short) size != 2)) {
372  std::cout << " command failed!" << std::endl;
373  } else {
374  std::cout << " answer:" << std::endl << " >" << buffer[0]
375  << "," << (short) buffer[1] << "<" << std::endl;
376  }
377  buffer[0] = 0x00;
378  break;
379 
380  case 'G': //VK_G (G+128 Command)
381  std::cout << std::endl;
382  std::cout << "Start the single polynomial movement "
383  << "(G+128 Command)" << std::endl;
384 
385  // get parameters
386  std::cout << " subcommand: ";
387  std::cin >> param1;
388  std::cout << " exact flag: ";
389  std::cin >> param2;
390 
391  // create packet
392  packet[0] = 'G' | 0x80;
393  packet[1] = (byte) param1;
394  packet[2] = (byte) param2;
395 
396  // communicate packet
397  protocol->comm(packet, buffer, &size);
398  if (!buffer[0] || ((short) size != 2)) {
399  std::cout << " command failed!" << std::endl;
400  } else {
401  std::cout << " answer:" << std::endl << " >" << buffer[0]
402  << " (g+128)," << (short) buffer[1] << "<"
403  << std::endl;
404  }
405  buffer[0] = 0x00;
406  break;
407 
408  case 'a': //VK_A (A Command)
409  std::cout << std::endl;
410  std::cout << "Switch collision detection On and Off "
411  << "(A Command)" << std::endl;
412 
413  // get parameters
414  std::cout << " master: ";
415  std::cin >> param1;
416  std::cout << " slave: ";
417  std::cin >> param2;
418 
419  // create packet
420  packet[0] = 'A';
421  packet[1] = (byte) param1;
422  packet[2] = (byte) param2;
423 
424  // communicate packet
425  protocol->comm(packet, buffer, &size);
426  if (!buffer[0] || ((short) size != 2)) {
427  std::cout << " command failed!" << std::endl;
428  } else {
429  std::cout << " answer:" << std::endl << " >" << buffer[0]
430  << "," << (short) buffer[1] << "<" << std::endl;
431  }
432  buffer[0] = 0x00;
433  break;
434 
435  case 'z': //VK_Z (Z Command)
436  std::cout << std::endl;
437  std::cout << "Read Echo (Z Command)" << std::endl;
438 
439  // create packet
440  packet[0] = 'Z';
441 
442  // communicate packet
443  protocol->comm(packet, buffer, &size);
444  if (!buffer[0] || ((short) size != 1)) {
445  std::cout << " command failed!" << std::endl;
446  } else {
447  std::cout << " answer:" << std::endl << " >" << buffer[0]
448  << "<" << std::endl;
449  }
450  buffer[0] = 0x00;
451  break;
452 
453  case 'y': //VK_Y (Y Command)
454  std::cout << std::endl;
455  std::cout << "Read the Identification String (Y Command)"
456  << std::endl;
457 
458  // create packet
459  packet[0] = 'Y';
460 
461  // communicate packet
462  protocol->comm(packet, buffer, &size);
463  if (!buffer[0]) {
464  std::cout << " command failed!" << std::endl;
465  } else {
466  buffer[82] = 0; // terminate c-string before \r\n
467  std::cout << " answer:" << std::endl << " >" << buffer
468  << "<" << std::endl;
469  }
470  buffer[0] = 0x00;
471  break;
472 
473  buffer[0] = 0x00;
474  break;
475 
476  case 'x': //VK_X (X Command)
477  std::cout << std::endl;
478  std::cout << "Read the Katana Command Table (X Command)"
479  << std::endl;
480 
481  // create packet
482  packet[0] = 'X';
483 
484  // communicate packet
485  protocol->comm(packet, buffer, &size);
486  if (!buffer[0] || ((short) size < 7) || (((short) size)%6 != 1))
487  {
488  std::cout << " command failed!" << std::endl;
489  } else {
490  std::cout << " answer:" << std::endl << " >" << buffer[0]
491  << "(command table)<" << std::endl << " command table:"
492  << std::endl;
493  for (i = 0; i < (((short) size - 1) / 6); i++) {
494  std::cout << " " << (short) buffer[6*i+1] << ",";
495  if ((short) buffer[6*i+2] < 128) {
496  std::cout << buffer[6*i+2];
497  } else {
498  std::cout << (char) (buffer[6*i+2] & 0x7f)
499  << "+128";
500  }
501  std::cout << "," << (short) buffer[6*i+3] << ","
502  << (short) buffer[6*i+4] << ","
503  << (short) buffer[6*i+5] << ",";
504  if ((short) buffer[6*i+6] < 128) {
505  std::cout << buffer[6*i+6];
506  } else {
507  std::cout << (char) (buffer[6*i+6] & 0x7f)
508  << "+128";
509  }
510  std::cout << std::endl;
511  }
512  }
513  buffer[0] = 0x00;
514  break;
515 
516  case 'e': //VK_E (E Command)
517  std::cout << std::endl;
518  std::cout << "Read Gripper Sensor Data (E Command)"
519  << std::endl;
520 
521  // get parameters
522  std::cout << " sensor controller number: ";
523  std::cin >> param1;
524  if (param1 != 15) {
525  break;
526  }
527 
528  // create packet
529  packet[0] = 'E';
530  packet[1] = (byte) param1;
531 
532  // communicate packet
533  protocol->comm(packet, buffer, &size);
534  if (!buffer[0] || ((short) size != 18)) {
535  std::cout << " command failed!" << std::endl;
536  } else {
537  std::cout << " answer:" << std::endl << " >" << buffer[0]
538  << "," << (short) buffer[1];
539  for (i = 2; i < (short) size; i++) {
540  std::cout << "," << (short) buffer[i];
541  }
542  std::cout << "<" << std::endl;
543  }
544  buffer[0] = 0x00;
545  break;
546 
547  case 'b': //VK_B (B Command)
548  std::cout << std::endl;
549  std::cout << "Read the Master firmware-version (B Command)"
550  << std::endl;
551 
552  // create packet
553  packet[0] = 'B';
554 
555  // communicate packet
556  protocol->comm(packet, buffer, &size);
557  if (!buffer[0] || ((short) size != 3)) {
558  std::cout << " command failed!" << std::endl;
559  } else {
560  std::cout << " answer:" << std::endl << " >" << buffer[0]
561  << "," << (short) buffer[1] << "," << (short) buffer[2]
562  << "<" << std::endl;
563  }
564  buffer[0] = 0x00;
565  break;
566 
567  case 'v': //VK_V (V Command)
568  std::cout << std::endl;
569  std::cout << "Read the Slave firmware-version (V Command)"
570  << std::endl;
571 
572  // get parameters
573  std::cout << " motor number: ";
574  std::cin >> param1;
575  if ((param1 < 1) || (param1 > 6)) {
576  break;
577  }
578 
579  // create packet
580  packet[0] = 'V';
581  packet[1] = (byte) param1;
582  packet[2] = 32;
583 
584  // communicate packet
585  protocol->comm(packet, buffer, &size);
586  if (!buffer[0] || ((short) size != 13)) {
587  std::cout << " command failed!" << std::endl;
588  } else {
589  std::cout << " answer:" << std::endl << " >" << buffer[0];
590  for (i = 1; i < (short) size; i++) {
591  std::cout << "," << (short) buffer[i];
592  }
593  std::cout << "<" << std::endl;
594  }
595  buffer[0] = 0x00;
596  break;
597 
598  case 'i': //VK_I (I Command)
599  std::cout << std::endl;
600  std::cout << "Get motCommand from slave (I Command)"
601  << std::endl;
602 
603  // get parameters
604  std::cout << " motor number: ";
605  std::cin >> param1;
606  if ((param1 < 1) || (param1 > 6)) {
607  break;
608  }
609 
610  // create packet
611  packet[0] = 'I';
612  packet[1] = (byte) param1;
613 
614  // communicate packet
615  protocol->comm(packet, buffer, &size);
616  if (!buffer[0] || ((short) size != 3)) {
617  std::cout << " command failed!" << std::endl;
618  } else {
619  std::cout << " answer:" << std::endl << " >" << buffer[0]
620  << "," << (short) buffer[1] << "," << (short) buffer[2]
621  << "<" << std::endl;
622  }
623  buffer[0] = 0x00;
624  break;
625 
626  case 'm': //VK_M (M Command)
627  std::cout << std::endl;
628  std::cout << "Modbus read and writes (M Command)" << std::endl;
629 
630  // get parameters
631  std::cout << " 'R'ead or 'W'rite: ";
632  std::cin >> p1;
633  if ((p1 != 'R') && (p1 != 'W')) {
634  break;
635  }
636  std::cout << " register: ";
637  std::cin >> param2;
638  std::cout << " value: ";
639  std::cin >> param3;
640 
641  // create packet
642  packet[0] = 'M';
643  packet[1] = (byte) p1;
644  packet[2] = (byte) param2;
645  packet[3] = (byte) (param3 >> 8);
646  packet[4] = (byte) param3;
647 
648  // communicate packet
649  protocol->comm(packet, buffer, &size);
650  if (!buffer[0] || ((short) size != 4)) {
651  std::cout << " command failed!" << std::endl;
652  } else {
653  std::cout << " answer:" << std::endl << " >" << buffer[0]
654  << "," << b2s(buffer[1], buffer[2]) << ","
655  << (short) buffer[3] << "<" << std::endl;
656  }
657  buffer[0] = 0x00;
658  break;
659 
660  case 't': //VK_T (T Command)
661  std::cout << std::endl;
662  std::cout << "Katana 1.2 I/O (T Command)" << std::endl;
663 
664  // get parameters
665  std::cout << " read (r), write (w) or set LED (l): ";
666  std::cin >> p1;
667  if ((p1 != 'r') && (p1 != 'w') && (p1 != 'l')) {
668  break;
669  }
670  if (p1 == 'w') {
671  std::cout << " value to write: ";
672  std::cin >> param2;
673  } else if (p1 == 'l') {
674  std::cout << " set led to 'r'ed, 'g'reen or '0'(off): ";
675  std::cin >> p2;
676  if ((param2 == 'r') || (param2 == 'g')) {
677  param2 = (short) p2;
678  } else {
679  param2 = 0;
680  }
681  } else {
682  param2 = 0;
683  }
684 
685  // create packet
686  packet[0] = 'T';
687  packet[1] = (byte) p1;
688  packet[2] = (byte) param2;
689  packet[3] = 0;
690  packet[4] = 0;
691 
692  // communicate packet
693  protocol->comm(packet, buffer, &size);
694  if (!buffer[0] || ((short) size != 2)) {
695  std::cout << " command failed!" << std::endl;
696  } else {
697  std::cout << " answer:" << std::endl << " >" << buffer[0]
698  << "," << (short) buffer[1] << "<" << std::endl;
699  }
700  buffer[0] = 0x00;
701  break;
702 
703  case 'o': //VK_O (O Command)
704  std::cout << std::endl;
705  std::cout << "Navigation Control (O Command)"
706  << std::endl;
707 
708  // get parameters
709  std::cout << " command: ";
710  std::cin >> param1;
711  if ((param1 < 0) || (param1 > 3)) {
712  break;
713  }
714  //std::cout << " CVar1: ";
715  //std::cin >> param2;
716  param2 = 0;
717 
718  // create packet
719  packet[0] = 'O';
720  packet[1] = (byte) param1;
721  packet[2] = (byte) param2;
722 
723  // communicate packet
724  protocol->comm(packet, buffer, &size);
725  if (!buffer[0] || ((short) size != 3)) {
726  std::cout << " command failed!" << std::endl;
727  } else {
728  std::cout << " answer:" << std::endl << " >" << buffer[0]
729  << "," << (short) buffer[1] << "," << (short) buffer[2]
730  << "<" << std::endl;
731  }
732  buffer[0] = 0x00;
733  break;
734 
735  default: //Error message
736  std::cout << "\n'" << input << "' is not a valid command.\n"
737  << std::endl;
738  break;
739  }
740 
741  } catch (Exception &e) {
742  std::cout << "\nERROR: " << e.message() << std::endl;
743  }
744 
745  }
746  return 0;
747 }
static std::unique_ptr< CCdlSocket > device
Definition: kni_wrapper.cpp:23
unsigned char byte
type specification (8 bit)
Definition: cdlBase.h:29
int main(int argc, char *argv[])
Definition: commands.cpp:68
static std::unique_ptr< CCplSerialCRC > protocol
Definition: kni_wrapper.cpp:24
std::string message() const
short b2s(byte hi, byte lo)
Definition: commands.cpp:64
Implement the Serial-Zero protocol.
Definition: cplSerial.h:137
void DisplayHelp()
Definition: commands.cpp:36
int _getch()
Encapsulates the socket communication device.
Definition: cdlSocket.h:65
Linear movement Class.
Definition: lmBase.h:73
byte packet[32]
Definition: kni_wrapper.cpp:33
byte size
Definition: kni_wrapper.cpp:35
std::unique_ptr< CLMBase > katana
Definition: commands.cpp:34
byte buffer[256]
Definition: kni_wrapper.cpp:34


kni
Author(s): Martin Günther
autogenerated on Fri Jun 7 2019 22:06:44