ypspur-interpreter.c
Go to the documentation of this file.
1 // Copyright (c) 2010-2016 The YP-Spur Authors, except where otherwise indicated.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a copy
4 // of this software and associated documentation files (the "Software"), to
5 // deal in the Software without restriction, including without limitation the
6 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 // sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in
11 // all copies or substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 // SOFTWARE.
20 
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <signal.h>
25 #include <setjmp.h>
26 #include <unistd.h>
27 #include <getopt.h>
28 
29 #ifdef HAVE_CONFIG_H
30 #include <config.h>
31 #endif // HAVE_CONFIG_H
32 
33 #if HAVE_LIBREADLINE
34 #include <readline/readline.h>
35 #include <readline/history.h>
36 #endif // HAVE_LIBREADLINE
37 
38 #include <ypspur.h>
39 #include <utility.h>
40 
41 typedef struct SPUR_COMMAND
42 {
43  enum
44  {
45  SPUR_NONE = -1,
99  } id;
100  char name[64];
101  int reqarg;
102  int narg;
103  double arg[3];
104 } SpurCommand;
105 
107  { SPUR_LINE, { "line" }, 3 },
108  { SPUR_STOP_LINE, { "stop_line" }, 3 },
109  { SPUR_CIRCLE, { "circle" }, 3 },
110  { SPUR_SPIN, { "spin" }, 1 },
111  { SPUR_GETPOS, { "get_pos" }, 0 },
112  { SPUR_GETVEL, { "get_vel" }, 0 },
113  { SPUR_GETFORCE, { "get_force" }, 0 },
114  { SPUR_SETPOS, { "set_pos" }, 3 },
115  { SPUR_NEAR_POS, { "near_pos" }, 3 },
116  { SPUR_NEAR_ANG, { "near_ang" }, 2 },
117  { SPUR_OVER_LINE, { "over_line" }, 3 },
118  { SPUR_ADJUSTPOS, { "adjust_pos" }, 3 },
119  { SPUR_SETVEL, { "set_vel" }, 1 },
120  { SPUR_SETANGVEL, { "set_angvel" }, 1 },
121  { SPUR_SETACCEL, { "set_accel" }, 1 },
122  { SPUR_SETANGACCEL, { "set_angaccel" }, 1 },
123  { SPUR_FREE, { "free" }, 0 },
124  { SPUR_OPENFREE, { "openfree" }, 0 },
125  { SPUR_STOP, { "stop" }, 0 },
126  { SPUR_INIT, { "init" }, 0 },
127  { SPUR_FREEZE, { "freeze" }, 0 },
128  { SPUR_UNFREEZE, { "unfreeze" }, 0 },
129  { SPUR_ISFREEZE, { "isfreeze" }, 0 },
130  { SPUR_GETAD, { "get_ad_value" }, 1 },
131  { SPUR_SET_IO_DIR, { "set_io_dir" }, 1 },
132  { SPUR_SET_IO_DATA, { "set_io_data" }, 1 },
133  { SPUR_GET_DEVICE_ERROR_STATE, { "get_device_error_state" }, 1 },
134  { SPUR_VEL, { "vel" }, 2 },
135  { SPUR_WHEEL_VEL, { "wheel_vel" }, 2 },
136  { SPUR_GET_WHEEL_VEL, { "get_wheel_vel" }, 0 },
137  { SPUR_GET_WHEEL_ANG, { "get_wheel_ang" }, 0 },
138  { SPUR_GET_WHEEL_TORQUE, { "get_wheel_torque" }, 0 },
139  { SPUR_WHEEL_TORQUE, { "wheel_torque" }, 2 },
140  { SPUR_ORIENT, { "orient" }, 1 },
141  { SPUR_GET_VREF, { "get_vref" }, 0 },
142  { SPUR_GET_WHEEL_VREF, { "get_wheel_vref" }, 0 },
143  { SPUR_SET_WHEEL_VEL, { "set_wheel_vel" }, 2 },
144  { SPUR_SET_WHEEL_ACCEL, { "set_wheel_accel" }, 2 },
145  { SPUR_WHEEL_ANG, { "wheel_ang" }, 2 },
146  { SPUR_JOINT_TORQUE, { "joint_torque" }, 2 },
147  { SPUR_JOINT_VEL, { "joint_vel" }, 2 },
148  { SPUR_JOINT_ANG, { "joint_ang" }, 2 },
149  { SPUR_JOINT_ANG_VEL, { "joint_ang_vel" }, 3 },
150  { SPUR_SET_JOINT_ACCEL, { "set_joint_accel" }, 2 },
151  { SPUR_SET_JOINT_VEL, { "set_joint_vel" }, 2 },
152  { SPUR_GET_JOINT_VEL, { "get_joint_vel" }, 1 },
153  { SPUR_GET_JOINT_VREF, { "get_joint_vref" }, 1 },
154  { SPUR_GET_JOINT_ANG, { "get_joint_ang" }, 1 },
155  { SPUR_GET_JOINT_TORQUE, { "get_joint_torque" }, 1 },
156  { SPUR_SLEEP, { "sleep" }, 1 },
157  { HELP, { "help" }, 0 },
158  { EXIT, { "exit" }, 0 }
159 };
160 
161 #if HAVE_SIGLONGJMP
162 sigjmp_buf ctrlc_capture;
163 #endif // HAVE_SIGLONGJMP
164 
165 void ctrlc(int num)
166 {
167  printf("\n");
168 #if HAVE_SIGLONGJMP
169  siglongjmp(ctrlc_capture, 1);
170 #endif // HAVE_SIGLONGJMP
171 }
172 
173 int proc_spur_cmd(char *line, int *coordinate)
174 {
175  int i;
177  int lcoordinate;
178  char *argv;
179  int ret;
180  int ad;
181  int error;
182  enum
183  {
184  MODE_COMMAND,
185  MODE_ARG
186  } mode = MODE_COMMAND;
187  char *toksave;
188 
189  spur.id = -1;
190  lcoordinate = *coordinate;
191 
192  argv = strtok_r(line, " >\t\n\r", &toksave);
193  if (!argv)
194  {
195  return 0;
196  }
197 
198  while (argv)
199  {
200  switch (mode)
201  {
202  case MODE_COMMAND:
203  for (i = 0; i < CS_MAX; i++)
204  {
205  if (strcmp(argv, YPSpur_CSName[i]) == 0)
206  {
207  lcoordinate = i;
208  break;
209  }
210  }
211  if (i != CS_MAX)
212  {
213  break;
214  }
215  for (i = 0; i < SPUR_COMMAND_MAX; i++)
216  {
217  if (strcmp(argv, SPUR_COMMAND[i].name) == 0)
218  {
219  spur = SPUR_COMMAND[i];
220  break;
221  }
222  }
223  mode = MODE_ARG;
224  break;
225  default:
226  spur.arg[mode - MODE_ARG] = atof(argv);
227  mode++;
228  spur.narg = mode - MODE_ARG;
229  if (mode > MODE_ARG + 3)
230  break;
231  break;
232  }
233  argv = strtok_r(NULL, " >\t\n\r", &toksave);
234  }
235 
236  if (spur.id < 0)
237  {
238  *coordinate = lcoordinate;
239  return 1;
240  }
241 
242  if (spur.narg < spur.reqarg)
243  {
244  fprintf(stderr, "error: too few arguments to %s\n", spur.name);
245  fflush(stderr);
246  return 0;
247  }
248 
249  switch (spur.id)
250  {
251  case SPUR_LINE:
252  YPSpur_line(lcoordinate, spur.arg[0], spur.arg[1], spur.arg[2]);
253  break;
254  case SPUR_STOP_LINE:
255  YPSpur_stop_line(lcoordinate, spur.arg[0], spur.arg[1], spur.arg[2]);
256  break;
257  case SPUR_CIRCLE:
258  YPSpur_circle(lcoordinate, spur.arg[0], spur.arg[1], spur.arg[2]);
259  break;
260  case SPUR_ORIENT:
261  YPSpur_orient(lcoordinate, spur.arg[0]);
262  break;
263  case SPUR_SPIN:
264  YPSpur_spin(lcoordinate, spur.arg[0]);
265  break;
266  case SPUR_GETPOS:
267  YPSpur_get_pos(lcoordinate, &spur.arg[0], &spur.arg[1], &spur.arg[2]);
268  printf("%f %f %f\n", spur.arg[0], spur.arg[1], spur.arg[2]);
269  break;
270  case SPUR_GETVEL:
271  YPSpur_get_vel(&spur.arg[0], &spur.arg[1]);
272  printf("%f %f\n", spur.arg[0], spur.arg[1]);
273  break;
274  case SPUR_GETFORCE:
275  YPSpur_get_force(&spur.arg[0], &spur.arg[1]);
276  printf("%f %f\n", spur.arg[0], spur.arg[1]);
277  break;
279  YP_get_wheel_torque(&spur.arg[0], &spur.arg[1]);
280  printf("%f %f\n", spur.arg[0], spur.arg[1]);
281  break;
282  case SPUR_GET_VREF:
283  YP_get_vref(&spur.arg[0], &spur.arg[1]);
284  printf("%f %f\n", spur.arg[0], spur.arg[1]);
285  break;
286  case SPUR_GET_WHEEL_VREF:
287  YP_get_wheel_vref(&spur.arg[0], &spur.arg[1]);
288  printf("%f %f\n", spur.arg[0], spur.arg[1]);
289  break;
290  case SPUR_SETPOS:
291  YPSpur_set_pos(lcoordinate, spur.arg[0], spur.arg[1], spur.arg[2]);
292  break;
293  case SPUR_NEAR_POS:
294  ret = YPSpur_near_pos(lcoordinate, spur.arg[0], spur.arg[1], spur.arg[2]);
295  printf("%d\n", ret);
296  break;
297  case SPUR_NEAR_ANG:
298  ret = YPSpur_near_ang(lcoordinate, spur.arg[0], spur.arg[1]);
299  printf("%d\n", ret);
300  break;
301  case SPUR_OVER_LINE:
302  ret = YPSpur_over_line(lcoordinate, spur.arg[0], spur.arg[1], spur.arg[2]);
303  printf("%d\n", ret);
304  break;
305  case SPUR_ADJUSTPOS:
306  YPSpur_adjust_pos(lcoordinate, spur.arg[0], spur.arg[1], spur.arg[2]);
307  break;
308  case SPUR_SETVEL:
309  YPSpur_set_vel(spur.arg[0]);
310  break;
311  case SPUR_SETANGVEL:
312  YPSpur_set_angvel(spur.arg[0]);
313  break;
314  case SPUR_SETACCEL:
315  YPSpur_set_accel(spur.arg[0]);
316  break;
317  case SPUR_SETANGACCEL:
318  YPSpur_set_angaccel(spur.arg[0]);
319  break;
320  case SPUR_STOP:
321  YPSpur_stop();
322  break;
323  case SPUR_INIT:
324  break;
325  case SPUR_FREE:
326  YPSpur_free();
327  break;
328  case SPUR_OPENFREE:
329  YP_openfree();
330  break;
331  case SPUR_FREEZE:
332  YPSpur_freeze();
333  break;
334  case SPUR_UNFREEZE:
335  YPSpur_unfreeze();
336  break;
337  case SPUR_ISFREEZE:
338  ret = YPSpur_isfreeze();
339  printf("%d\n", ret);
340  break;
341  case SPUR_GETAD:
342  ad = YP_get_ad_value((int)spur.arg[0]);
343  printf("%d\n", ad);
344  break;
345  case SPUR_SET_IO_DIR:
346  YP_set_io_dir((int)spur.arg[0]);
347  break;
348  case SPUR_SET_IO_DATA:
349  YP_set_io_data((int)spur.arg[0]);
350  break;
352  YP_get_device_error_state((int)spur.arg[0], &error);
353  printf("%d\n", error);
354  break;
355  case SPUR_VEL:
356  YPSpur_vel(spur.arg[0], spur.arg[1]);
357  break;
358  case SPUR_WHEEL_VEL:
359  YP_wheel_vel(spur.arg[0], spur.arg[1]);
360  break;
361  case SPUR_WHEEL_TORQUE:
362  YP_wheel_torque(spur.arg[0], spur.arg[1]);
363  break;
364  case SPUR_GET_WHEEL_VEL:
365  YP_get_wheel_vel(&spur.arg[0], &spur.arg[1]);
366  printf("%f %f\n", spur.arg[0], spur.arg[1]);
367  break;
368  case SPUR_GET_WHEEL_ANG:
369  YP_get_wheel_ang(&spur.arg[0], &spur.arg[1]);
370  printf("%f %f\n", spur.arg[0], spur.arg[1]);
371  break;
372  case SPUR_SET_WHEEL_VEL:
373  YP_set_wheel_vel(spur.arg[0], spur.arg[1]);
374  break;
376  YP_set_wheel_accel(spur.arg[0], spur.arg[1]);
377  break;
378  case SPUR_WHEEL_ANG:
379  YP_wheel_ang(spur.arg[0], spur.arg[1]);
380  break;
381  case SPUR_JOINT_TORQUE:
382  YP_joint_torque((int)spur.arg[0], spur.arg[1]);
383  break;
384  case SPUR_JOINT_VEL:
385  YP_joint_vel((int)spur.arg[0], spur.arg[1]);
386  break;
387  case SPUR_JOINT_ANG:
388  YP_joint_ang((int)spur.arg[0], spur.arg[1]);
389  break;
390  case SPUR_JOINT_ANG_VEL:
391  YP_joint_ang_vel((int)spur.arg[0], spur.arg[1], spur.arg[2]);
392  break;
394  YP_set_joint_accel((int)spur.arg[0], spur.arg[1]);
395  break;
396  case SPUR_SET_JOINT_VEL:
397  YP_set_joint_vel((int)spur.arg[0], spur.arg[1]);
398  break;
399  case SPUR_GET_JOINT_VEL:
400  YP_get_joint_vel((int)spur.arg[0], &spur.arg[1]);
401  printf("%f\n", spur.arg[1]);
402  break;
403  case SPUR_GET_JOINT_VREF:
404  YP_get_joint_vref((int)spur.arg[0], &spur.arg[1]);
405  printf("%f\n", spur.arg[1]);
406  break;
407  case SPUR_GET_JOINT_ANG:
408  YP_get_joint_ang((int)spur.arg[0], &spur.arg[1]);
409  printf("%f\n", spur.arg[1]);
410  break;
412  YP_get_joint_torque((int)spur.arg[0], &spur.arg[1]);
413  printf("%f\n", spur.arg[1]);
414  break;
415  case SPUR_SLEEP:
416  yp_usleep((int)(spur.arg[0] * 1000.0 * 1000.0));
417  break;
418  case HELP:
419  printf("Usage:\n");
420  printf(" > command arg1 arg2 arg3\n");
421  printf(" > coordinate\n");
422  printf(" > coordinate command arg1 arg2 arg3\n");
423  printf(" > coordinate> command arg1 arg2 arg3\n");
424  printf("Commands:\n");
425  for (i = 0; i < SPUR_COMMAND_MAX; i++)
426  {
427  printf(" %s\n", SPUR_COMMAND[i].name);
428  }
429  printf("Coordinates:\n");
430  for (i = 0; i < CS_MAX + 1; i++)
431  {
432  printf(" %s\n", YPSpur_CSName[i]);
433  }
434  break;
435  case EXIT:
436  return -1;
437  break;
438  default:
439  printf("unknown command\n");
440  }
441  fflush(stdout);
442 
443  return 1;
444 }
445 
446 int proc_spur(char *line, int *coordinate)
447 {
448  char *line_div;
449  char *toksave;
450  int ret;
451 
452  ret = 0;
453  line_div = strtok_r(line, ";\n\r", &toksave);
454  while (line_div)
455  {
456  ret = proc_spur_cmd(line_div, coordinate);
457  if (ret < 0)
458  {
459  break;
460  }
461  line_div = strtok_r(NULL, ";\n\r", &toksave);
462  }
463  return ret;
464 }
465 
466 void print_help(char *argv[])
467 {
468  fprintf(stderr, "USAGE: %s\n", argv[0]);
469  fputs("\t-V | --set-vel VALUE : [m/s] set max vel of SPUR to VALUE\n", stderr);
470  fputs("\t-W | --set-angvel VALUE : [rad/s] set max angvel of SPUR to VALUE\n", stderr);
471  fputs("\t-A | --set-accel VALUE : [m/ss] set accel of SPUR to VALUE\n", stderr);
472  fputs("\t-O | --set-angaccel VALUE : [rad/ss] set angaccel of SPUR to VALUE\n", stderr);
473  fputs("\t-c | --command \"VALUE\" : execute command VALUE\n", stderr);
474  fputs("\t-q | --msq-id VALUE : set message-queue id\n", stderr);
475  fputs("\t-s | --socket IP:PORT : use socket ipc\n", stderr);
476  fputs("\t-h | --help : print this help\n", stderr);
477 }
478 
479 int main(int argc, char *argv[])
480 {
481  int coordinate = CS_FS;
482  char ip[64];
483  int port = 0;
484  int active = 1;
485  int err = 0;
486  double vel = 0;
487  double angvel = 0;
488  double accel = 0;
489  double angaccel = 0;
490  int set_vel = 0;
491  int set_accel = 0;
492  int set_angvel = 0;
493  int set_angaccel = 0;
494  int msqid = 0;
495  struct option options[9] =
496  {
497  { "set-vel", 1, 0, 'V' },
498  { "set-angvel", 1, 0, 'W' },
499  { "set-accel", 1, 0, 'A' },
500  { "set-angaccel", 1, 0, 'O' },
501  { "command", 1, 0, 'c' },
502  { "msq-id", 1, 0, 'q' },
503  { "socket", 1, 0, 's' },
504  { "help", 0, 0, 'h' },
505  { 0, 0, 0, 0 }
506  };
507  int opt;
508 
509  hook_pre_global();
510 
511  while ((opt = getopt_long(argc, argv, "V:W:A:O:c:q:s:h", options, NULL)) != -1)
512  {
513  switch (opt)
514  {
515  case 'V':
516  vel = atof(optarg);
517  set_vel = 1;
518  break;
519  case 'W':
520  angvel = atof(optarg);
521  set_angvel = 1;
522  break;
523  case 'A':
524  accel = atof(optarg);
525  set_accel = 1;
526  break;
527  case 'O':
528  angaccel = atof(optarg);
529  set_angaccel = 1;
530  break;
531  case 'c':
532  if (msqid == -1)
533  YPSpur_init_socket(ip, port);
534  else if (msqid == 0)
535  YPSpur_init();
536  else
537  YPSpur_initex(msqid);
538  proc_spur(optarg, &coordinate);
539  return 1;
540  break;
541  case 'q':
542  msqid = atoi(optarg);
543  break;
544  case 's':
545  strncpy(ip, optarg, 64);
546  {
547  char *p;
548  p = strchr(ip, ':');
549  if (p == NULL)
550  {
551  fprintf(stderr, "USAGE: %s -s ip:port\n", argv[0]);
552  return -1;
553  }
554  *p = 0;
555  port = atoi(p + 1);
556  msqid = -1;
557  }
558  break;
559  case 'h':
560  print_help(argv);
561  return 1;
562  break;
563  default:
564  break;
565  }
566  }
567 
568 #if HAVE_SIGLONGJMP
569  signal(SIGINT, ctrlc);
570 #endif // HAVE_SIGLONGJMP
571 
572  if (msqid == -1)
573  YPSpur_init_socket(ip, port);
574  else if (msqid == 0)
575  YPSpur_init();
576  else
577  YPSpur_initex(msqid);
578 
579  if (set_vel)
580  YPSpur_set_vel(vel);
581  if (set_angvel)
582  YPSpur_set_angvel(angvel);
583  if (set_accel)
584  YPSpur_set_accel(accel);
585  if (set_angaccel)
586  YPSpur_set_angaccel(angaccel);
587 
588 #if HAVE_LIBREADLINE
589  using_history();
590  read_history(".spurip_history");
591 #endif // HAVE_LIBREADLINE
592  while (active)
593  {
594  static char *line = NULL;
595  static char *line_prev = NULL;
596  char text[16];
597 #if !HAVE_LIBREADLINE
598 #if HAVE_GETLINE
599  size_t len;
600 #endif // HAVE_GETLINE
601 #endif // !HAVE_LIBREADLINE
602 #if HAVE_SIGLONGJMP
603  if (sigsetjmp(ctrlc_capture, 1) != 0)
604  {
605 #if HAVE_LIBREADLINE
606  write_history(".spurip_history");
607 #endif // HAVE_LIBREADLINE
608  }
609  else
610 #endif // HAVE_SIGLONGJMP
611  {
612  {
613  // Dummy for error checking
614  double x, y, th;
615  YPSpur_get_pos(CS_GL, &x, &y, &th);
616  }
617  if (YP_get_error_state())
618  {
619  if (msqid == -1)
620  YPSpur_init_socket(ip, port);
621  else if (msqid == 0)
622  YPSpur_init();
623  else
624  YPSpur_initex(msqid);
625  if (set_vel)
626  YPSpur_set_vel(vel);
627  if (set_angvel)
628  YPSpur_set_angvel(angvel);
629  if (set_accel)
630  YPSpur_set_accel(accel);
631  if (set_angaccel)
632  YPSpur_set_angaccel(angaccel);
633  if (err == 0)
634  {
635  fprintf(stderr, "WARN: YPSpur-coordinator terminated.\n");
636  fflush(stderr);
637 #if HAVE_SIGLONGJMP
638  signal(SIGINT, NULL);
639 #endif // HAVE_SIGLONGJMP
640  }
641  err = 1;
642  yp_usleep(50000);
643  continue;
644  }
645  else
646  {
647  if (err == 1)
648  {
649  fprintf(stderr, "INFO: YPSpur-coordinator started.\n");
650  fflush(stderr);
651 #if HAVE_SIGLONGJMP
652  signal(SIGINT, ctrlc);
653 #endif // HAVE_SIGLONGJMP
654  }
655  }
656  err = 0;
657 
658  sprintf(text, "%s> ", YPSpur_CSName[coordinate]);
659 #if HAVE_LIBREADLINE
660  line_prev = line;
661  line = readline(text);
662  if (!line)
663  {
664  // EOF
665  break;
666  }
667  if (strlen(line) > 0)
668  {
669  if (line && line_prev)
670  {
671  if (strcmp(line, line_prev) != 0)
672  {
673  add_history(line);
674  }
675  }
676  else
677  {
678  add_history(line);
679  }
680  }
681 #else
682  printf("%s", text);
683  fflush(stdout);
684  line = NULL;
685 #if HAVE_GETLINE
686  len = 0;
687  getline(&line, &len, stdin);
688  if (len == 0)
689  continue;
690 #else
691  line = malloc(512);
692  fgets(line, 512, stdin);
693 #endif // HAVE_GETLINE
694  line_prev = line;
695 #endif // HAVE_LIBREADLINE
696  if (proc_spur(line, &coordinate) < 0)
697  {
698  active = 0;
699  }
700 
701  if (line_prev)
702  free(line_prev);
703  }
704  }
705  printf("\n");
706 #if HAVE_LIBREADLINE
707  write_history(".spurip_history");
708 #endif // HAVE_LIBREADLINE
709 
710  return 0;
711 }
int proc_spur_cmd(char *line, int *coordinate)
double YP_get_wheel_vref(double *wrref, double *wlref)
Definition: libypspur.c:187
double YPSpur_get_force(double *trans, double *angular)
Definition: libypspur.c:211
void print_help(char *argv[])
void yp_usleep(int usec)
Definition: utility.c:54
int YPSpur_over_line(int cs, double x, double y, double theta)
Definition: libypspur.c:277
double YP_get_joint_vref(int id, double *v)
Definition: libypspur.c:359
int YPSpur_initex(int msq_key)
Definition: libypspur.c:56
int YPSpur_near_ang(int cs, double th, double d)
Definition: libypspur.c:271
int YPSpur_unfreeze(void)
Definition: libypspur.c:115
int proc_spur(char *line, int *coordinate)
int YPSpur_near_pos(int cs, double x, double y, double r)
Definition: libypspur.c:265
int YP_set_io_data(unsigned char data)
Definition: libypspur.c:293
int YP_get_ad_value(int num)
Definition: libypspur.c:283
double YP_get_joint_ang(int id, double *a)
Definition: libypspur.c:364
double p(YPSpur_param id, enum motor_id motor)
Definition: param.c:79
int YPSpur_vel(double v, double w)
Definition: libypspur.c:223
double YPSpur_get_vel(double *v, double *w)
Definition: libypspur.c:175
Definition: ypparam.h:466
char * strtok_r(char *str, const char *delim, char **nextp)
Definition: utility.c:91
int YPSpur_set_pos(int cs, double x, double y, double theta)
Definition: libypspur.c:133
int YP_joint_ang_vel(int id, double a, double v)
Definition: libypspur.c:339
int YP_wheel_ang(double r, double l)
Definition: libypspur.c:319
int YPSpur_set_angaccel(double w)
Definition: libypspur.c:163
enum SPUR_COMMAND::@2 id
double YPSpur_get_pos(int cs, double *x, double *y, double *theta)
Definition: libypspur.c:169
int YP_wheel_vel(double r, double l)
Definition: libypspur.c:299
int YP_openfree(void)
Definition: libypspur.c:127
void hook_pre_global(void)
Definition: utility.c:73
static YPSpur spur
Definition: libypspur.c:42
int YP_set_io_dir(unsigned char dir)
Definition: libypspur.c:288
int ad[16]
Definition: adinput.c:48
int YPSpur_freeze(void)
Definition: libypspur.c:109
int YPSpur_circle(int cs, double x, double y, double r)
Definition: libypspur.c:85
double YP_get_joint_torque(int id, double *t)
Definition: libypspur.c:369
void ctrlc(int num)
double YP_get_device_error_state(int id, int *err)
Definition: libypspur.c:50
Definition: ypparam.h:468
static const char YPSpur_CSName[CS_MAX][16]
Definition: ypparam.h:473
int YPSpur_isfreeze(void)
Definition: libypspur.c:217
int YP_set_wheel_vel(double r, double l)
Definition: libypspur.c:309
int YP_joint_ang(int id, double a)
Definition: libypspur.c:334
int YPSpur_spin(int cs, double theta)
Definition: libypspur.c:91
int YPSpur_set_angvel(double w)
Definition: libypspur.c:151
int YP_joint_torque(int id, double t)
Definition: libypspur.c:324
int YPSpur_line(int cs, double x, double y, double theta)
Definition: libypspur.c:73
struct SPUR_COMMAND SpurCommand
int YPSpur_free(void)
Definition: libypspur.c:121
int YPSpur_init_socket(char *ip, int port)
Definition: libypspur.c:61
int YPSpur_stop(void)
Definition: libypspur.c:103
int YPSpur_set_vel(double v)
Definition: libypspur.c:145
int YPSpur_set_accel(double v)
Definition: libypspur.c:157
double YP_get_wheel_vel(double *wr, double *wl)
Definition: libypspur.c:193
int YP_set_joint_vel(int id, double v)
Definition: libypspur.c:349
int option(ParamOptions option)
Definition: param.c:99
int YPSpur_stop_line(int cs, double x, double y, double theta)
Definition: libypspur.c:79
int YP_get_error_state(void)
Definition: libypspur.c:45
int YP_joint_vel(int id, double v)
Definition: libypspur.c:329
double YP_get_wheel_torque(double *torque_r, double *torque_l)
Definition: libypspur.c:205
int YPSpur_init(void)
Definition: libypspur.c:67
int YPSpur_adjust_pos(int cs, double x, double y, double theta)
Definition: libypspur.c:139
int YP_set_wheel_accel(double r, double l)
Definition: libypspur.c:314
double YP_get_vref(double *vref, double *wref)
Definition: libypspur.c:181
double YP_get_joint_vel(int id, double *v)
Definition: libypspur.c:354
int main(int argc, char *argv[])
int YPSpur_orient(int cs, double theta)
Definition: libypspur.c:97
int YP_wheel_torque(double r, double l)
Definition: libypspur.c:304
double YP_get_wheel_ang(double *theta_r, double *theta_l)
Definition: libypspur.c:199
int YP_set_joint_accel(int id, double a)
Definition: libypspur.c:344


yp-spur
Author(s):
autogenerated on Sat May 11 2019 02:08:24