2 * Copyright Droids Corporation (2009)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (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.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: commands_traj.c,v 1.8 2009-11-08 17:24:33 zer0 Exp $
20 * Olivier MATZ <zer0@droids-corp.org>
26 #include <aversive/pgmspace.h>
27 #include <aversive/wait.h>
28 #include <aversive/error.h>
35 #include <encoders_spi.h>
39 #include <control_system_manager.h>
40 #include <trajectory_manager.h>
41 #include <vect_base.h>
44 #include <obstacle_avoidance.h>
45 #include <blocking_detection_manager.h>
46 #include <robot_system.h>
47 #include <position_manager.h>
51 #include <parse_string.h>
52 #include <parse_num.h>
57 #include "strat_utils.h"
58 #include "strat_base.h"
59 #include "strat_avoid.h"
61 #include "../common/i2c_commands.h"
62 #include "i2c_protocol.h"
64 /**********************************************************/
65 /* Traj_Speeds for trajectory_manager */
67 /* this structure is filled when cmd_traj_speed is parsed successfully */
68 struct cmd_traj_speed_result {
74 /* function called when cmd_traj_speed is parsed successfully */
75 static void cmd_traj_speed_parsed(void *parsed_result, void *data)
77 struct cmd_traj_speed_result * res = parsed_result;
79 if (!strcmp_P(res->arg1, PSTR("angle"))) {
80 trajectory_set_speed(&mainboard.traj, mainboard.traj.d_speed, res->s);
82 else if (!strcmp_P(res->arg1, PSTR("distance"))) {
83 trajectory_set_speed(&mainboard.traj, res->s, mainboard.traj.a_speed);
85 /* else it is a "show" */
87 printf_P(PSTR("angle %u, distance %u\r\n"),
88 mainboard.traj.a_speed,
89 mainboard.traj.d_speed);
92 prog_char str_traj_speed_arg0[] = "traj_speed";
93 parse_pgm_token_string_t cmd_traj_speed_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_traj_speed_result, arg0, str_traj_speed_arg0);
94 prog_char str_traj_speed_arg1[] = "angle#distance";
95 parse_pgm_token_string_t cmd_traj_speed_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_traj_speed_result, arg1, str_traj_speed_arg1);
96 parse_pgm_token_num_t cmd_traj_speed_s = TOKEN_NUM_INITIALIZER(struct cmd_traj_speed_result, s, UINT16);
98 prog_char help_traj_speed[] = "Set traj_speed values for trajectory manager";
99 parse_pgm_inst_t cmd_traj_speed = {
100 .f = cmd_traj_speed_parsed, /* function to call */
101 .data = NULL, /* 2nd arg of func */
102 .help_str = help_traj_speed,
103 .tokens = { /* token list, NULL terminated */
104 (prog_void *)&cmd_traj_speed_arg0,
105 (prog_void *)&cmd_traj_speed_arg1,
106 (prog_void *)&cmd_traj_speed_s,
113 prog_char str_traj_speed_show_arg[] = "show";
114 parse_pgm_token_string_t cmd_traj_speed_show_arg = TOKEN_STRING_INITIALIZER(struct cmd_traj_speed_result, arg1, str_traj_speed_show_arg);
116 prog_char help_traj_speed_show[] = "Show traj_speed values for trajectory manager";
117 parse_pgm_inst_t cmd_traj_speed_show = {
118 .f = cmd_traj_speed_parsed, /* function to call */
119 .data = NULL, /* 2nd arg of func */
120 .help_str = help_traj_speed_show,
121 .tokens = { /* token list, NULL terminated */
122 (prog_void *)&cmd_traj_speed_arg0,
123 (prog_void *)&cmd_traj_speed_show_arg,
128 /**********************************************************/
129 /* circle coef configuration */
131 /* this structure is filled when cmd_circle_coef is parsed successfully */
132 struct cmd_circle_coef_result {
139 /* function called when cmd_circle_coef is parsed successfully */
140 static void cmd_circle_coef_parsed(void *parsed_result, void *data)
142 struct cmd_circle_coef_result *res = parsed_result;
144 if (!strcmp_P(res->arg1, PSTR("set"))) {
145 trajectory_set_circle_coef(&mainboard.traj, res->circle_coef);
148 printf_P(PSTR("circle_coef %2.2f\r\n"), mainboard.traj.circle_coef);
151 prog_char str_circle_coef_arg0[] = "circle_coef";
152 parse_pgm_token_string_t cmd_circle_coef_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_circle_coef_result, arg0, str_circle_coef_arg0);
153 prog_char str_circle_coef_arg1[] = "set";
154 parse_pgm_token_string_t cmd_circle_coef_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_circle_coef_result, arg1, str_circle_coef_arg1);
155 parse_pgm_token_num_t cmd_circle_coef_val = TOKEN_NUM_INITIALIZER(struct cmd_circle_coef_result, circle_coef, FLOAT);
157 prog_char help_circle_coef[] = "Set circle coef";
158 parse_pgm_inst_t cmd_circle_coef = {
159 .f = cmd_circle_coef_parsed, /* function to call */
160 .data = NULL, /* 2nd arg of func */
161 .help_str = help_circle_coef,
162 .tokens = { /* token list, NULL terminated */
163 (prog_void *)&cmd_circle_coef_arg0,
164 (prog_void *)&cmd_circle_coef_arg1,
165 (prog_void *)&cmd_circle_coef_val,
172 prog_char str_circle_coef_show_arg[] = "show";
173 parse_pgm_token_string_t cmd_circle_coef_show_arg = TOKEN_STRING_INITIALIZER(struct cmd_circle_coef_result, arg1, str_circle_coef_show_arg);
175 prog_char help_circle_coef_show[] = "Show circle coef";
176 parse_pgm_inst_t cmd_circle_coef_show = {
177 .f = cmd_circle_coef_parsed, /* function to call */
178 .data = NULL, /* 2nd arg of func */
179 .help_str = help_circle_coef_show,
180 .tokens = { /* token list, NULL terminated */
181 (prog_void *)&cmd_circle_coef_arg0,
182 (prog_void *)&cmd_circle_coef_show_arg,
187 /**********************************************************/
188 /* trajectory window configuration */
190 /* this structure is filled when cmd_trajectory is parsed successfully */
191 struct cmd_trajectory_result {
200 /* function called when cmd_trajectory is parsed successfully */
201 static void cmd_trajectory_parsed(void * parsed_result, void * data)
203 struct cmd_trajectory_result * res = parsed_result;
205 if (!strcmp_P(res->arg1, PSTR("set"))) {
206 trajectory_set_windows(&mainboard.traj, res->d_win,
207 res->a_win, res->a_start);
210 printf_P(PSTR("trajectory %2.2f %2.2f %2.2f\r\n"), mainboard.traj.d_win,
211 DEG(mainboard.traj.a_win_rad), DEG(mainboard.traj.a_start_rad));
214 prog_char str_trajectory_arg0[] = "trajectory";
215 parse_pgm_token_string_t cmd_trajectory_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_trajectory_result, arg0, str_trajectory_arg0);
216 prog_char str_trajectory_arg1[] = "set";
217 parse_pgm_token_string_t cmd_trajectory_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_trajectory_result, arg1, str_trajectory_arg1);
218 parse_pgm_token_num_t cmd_trajectory_d = TOKEN_NUM_INITIALIZER(struct cmd_trajectory_result, d_win, FLOAT);
219 parse_pgm_token_num_t cmd_trajectory_a = TOKEN_NUM_INITIALIZER(struct cmd_trajectory_result, a_win, FLOAT);
220 parse_pgm_token_num_t cmd_trajectory_as = TOKEN_NUM_INITIALIZER(struct cmd_trajectory_result, a_start, FLOAT);
222 prog_char help_trajectory[] = "Set trajectory windows (distance, angle, angle_start)";
223 parse_pgm_inst_t cmd_trajectory = {
224 .f = cmd_trajectory_parsed, /* function to call */
225 .data = NULL, /* 2nd arg of func */
226 .help_str = help_trajectory,
227 .tokens = { /* token list, NULL terminated */
228 (prog_void *)&cmd_trajectory_arg0,
229 (prog_void *)&cmd_trajectory_arg1,
230 (prog_void *)&cmd_trajectory_d,
231 (prog_void *)&cmd_trajectory_a,
232 (prog_void *)&cmd_trajectory_as,
239 prog_char str_trajectory_show_arg[] = "show";
240 parse_pgm_token_string_t cmd_trajectory_show_arg = TOKEN_STRING_INITIALIZER(struct cmd_trajectory_result, arg1, str_trajectory_show_arg);
242 prog_char help_trajectory_show[] = "Show trajectory window configuration";
243 parse_pgm_inst_t cmd_trajectory_show = {
244 .f = cmd_trajectory_parsed, /* function to call */
245 .data = NULL, /* 2nd arg of func */
246 .help_str = help_trajectory_show,
247 .tokens = { /* token list, NULL terminated */
248 (prog_void *)&cmd_trajectory_arg0,
249 (prog_void *)&cmd_trajectory_show_arg,
254 /**********************************************************/
255 /* rs_gains configuration */
257 /* this structure is filled when cmd_rs_gains is parsed successfully */
258 struct cmd_rs_gains_result {
265 /* function called when cmd_rs_gains is parsed successfully */
266 static void cmd_rs_gains_parsed(void * parsed_result, void * data)
268 struct cmd_rs_gains_result * res = parsed_result;
270 if (!strcmp_P(res->arg1, PSTR("set"))) {
271 rs_set_left_ext_encoder(&mainboard.rs, encoders_spi_get_value,
272 LEFT_ENCODER, res->left); // en augmentant on tourne à gauche
273 rs_set_right_ext_encoder(&mainboard.rs, encoders_spi_get_value,
274 RIGHT_ENCODER, res->right); //en augmentant on tourne à droite
276 printf_P(PSTR("rs_gains set "));
277 f64_print(mainboard.rs.left_ext_gain);
279 f64_print(mainboard.rs.right_ext_gain);
280 printf_P(PSTR("\r\n"));
283 prog_char str_rs_gains_arg0[] = "rs_gains";
284 parse_pgm_token_string_t cmd_rs_gains_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_rs_gains_result, arg0, str_rs_gains_arg0);
285 prog_char str_rs_gains_arg1[] = "set";
286 parse_pgm_token_string_t cmd_rs_gains_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_rs_gains_result, arg1, str_rs_gains_arg1);
287 parse_pgm_token_num_t cmd_rs_gains_l = TOKEN_NUM_INITIALIZER(struct cmd_rs_gains_result, left, FLOAT);
288 parse_pgm_token_num_t cmd_rs_gains_r = TOKEN_NUM_INITIALIZER(struct cmd_rs_gains_result, right, FLOAT);
290 prog_char help_rs_gains[] = "Set rs_gains (left, right)";
291 parse_pgm_inst_t cmd_rs_gains = {
292 .f = cmd_rs_gains_parsed, /* function to call */
293 .data = NULL, /* 2nd arg of func */
294 .help_str = help_rs_gains,
295 .tokens = { /* token list, NULL terminated */
296 (prog_void *)&cmd_rs_gains_arg0,
297 (prog_void *)&cmd_rs_gains_arg1,
298 (prog_void *)&cmd_rs_gains_l,
299 (prog_void *)&cmd_rs_gains_r,
306 prog_char str_rs_gains_show_arg[] = "show";
307 parse_pgm_token_string_t cmd_rs_gains_show_arg = TOKEN_STRING_INITIALIZER(struct cmd_rs_gains_result, arg1, str_rs_gains_show_arg);
309 prog_char help_rs_gains_show[] = "Show rs_gains";
310 parse_pgm_inst_t cmd_rs_gains_show = {
311 .f = cmd_rs_gains_parsed, /* function to call */
312 .data = NULL, /* 2nd arg of func */
313 .help_str = help_rs_gains_show,
314 .tokens = { /* token list, NULL terminated */
315 (prog_void *)&cmd_rs_gains_arg0,
316 (prog_void *)&cmd_rs_gains_show_arg,
321 /**********************************************************/
322 /* track configuration */
324 /* this structure is filled when cmd_track is parsed successfully */
325 struct cmd_track_result {
331 /* function called when cmd_track is parsed successfully */
332 static void cmd_track_parsed(void * parsed_result, void * data)
334 struct cmd_track_result * res = parsed_result;
336 if (!strcmp_P(res->arg1, PSTR("set"))) {
337 position_set_physical_params(&mainboard.pos, res->val, DIST_IMP_MM);
339 printf_P(PSTR("track set %f\r\n"), mainboard.pos.phys.track_mm);
342 prog_char str_track_arg0[] = "track";
343 parse_pgm_token_string_t cmd_track_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_track_result, arg0, str_track_arg0);
344 prog_char str_track_arg1[] = "set";
345 parse_pgm_token_string_t cmd_track_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_track_result, arg1, str_track_arg1);
346 parse_pgm_token_num_t cmd_track_val = TOKEN_NUM_INITIALIZER(struct cmd_track_result, val, FLOAT);
348 prog_char help_track[] = "Set track in mm";
349 parse_pgm_inst_t cmd_track = {
350 .f = cmd_track_parsed, /* function to call */
351 .data = NULL, /* 2nd arg of func */
352 .help_str = help_track,
353 .tokens = { /* token list, NULL terminated */
354 (prog_void *)&cmd_track_arg0,
355 (prog_void *)&cmd_track_arg1,
356 (prog_void *)&cmd_track_val,
363 prog_char str_track_show_arg[] = "show";
364 parse_pgm_token_string_t cmd_track_show_arg = TOKEN_STRING_INITIALIZER(struct cmd_track_result, arg1, str_track_show_arg);
366 prog_char help_track_show[] = "Show track";
367 parse_pgm_inst_t cmd_track_show = {
368 .f = cmd_track_parsed, /* function to call */
369 .data = NULL, /* 2nd arg of func */
370 .help_str = help_track_show,
371 .tokens = { /* token list, NULL terminated */
372 (prog_void *)&cmd_track_arg0,
373 (prog_void *)&cmd_track_show_arg,
380 /**********************************************************/
381 /* Pt_Lists for testing traj */
383 #define PT_LIST_SIZE 10
384 static struct xy_point pt_list[PT_LIST_SIZE];
385 static uint16_t pt_list_len = 0;
387 /* this structure is filled when cmd_pt_list is parsed successfully */
388 struct cmd_pt_list_result {
396 /* function called when cmd_pt_list is parsed successfully */
397 static void cmd_pt_list_parsed(void * parsed_result, void * data)
399 struct cmd_pt_list_result * res = parsed_result;
402 if (!strcmp_P(res->arg1, PSTR("append"))) {
403 res->arg2 = pt_list_len;
406 if (!strcmp_P(res->arg1, PSTR("insert")) ||
407 !strcmp_P(res->arg1, PSTR("append"))) {
408 if (res->arg2 > pt_list_len) {
409 printf_P(PSTR("Index too large\r\n"));
412 if (pt_list_len >= PT_LIST_SIZE) {
413 printf_P(PSTR("List is too large\r\n"));
416 memmove(&pt_list[res->arg2+1], &pt_list[res->arg2],
417 PT_LIST_SIZE-1-res->arg2);
418 pt_list[res->arg2].x = res->arg3;
419 pt_list[res->arg2].y = res->arg4;
422 else if (!strcmp_P(res->arg1, PSTR("del"))) {
423 if (pt_list_len <= 0) {
424 printf_P(PSTR("Error: list empty\r\n"));
427 if (res->arg2 > pt_list_len) {
428 printf_P(PSTR("Index too large\r\n"));
431 memmove(&pt_list[res->arg2], &pt_list[res->arg2+1],
432 (PT_LIST_SIZE-1-res->arg2)*sizeof(struct xy_point));
435 else if (!strcmp_P(res->arg1, PSTR("reset"))) {
439 /* else it is a "show" or a "start" */
440 if (pt_list_len == 0) {
441 printf_P(PSTR("List empty\r\n"));
444 for (i=0 ; i<pt_list_len ; i++) {
445 printf_P(PSTR("%d: x=%d y=%d\r\n"), i, pt_list[i].x, pt_list[i].y);
446 if (!strcmp_P(res->arg1, PSTR("start"))) {
447 trajectory_goto_xy_abs(&mainboard.traj, pt_list[i].x, pt_list[i].y);
448 why = wait_traj_end(0xFF); /* all */
450 else if (!strcmp_P(res->arg1, PSTR("avoid_start"))) {
452 why = goto_and_avoid(pt_list[i].x, pt_list[i].y, 0xFF, 0xFF);
453 printf("next point\r\n");
454 if (why != END_OBSTACLE)
458 if (why & (~(END_TRAJ | END_NEAR)))
459 trajectory_stop(&mainboard.traj);
463 prog_char str_pt_list_arg0[] = "pt_list";
464 parse_pgm_token_string_t cmd_pt_list_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_pt_list_result, arg0, str_pt_list_arg0);
465 prog_char str_pt_list_arg1[] = "insert";
466 parse_pgm_token_string_t cmd_pt_list_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_pt_list_result, arg1, str_pt_list_arg1);
467 parse_pgm_token_num_t cmd_pt_list_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_pt_list_result, arg2, UINT16);
468 parse_pgm_token_num_t cmd_pt_list_arg3 = TOKEN_NUM_INITIALIZER(struct cmd_pt_list_result, arg3, INT16);
469 parse_pgm_token_num_t cmd_pt_list_arg4 = TOKEN_NUM_INITIALIZER(struct cmd_pt_list_result, arg4, INT16);
471 prog_char help_pt_list[] = "Insert point in pt_list (idx,x,y)";
472 parse_pgm_inst_t cmd_pt_list = {
473 .f = cmd_pt_list_parsed, /* function to call */
474 .data = NULL, /* 2nd arg of func */
475 .help_str = help_pt_list,
476 .tokens = { /* token list, NULL terminated */
477 (prog_void *)&cmd_pt_list_arg0,
478 (prog_void *)&cmd_pt_list_arg1,
479 (prog_void *)&cmd_pt_list_arg2,
480 (prog_void *)&cmd_pt_list_arg3,
481 (prog_void *)&cmd_pt_list_arg4,
488 prog_char str_pt_list_arg1_append[] = "append";
489 parse_pgm_token_string_t cmd_pt_list_arg1_append = TOKEN_STRING_INITIALIZER(struct cmd_pt_list_result, arg1, str_pt_list_arg1_append);
491 prog_char help_pt_list_append[] = "Append point in pt_list (x,y)";
492 parse_pgm_inst_t cmd_pt_list_append = {
493 .f = cmd_pt_list_parsed, /* function to call */
494 .data = NULL, /* 2nd arg of func */
495 .help_str = help_pt_list_append,
496 .tokens = { /* token list, NULL terminated */
497 (prog_void *)&cmd_pt_list_arg0,
498 (prog_void *)&cmd_pt_list_arg1_append,
499 (prog_void *)&cmd_pt_list_arg3,
500 (prog_void *)&cmd_pt_list_arg4,
507 prog_char str_pt_list_del_arg[] = "del";
508 parse_pgm_token_string_t cmd_pt_list_del_arg = TOKEN_STRING_INITIALIZER(struct cmd_pt_list_result, arg1, str_pt_list_del_arg);
510 prog_char help_pt_list_del[] = "Del or insert point in pt_list (num)";
511 parse_pgm_inst_t cmd_pt_list_del = {
512 .f = cmd_pt_list_parsed, /* function to call */
513 .data = NULL, /* 2nd arg of func */
514 .help_str = help_pt_list_del,
515 .tokens = { /* token list, NULL terminated */
516 (prog_void *)&cmd_pt_list_arg0,
517 (prog_void *)&cmd_pt_list_del_arg,
518 (prog_void *)&cmd_pt_list_arg2,
524 prog_char str_pt_list_show_arg[] = "show#reset#start#avoid_start";
525 parse_pgm_token_string_t cmd_pt_list_show_arg = TOKEN_STRING_INITIALIZER(struct cmd_pt_list_result, arg1, str_pt_list_show_arg);
527 prog_char help_pt_list_show[] = "Show, start or reset pt_list";
528 parse_pgm_inst_t cmd_pt_list_show = {
529 .f = cmd_pt_list_parsed, /* function to call */
530 .data = NULL, /* 2nd arg of func */
531 .help_str = help_pt_list_show,
532 .tokens = { /* token list, NULL terminated */
533 (prog_void *)&cmd_pt_list_arg0,
534 (prog_void *)&cmd_pt_list_show_arg,
541 /**********************************************************/
544 /* this structure is filled when cmd_goto is parsed successfully */
545 struct cmd_goto_result {
553 /* function called when cmd_goto is parsed successfully */
554 static void cmd_goto_parsed(void * parsed_result, void * data)
556 struct cmd_goto_result * res = parsed_result;
560 interrupt_traj_reset();
561 if (!strcmp_P(res->arg1, PSTR("a_rel"))) {
562 trajectory_a_rel(&mainboard.traj, res->arg2);
564 else if (!strcmp_P(res->arg1, PSTR("d_rel"))) {
565 trajectory_d_rel(&mainboard.traj, res->arg2);
567 else if (!strcmp_P(res->arg1, PSTR("a_abs"))) {
568 trajectory_a_abs(&mainboard.traj, res->arg2);
570 else if (!strcmp_P(res->arg1, PSTR("a_to_xy"))) {
571 trajectory_turnto_xy(&mainboard.traj, res->arg2, res->arg3);
573 else if (!strcmp_P(res->arg1, PSTR("a_behind_xy"))) {
574 trajectory_turnto_xy_behind(&mainboard.traj, res->arg2, res->arg3);
576 else if (!strcmp_P(res->arg1, PSTR("xy_rel"))) {
577 trajectory_goto_xy_rel(&mainboard.traj, res->arg2, res->arg3);
579 else if (!strcmp_P(res->arg1, PSTR("xy_abs"))) {
580 trajectory_goto_xy_abs(&mainboard.traj, res->arg2, res->arg3);
582 else if (!strcmp_P(res->arg1, PSTR("avoid"))) {
583 err = goto_and_avoid_forward(res->arg2, res->arg3, 0xFF, 0xFF);
584 if (err != END_TRAJ && err != END_NEAR)
587 else if (!strcmp_P(res->arg1, PSTR("avoid_bw"))) {
588 err = goto_and_avoid_backward(res->arg2, res->arg3, 0xFF, 0xFF);
589 if (err != END_TRAJ && err != END_NEAR)
592 else if (!strcmp_P(res->arg1, PSTR("xy_abs_fow"))) {
593 trajectory_goto_forward_xy_abs(&mainboard.traj, res->arg2, res->arg3);
595 else if (!strcmp_P(res->arg1, PSTR("xy_abs_back"))) {
596 trajectory_goto_backward_xy_abs(&mainboard.traj, res->arg2, res->arg3);
598 else if (!strcmp_P(res->arg1, PSTR("da_rel"))) {
599 trajectory_d_a_rel(&mainboard.traj, res->arg2, res->arg3);
602 while ((err = test_traj_end(0xFF)) == 0) {
604 if (t2 - t1 > 200000) {
605 dump_cs_debug("angle", &mainboard.angle.cs);
606 dump_cs_debug("distance", &mainboard.distance.cs);
610 if (err != END_TRAJ && err != END_NEAR)
612 printf_P(PSTR("returned %s\r\n"), get_err(err));
615 prog_char str_goto_arg0[] = "goto";
616 parse_pgm_token_string_t cmd_goto_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_goto_result, arg0, str_goto_arg0);
617 prog_char str_goto_arg1_a[] = "d_rel#a_rel#a_abs";
618 parse_pgm_token_string_t cmd_goto_arg1_a = TOKEN_STRING_INITIALIZER(struct cmd_goto_result, arg1, str_goto_arg1_a);
619 parse_pgm_token_num_t cmd_goto_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_goto_result, arg2, INT32);
622 prog_char help_goto1[] = "Change orientation of the mainboard";
623 parse_pgm_inst_t cmd_goto1 = {
624 .f = cmd_goto_parsed, /* function to call */
625 .data = NULL, /* 2nd arg of func */
626 .help_str = help_goto1,
627 .tokens = { /* token list, NULL terminated */
628 (prog_void *)&cmd_goto_arg0,
629 (prog_void *)&cmd_goto_arg1_a,
630 (prog_void *)&cmd_goto_arg2,
635 prog_char str_goto_arg1_b[] = "xy_rel#xy_abs#xy_abs_fow#xy_abs_back#da_rel#a_to_xy#avoid#avoid_bw#a_behind_xy";
636 parse_pgm_token_string_t cmd_goto_arg1_b = TOKEN_STRING_INITIALIZER(struct cmd_goto_result, arg1, str_goto_arg1_b);
637 parse_pgm_token_num_t cmd_goto_arg3 = TOKEN_NUM_INITIALIZER(struct cmd_goto_result, arg3, INT32);
640 prog_char help_goto2[] = "Go to a (x,y) or (d,a) position";
641 parse_pgm_inst_t cmd_goto2 = {
642 .f = cmd_goto_parsed, /* function to call */
643 .data = NULL, /* 2nd arg of func */
644 .help_str = help_goto2,
645 .tokens = { /* token list, NULL terminated */
646 (prog_void *)&cmd_goto_arg0,
647 (prog_void *)&cmd_goto_arg1_b,
648 (prog_void *)&cmd_goto_arg2,
649 (prog_void *)&cmd_goto_arg3,
654 /**********************************************************/
657 /* this structure is filled when cmd_position is parsed successfully */
658 struct cmd_position_result {
666 #define AUTOPOS_SPEED_FAST 200
667 static void auto_position(void)
670 uint16_t old_spdd, old_spda;
672 interrupt_traj_reset();
673 strat_get_speed(&old_spdd, &old_spda);
674 strat_set_speed(AUTOPOS_SPEED_FAST, AUTOPOS_SPEED_FAST);
676 trajectory_d_rel(&mainboard.traj, -300);
677 err = wait_traj_end(END_INTR|END_TRAJ|END_BLOCKING);
681 strat_reset_pos(ROBOT_LENGTH/2, 0, 0);
683 trajectory_d_rel(&mainboard.traj, 120);
684 err = wait_traj_end(END_INTR|END_TRAJ);
688 trajectory_a_rel(&mainboard.traj, COLOR_A(90));
689 err = wait_traj_end(END_INTR|END_TRAJ);
693 trajectory_d_rel(&mainboard.traj, -300);
694 err = wait_traj_end(END_INTR|END_TRAJ|END_BLOCKING);
698 strat_reset_pos(DO_NOT_SET_POS, COLOR_Y(ROBOT_LENGTH/2),
701 trajectory_d_rel(&mainboard.traj, 120);
702 err = wait_traj_end(END_INTR|END_TRAJ);
707 trajectory_a_rel(&mainboard.traj, COLOR_A(-40));
708 err = wait_traj_end(END_INTR|END_TRAJ);
713 strat_set_speed(old_spdd, old_spda);
718 strat_set_speed(old_spdd, old_spda);
721 /* function called when cmd_position is parsed successfully */
722 static void cmd_position_parsed(void * parsed_result, void * data)
724 struct cmd_position_result * res = parsed_result;
726 /* display raw position values */
727 if (!strcmp_P(res->arg1, PSTR("reset"))) {
728 position_set(&mainboard.pos, 0, 0, 0);
730 else if (!strcmp_P(res->arg1, PSTR("set"))) {
731 position_set(&mainboard.pos, res->arg2, res->arg3, res->arg4);
733 else if (!strcmp_P(res->arg1, PSTR("autoset_green"))) {
734 mainboard.our_color = I2C_COLOR_GREEN;
735 i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_GREEN);
736 i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_GREEN);
739 else if (!strcmp_P(res->arg1, PSTR("autoset_red"))) {
740 mainboard.our_color = I2C_COLOR_RED;
741 i2c_set_color(I2C_MECHBOARD_ADDR, I2C_COLOR_RED);
742 i2c_set_color(I2C_SENSORBOARD_ADDR, I2C_COLOR_RED);
746 /* else it's just a "show" */
747 printf_P(PSTR("x=%.2f y=%.2f a=%.2f\r\n"),
748 position_get_x_double(&mainboard.pos),
749 position_get_y_double(&mainboard.pos),
750 DEG(position_get_a_rad_double(&mainboard.pos)));
753 prog_char str_position_arg0[] = "position";
754 parse_pgm_token_string_t cmd_position_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg0, str_position_arg0);
755 prog_char str_position_arg1[] = "show#reset#autoset_green#autoset_red";
756 parse_pgm_token_string_t cmd_position_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1);
758 prog_char help_position[] = "Show/reset (x,y,a) position";
759 parse_pgm_inst_t cmd_position = {
760 .f = cmd_position_parsed, /* function to call */
761 .data = NULL, /* 2nd arg of func */
762 .help_str = help_position,
763 .tokens = { /* token list, NULL terminated */
764 (prog_void *)&cmd_position_arg0,
765 (prog_void *)&cmd_position_arg1,
771 prog_char str_position_arg1_set[] = "set";
772 parse_pgm_token_string_t cmd_position_arg1_set = TOKEN_STRING_INITIALIZER(struct cmd_position_result, arg1, str_position_arg1_set);
773 parse_pgm_token_num_t cmd_position_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_position_result, arg2, INT32);
774 parse_pgm_token_num_t cmd_position_arg3 = TOKEN_NUM_INITIALIZER(struct cmd_position_result, arg3, INT32);
775 parse_pgm_token_num_t cmd_position_arg4 = TOKEN_NUM_INITIALIZER(struct cmd_position_result, arg4, INT32);
777 prog_char help_position_set[] = "Set (x,y,a) position";
778 parse_pgm_inst_t cmd_position_set = {
779 .f = cmd_position_parsed, /* function to call */
780 .data = NULL, /* 2nd arg of func */
781 .help_str = help_position_set,
782 .tokens = { /* token list, NULL terminated */
783 (prog_void *)&cmd_position_arg0,
784 (prog_void *)&cmd_position_arg1_set,
785 (prog_void *)&cmd_position_arg2,
786 (prog_void *)&cmd_position_arg3,
787 (prog_void *)&cmd_position_arg4,
793 /**********************************************************/
794 /* strat configuration */
796 /* this structure is filled when cmd_strat_infos is parsed successfully */
797 struct cmd_strat_infos_result {
802 /* function called when cmd_strat_infos is parsed successfully */
803 static void cmd_strat_infos_parsed(void *parsed_result, void *data)
805 struct cmd_strat_infos_result *res = parsed_result;
807 if (!strcmp_P(res->arg1, PSTR("reset"))) {
810 strat_infos.dump_enabled = 1;
811 strat_dump_infos(__FUNCTION__);
814 prog_char str_strat_infos_arg0[] = "strat_infos";
815 parse_pgm_token_string_t cmd_strat_infos_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_strat_infos_result, arg0, str_strat_infos_arg0);
816 prog_char str_strat_infos_arg1[] = "show#reset";
817 parse_pgm_token_string_t cmd_strat_infos_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_strat_infos_result, arg1, str_strat_infos_arg1);
819 prog_char help_strat_infos[] = "reset/show strat_infos";
820 parse_pgm_inst_t cmd_strat_infos = {
821 .f = cmd_strat_infos_parsed, /* function to call */
822 .data = NULL, /* 2nd arg of func */
823 .help_str = help_strat_infos,
824 .tokens = { /* token list, NULL terminated */
825 (prog_void *)&cmd_strat_infos_arg0,
826 (prog_void *)&cmd_strat_infos_arg1,
831 /**********************************************************/
832 /* strat configuration */
834 /* this structure is filled when cmd_strat_conf is parsed successfully */
835 struct cmd_strat_conf_result {
840 /* function called when cmd_strat_conf is parsed successfully */
841 static void cmd_strat_conf_parsed(void *parsed_result, void *data)
843 struct cmd_strat_conf_result *res = parsed_result;
845 if (!strcmp_P(res->arg1, PSTR("base"))) {
846 strat_infos.conf.flags = 0;
847 strat_infos.conf.scan_our_min_time = 90;
848 strat_infos.conf.delay_between_our_scan = 90;
849 strat_infos.conf.scan_opp_min_time = 90;
850 strat_infos.conf.delay_between_opp_scan = 90;
852 else if (!strcmp_P(res->arg1, PSTR("big3"))) {
853 strat_infos.conf.flags =
854 STRAT_CONF_STORE_STATIC2 |
855 STRAT_CONF_BIG_3_TEMPLE;
856 strat_infos.conf.scan_our_min_time = 90;
857 strat_infos.conf.delay_between_our_scan = 90;
858 strat_infos.conf.scan_opp_min_time = 90;
859 strat_infos.conf.delay_between_opp_scan = 90;
861 else if (!strcmp_P(res->arg1, PSTR("base_check"))) {
862 strat_infos.conf.flags = 0;
863 strat_infos.conf.scan_our_min_time = 35;
864 strat_infos.conf.delay_between_our_scan = 90;
865 strat_infos.conf.scan_opp_min_time = 90;
866 strat_infos.conf.delay_between_opp_scan = 90;
868 else if (!strcmp_P(res->arg1, PSTR("big3_check"))) {
869 strat_infos.conf.flags =
870 STRAT_CONF_STORE_STATIC2 |
871 STRAT_CONF_BIG_3_TEMPLE;
872 strat_infos.conf.scan_our_min_time = 35;
873 strat_infos.conf.delay_between_our_scan = 90;
874 strat_infos.conf.scan_opp_min_time = 90;
875 strat_infos.conf.delay_between_opp_scan = 90;
877 else if (!strcmp_P(res->arg1, PSTR("offensive_early"))) {
878 strat_infos.conf.flags =
879 STRAT_CONF_TAKE_ONE_LINTEL |
880 STRAT_CONF_STORE_STATIC2 |
881 STRAT_CONF_EARLY_SCAN |
882 STRAT_CONF_PUSH_OPP_COLS;
883 strat_infos.conf.scan_our_min_time = 50;
884 strat_infos.conf.delay_between_our_scan = 90;
885 strat_infos.conf.scan_opp_min_time = 15;
886 strat_infos.conf.delay_between_opp_scan = 90;
887 strat_infos.conf.wait_opponent = 5;
889 else if (!strcmp_P(res->arg1, PSTR("offensive_late"))) {
890 strat_infos.conf.flags = STRAT_CONF_TAKE_ONE_LINTEL;
891 strat_infos.conf.scan_our_min_time = 90;
892 strat_infos.conf.delay_between_our_scan = 90;
893 strat_infos.conf.scan_opp_min_time = 30;
894 strat_infos.conf.delay_between_opp_scan = 90;
896 else if (!strcmp_P(res->arg1, PSTR("one_on_disc"))) {
897 strat_infos.conf.flags =
898 STRAT_CONF_ONLY_ONE_ON_DISC;
899 strat_infos.conf.scan_our_min_time = 90;
900 strat_infos.conf.delay_between_our_scan = 90;
901 strat_infos.conf.scan_opp_min_time = 90;
902 strat_infos.conf.delay_between_opp_scan = 90;
904 strat_infos.dump_enabled = 1;
908 prog_char str_strat_conf_arg0[] = "strat_conf";
909 parse_pgm_token_string_t cmd_strat_conf_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf_result, arg0, str_strat_conf_arg0);
910 prog_char str_strat_conf_arg1[] = "show#base#big3#base_check#big3_check#offensive_early#offensive_late#one_on_disc";
911 parse_pgm_token_string_t cmd_strat_conf_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf_result, arg1, str_strat_conf_arg1);
913 prog_char help_strat_conf[] = "configure strat options";
914 parse_pgm_inst_t cmd_strat_conf = {
915 .f = cmd_strat_conf_parsed, /* function to call */
916 .data = NULL, /* 2nd arg of func */
917 .help_str = help_strat_conf,
918 .tokens = { /* token list, NULL terminated */
919 (prog_void *)&cmd_strat_conf_arg0,
920 (prog_void *)&cmd_strat_conf_arg1,
925 /**********************************************************/
926 /* strat configuration */
928 /* this structure is filled when cmd_strat_conf2 is parsed successfully */
929 struct cmd_strat_conf2_result {
935 /* function called when cmd_strat_conf2 is parsed successfully */
936 static void cmd_strat_conf2_parsed(void *parsed_result, void *data)
938 struct cmd_strat_conf2_result *res = parsed_result;
941 if (!strcmp_P(res->arg2, PSTR("on")))
946 if (!strcmp_P(res->arg1, PSTR("one_temple_on_disc")))
947 bit = STRAT_CONF_ONLY_ONE_ON_DISC;
948 else if (!strcmp_P(res->arg1, PSTR("bypass_static2")))
949 bit = STRAT_CONF_BYPASS_STATIC2;
950 else if (!strcmp_P(res->arg1, PSTR("take_one_lintel")))
951 bit = STRAT_CONF_TAKE_ONE_LINTEL;
952 else if (!strcmp_P(res->arg1, PSTR("skip_when_check_fail")))
953 bit = STRAT_CONF_TAKE_ONE_LINTEL;
954 else if (!strcmp_P(res->arg1, PSTR("store_static2")))
955 bit = STRAT_CONF_STORE_STATIC2;
956 else if (!strcmp_P(res->arg1, PSTR("big3_temple")))
957 bit = STRAT_CONF_BIG_3_TEMPLE;
958 else if (!strcmp_P(res->arg1, PSTR("early_opp_scan")))
959 bit = STRAT_CONF_EARLY_SCAN;
960 else if (!strcmp_P(res->arg1, PSTR("push_opp_cols")))
961 bit = STRAT_CONF_PUSH_OPP_COLS;
964 strat_infos.conf.flags |= bit;
966 strat_infos.conf.flags &= (~bit);
968 strat_infos.dump_enabled = 1;
972 prog_char str_strat_conf2_arg0[] = "strat_conf";
973 parse_pgm_token_string_t cmd_strat_conf2_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf2_result, arg0, str_strat_conf2_arg0);
974 prog_char str_strat_conf2_arg1[] = "push_opp_cols#one_temple_on_disc#bypass_static2#take_one_lintel#skip_when_check_fail#store_static2#big3_temple#early_opp_scan";
975 parse_pgm_token_string_t cmd_strat_conf2_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf2_result, arg1, str_strat_conf2_arg1);
976 prog_char str_strat_conf2_arg2[] = "on#off";
977 parse_pgm_token_string_t cmd_strat_conf2_arg2 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf2_result, arg2, str_strat_conf2_arg2);
980 prog_char help_strat_conf2[] = "configure strat options";
981 parse_pgm_inst_t cmd_strat_conf2 = {
982 .f = cmd_strat_conf2_parsed, /* function to call */
983 .data = NULL, /* 2nd arg of func */
984 .help_str = help_strat_conf2,
985 .tokens = { /* token list, NULL terminated */
986 (prog_void *)&cmd_strat_conf2_arg0,
987 (prog_void *)&cmd_strat_conf2_arg1,
988 (prog_void *)&cmd_strat_conf2_arg2,
993 /**********************************************************/
994 /* strat configuration */
996 /* this structure is filled when cmd_strat_conf3 is parsed successfully */
997 struct cmd_strat_conf3_result {
1003 /* function called when cmd_strat_conf3 is parsed successfully */
1004 static void cmd_strat_conf3_parsed(void *parsed_result, void *data)
1006 struct cmd_strat_conf3_result *res = parsed_result;
1008 if (!strcmp_P(res->arg1, PSTR("scan_opponent_min_time"))) {
1011 strat_infos.conf.scan_opp_min_time = res->arg2;
1013 else if (!strcmp_P(res->arg1, PSTR("delay_between_opponent_scan"))) {
1016 strat_infos.conf.delay_between_opp_scan = res->arg2;
1018 else if (!strcmp_P(res->arg1, PSTR("scan_our_min_time"))) {
1021 strat_infos.conf.scan_our_min_time = res->arg2;
1023 else if (!strcmp_P(res->arg1, PSTR("delay_between_our_scan"))) {
1026 strat_infos.conf.delay_between_our_scan = res->arg2;
1028 else if (!strcmp_P(res->arg1, PSTR("wait_opponent"))) {
1029 strat_infos.conf.wait_opponent = res->arg2;
1031 else if (!strcmp_P(res->arg1, PSTR("lintel_min_time"))) {
1032 strat_infos.conf.lintel_min_time = res->arg2;
1034 strat_infos.dump_enabled = 1;
1038 prog_char str_strat_conf3_arg0[] = "strat_conf";
1039 parse_pgm_token_string_t cmd_strat_conf3_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf3_result, arg0, str_strat_conf3_arg0);
1040 prog_char str_strat_conf3_arg1[] = "lintel_min_time#scan_opponent_min_time#delay_between_opponent_scan#scan_our_min_time#delay_between_our_scan#wait_opponent";
1041 parse_pgm_token_string_t cmd_strat_conf3_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf3_result, arg1, str_strat_conf3_arg1);
1042 parse_pgm_token_num_t cmd_strat_conf3_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_strat_conf3_result, arg2, UINT16);
1044 prog_char help_strat_conf3[] = "configure strat options";
1045 parse_pgm_inst_t cmd_strat_conf3 = {
1046 .f = cmd_strat_conf3_parsed, /* function to call */
1047 .data = NULL, /* 2nd arg of func */
1048 .help_str = help_strat_conf3,
1049 .tokens = { /* token list, NULL terminated */
1050 (prog_void *)&cmd_strat_conf3_arg0,
1051 (prog_void *)&cmd_strat_conf3_arg1,
1052 (prog_void *)&cmd_strat_conf3_arg2,
1057 /**********************************************************/
1058 /* strat configuration */
1060 /* this structure is filled when cmd_strat_conf4 is parsed successfully */
1061 struct cmd_strat_conf4_result {
1062 fixed_string_t arg0;
1063 fixed_string_t arg1;
1067 /* function called when cmd_strat_conf4 is parsed successfully */
1068 static void cmd_strat_conf4_parsed(void *parsed_result, void *data)
1070 struct cmd_strat_conf4_result *res = parsed_result;
1072 if (!strcmp_P(res->arg1, PSTR("scan_opponent_angle"))) {
1073 strat_infos.conf.scan_opp_angle = res->arg2;
1075 strat_infos.dump_enabled = 1;
1079 prog_char str_strat_conf4_arg0[] = "strat_conf";
1080 parse_pgm_token_string_t cmd_strat_conf4_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf4_result, arg0, str_strat_conf4_arg0);
1081 prog_char str_strat_conf4_arg1[] = "scan_opponent_angle";
1082 parse_pgm_token_string_t cmd_strat_conf4_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_strat_conf4_result, arg1, str_strat_conf4_arg1);
1083 parse_pgm_token_num_t cmd_strat_conf4_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_strat_conf4_result, arg2, UINT16);
1085 prog_char help_strat_conf4[] = "configure strat options";
1086 parse_pgm_inst_t cmd_strat_conf4 = {
1087 .f = cmd_strat_conf4_parsed, /* function to call */
1088 .data = NULL, /* 2nd arg of func */
1089 .help_str = help_strat_conf4,
1090 .tokens = { /* token list, NULL terminated */
1091 (prog_void *)&cmd_strat_conf4_arg0,
1092 (prog_void *)&cmd_strat_conf4_arg1,
1093 (prog_void *)&cmd_strat_conf4_arg2,
1099 /**********************************************************/
1102 /* this structure is filled when cmd_subtraj is parsed successfully */
1103 struct cmd_subtraj_result {
1104 fixed_string_t arg0;
1105 fixed_string_t arg1;
1112 /* function called when cmd_subtraj is parsed successfully */
1113 static void cmd_subtraj_parsed(void *parsed_result, void *data)
1115 struct cmd_subtraj_result *res = parsed_result;
1117 struct column_dispenser *disp;
1119 if (strcmp_P(res->arg1, PSTR("static")) == 0) {
1120 err = strat_static_columns(res->arg2);
1122 else if (strcmp_P(res->arg1, PSTR("static2")) == 0) {
1123 strat_infos.s_cols.configuration = res->arg2;
1124 switch (res->arg2) {
1126 position_set(&mainboard.pos, 1398,
1127 COLOR_Y(1297), COLOR_A(-66));
1130 position_set(&mainboard.pos, 1232,
1131 COLOR_Y(1051), COLOR_A(4));
1134 position_set(&mainboard.pos, 1232,
1135 COLOR_Y(1043), COLOR_A(5));
1138 position_set(&mainboard.pos, 1346,
1139 COLOR_Y(852), COLOR_A(57));
1144 if (res->arg2 == 1 && res->arg3 == 1) {
1145 strat_infos.s_cols.flags = STATIC_COL_LINE1_DONE;
1147 if (res->arg2 == 1 && res->arg3 == 2) {
1148 strat_infos.s_cols.flags = STATIC_COL_LINE2_DONE;
1150 err = strat_static_columns_pass2();
1152 else if (strcmp_P(res->arg1, PSTR("lintel1")) == 0) {
1153 err = strat_goto_lintel_disp(&strat_infos.l1);
1155 else if (strcmp_P(res->arg1, PSTR("lintel2")) == 0) {
1156 err = strat_goto_lintel_disp(&strat_infos.l2);
1158 else if (strcmp_P(res->arg1, PSTR("coldisp1")) == 0) {
1159 disp = &strat_infos.c1;
1160 err = strat_goto_col_disp(&disp);
1162 else if (strcmp_P(res->arg1, PSTR("coldisp2")) == 0) {
1163 disp = &strat_infos.c2;
1164 err = strat_goto_col_disp(&disp);
1166 else if (strcmp_P(res->arg1, PSTR("coldisp3")) == 0) {
1167 disp = &strat_infos.c3;
1168 err = strat_goto_col_disp(&disp);
1170 else if (strcmp_P(res->arg1, PSTR("disc")) == 0) {
1171 if (res->arg2 == 0) {
1172 printf_P(PSTR("bad level\r\n"));
1175 err = strat_goto_disc(res->arg2);
1178 printf_P(PSTR("substrat returned %s\r\n"), get_err(err));
1179 trajectory_hardstop(&mainboard.traj);
1182 prog_char str_subtraj_arg0[] = "subtraj";
1183 parse_pgm_token_string_t cmd_subtraj_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_subtraj_result, arg0, str_subtraj_arg0);
1184 prog_char str_subtraj_arg1[] = "static#disc#lintel1#lintel2#coldisp1#coldisp2#coldisp3#static2";
1185 parse_pgm_token_string_t cmd_subtraj_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_subtraj_result, arg1, str_subtraj_arg1);
1186 parse_pgm_token_num_t cmd_subtraj_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_subtraj_result, arg2, INT32);
1187 parse_pgm_token_num_t cmd_subtraj_arg3 = TOKEN_NUM_INITIALIZER(struct cmd_subtraj_result, arg3, INT32);
1188 parse_pgm_token_num_t cmd_subtraj_arg4 = TOKEN_NUM_INITIALIZER(struct cmd_subtraj_result, arg4, INT32);
1189 parse_pgm_token_num_t cmd_subtraj_arg5 = TOKEN_NUM_INITIALIZER(struct cmd_subtraj_result, arg5, INT32);
1191 prog_char help_subtraj[] = "Test sub-trajectories (a,b,c,d: specific params)";
1192 parse_pgm_inst_t cmd_subtraj = {
1193 .f = cmd_subtraj_parsed, /* function to call */
1194 .data = NULL, /* 2nd arg of func */
1195 .help_str = help_subtraj,
1196 .tokens = { /* token list, NULL terminated */
1197 (prog_void *)&cmd_subtraj_arg0,
1198 (prog_void *)&cmd_subtraj_arg1,
1199 (prog_void *)&cmd_subtraj_arg2,
1200 (prog_void *)&cmd_subtraj_arg3,
1201 (prog_void *)&cmd_subtraj_arg4,
1202 (prog_void *)&cmd_subtraj_arg5,