d2960f4283d02e860254101bbc28b2e9c650dcab
[aversive.git] / modules / devices / robot / trajectory_manager / trajectory_manager.c
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
3  * 
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.
8  *
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  *
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
17  *
18  *  Revision : $Id: trajectory_manager.c,v 1.4.4.17 2009-05-18 12:28:36 zer0 Exp $
19  *
20  */
21
22 /* Trajectory Manager v2 - zer0 - for Eurobot 2008 */
23
24 #include <string.h>
25 #include <stdlib.h>
26 #include <math.h>
27
28 #include <aversive.h>
29 #include <aversive/error.h>
30 #include <scheduler.h>
31 #include <vect2.h>
32
33 #include <position_manager.h>
34 #include <robot_system.h>
35 #include <control_system_manager.h>
36 #include <quadramp.h>
37
38 #include <trajectory_manager.h>
39
40 #define M_2PI (2*M_PI)
41
42 #define DEG(x) ((x) * (180.0 / M_PI))
43 #define RAD(x) ((x) * (M_PI / 180.0))
44
45 static void trajectory_manager_event(void *param);
46
47 /************ INIT FUNCS */
48
49 /** structure initialization */
50 void trajectory_init(struct trajectory *traj)
51 {
52         uint8_t flags;
53
54         IRQ_LOCK(flags);
55         memset(traj, 0, sizeof(struct trajectory));
56         traj->state = READY;
57         traj->scheduler_task = -1;
58         IRQ_UNLOCK(flags);
59 }
60
61 /** structure initialization */
62 void trajectory_set_cs(struct trajectory *traj, struct cs *cs_d, 
63                        struct cs *cs_a)
64 {
65         uint8_t flags;
66         
67         IRQ_LOCK(flags);
68         traj->csm_distance = cs_d;
69         traj->csm_angle = cs_a;
70         IRQ_UNLOCK(flags);
71 }
72
73 /** structure initialization */
74 void trajectory_set_robot_params(struct trajectory *traj, 
75                                  struct robot_system *rs, 
76                                  struct robot_position *pos) 
77 {
78         uint8_t flags;
79         IRQ_LOCK(flags);
80         traj->robot = rs;
81         traj->position = pos;
82         IRQ_UNLOCK(flags);
83 }
84
85 /** set speed consign */
86 void trajectory_set_speed( struct trajectory *traj, int16_t d_speed, int16_t a_speed)
87 {
88         uint8_t flags;
89         IRQ_LOCK(flags);
90         traj->d_speed = d_speed;
91         traj->a_speed = a_speed;
92         IRQ_UNLOCK(flags);
93 }
94
95 /** set windows for trajectory */
96 void trajectory_set_windows(struct trajectory *traj, double d_win,
97                             double a_win_deg, double a_start_deg)
98 {
99         uint8_t flags;
100         IRQ_LOCK(flags);
101         traj->d_win = d_win ;
102         traj->a_win_rad = RAD(a_win_deg);
103         traj->a_start_rad = RAD(a_start_deg);
104         IRQ_UNLOCK(flags);
105 }
106
107 /************ STATIC [ AND USEFUL ] FUNCS */
108
109 /** set speed consign in quadramp filter */
110 static void set_quadramp_speed(struct trajectory *traj, int16_t d_speed, int16_t a_speed)
111 {
112         struct quadramp_filter * q_d, * q_a;
113         q_d = traj->csm_distance->consign_filter_params;
114         q_a = traj->csm_angle->consign_filter_params;
115         quadramp_set_1st_order_vars(q_d, ABS(d_speed), ABS(d_speed));
116         quadramp_set_1st_order_vars(q_a, ABS(a_speed), ABS(a_speed));
117 }
118
119 /** get angle speed consign in quadramp filter */
120 static uint32_t get_quadramp_angle_speed(struct trajectory *traj)
121 {
122         struct quadramp_filter *q_a;
123         q_a = traj->csm_angle->consign_filter_params;
124         return q_a->var_1st_ord_pos;
125 }
126
127 /** get distance speed consign in quadramp filter */
128 static uint32_t get_quadramp_distance_speed(struct trajectory *traj)
129 {
130         struct quadramp_filter *q_d;
131         q_d = traj->csm_distance->consign_filter_params;
132         return q_d->var_1st_ord_pos;
133 }
134
135 /** remove event if any */
136 static void delete_event(struct trajectory *traj)
137 {
138         set_quadramp_speed(traj, traj->d_speed, traj->a_speed);
139         if ( traj->scheduler_task != -1) {
140                 DEBUG(E_TRAJECTORY, "Delete event");
141                 scheduler_del_event(traj->scheduler_task);
142                 traj->scheduler_task = -1;
143         }
144 }
145
146 /** schedule the trajectory event */
147 static void schedule_event(struct trajectory *traj)
148 {
149         if ( traj->scheduler_task != -1) {
150                 DEBUG(E_TRAJECTORY, "Schedule event, already scheduled");
151         }
152         else {
153                 traj->scheduler_task = 
154                         scheduler_add_periodical_event_priority(&trajectory_manager_event,
155                                                                 (void*)traj,
156                                                                 100000L/SCHEDULER_UNIT, 30);
157         }
158 }
159
160 /** do a modulo 2.pi -> [-Pi,+Pi], knowing that 'a' is in [-3Pi,+3Pi] */  
161 static double simple_modulo_2pi(double a)
162 {
163         if (a < -M_PI) {
164                 a += M_2PI;
165         }
166         else if (a > M_PI) {
167                 a -= M_2PI;
168         }
169         return a;
170 }
171
172 /** do a modulo 2.pi -> [-Pi,+Pi] */  
173 static double modulo_2pi(double a)
174 {
175         double res = a - (((int32_t) (a/M_2PI)) * M_2PI);
176         return simple_modulo_2pi(res);
177 }
178
179 /** near the target (dist) ? */
180 static uint8_t is_robot_in_dist_window(struct trajectory *traj, double d_win)
181 {
182         double d = traj->target.pol.distance - rs_get_distance(traj->robot);
183         d = ABS(d);
184         d = d / traj->position->phys.distance_imp_per_mm;
185         return (d < d_win);
186 }
187
188 /** near the target (dist in x,y) ? */
189 static uint8_t is_robot_in_xy_window(struct trajectory *traj, double d_win)
190 {
191         double x1 = traj->target.cart.x;
192         double y1 = traj->target.cart.y;
193         double x2 = position_get_x_double(traj->position);
194         double y2 = position_get_y_double(traj->position);
195         return ( sqrt ((x2-x1) * (x2-x1) + (y2-y1) * (y2-y1)) < d_win );
196 }
197
198 /** near the angle target in radian ? Only valid if
199  *  traj->target.pol.angle is set (i.e. an angle command, not an xy
200  *  command) */
201 static uint8_t is_robot_in_angle_window(struct trajectory *traj, double a_win_rad)
202 {
203         double a;
204         
205         /* convert relative angle from imp to rad */
206         a = traj->target.pol.angle - rs_get_angle(traj->robot);
207         a /= traj->position->phys.distance_imp_per_mm;
208         a /= traj->position->phys.track_mm;
209         a *= 2.;
210         return ABS(a) < a_win_rad;
211 }
212
213
214 /************ SIMPLE TRAJS, NO EVENT */
215
216 #define UPDATE_D 1
217 #define UPDATE_A 2
218 #define RESET_D  4
219 #define RESET_A  8
220
221 /** 
222  * update angle and/or distance
223  * this function is not called directly by the user
224  *   traj  : pointer to the trajectory structure
225  *   d_mm  : distance in mm
226  *   a_rad : angle in radian
227  *   flags : what to update (UPDATE_A, UPDATE_D)
228  */
229 void __trajectory_goto_d_a_rel(struct trajectory *traj, double d_mm, 
230                                double a_rad, uint8_t state, uint8_t flags)
231 {
232         int32_t a_consign, d_consign;
233
234         DEBUG(E_TRAJECTORY, "Goto DA/RS rel to d=%f a_rad=%f", d_mm, a_rad);
235         delete_event(traj);
236         traj->state = state;
237         if (flags & UPDATE_A) {
238                 if (flags & RESET_A) {
239                         a_consign = 0;
240                 }
241                 else {
242                         a_consign = (int32_t)(a_rad * (traj->position->phys.distance_imp_per_mm) *
243                                               (traj->position->phys.track_mm) / 2); 
244                 }
245                 a_consign +=  rs_get_angle(traj->robot);
246                 traj->target.pol.angle = a_consign;
247                 cs_set_consign(traj->csm_angle, a_consign);
248         }
249         if (flags & UPDATE_D) {
250                 if (flags & RESET_D) {
251                         d_consign = 0;
252                 }
253                 else {
254                         d_consign = (int32_t)((d_mm) * (traj->position->phys.distance_imp_per_mm));
255                 }
256                 d_consign += rs_get_distance(traj->robot);
257                 traj->target.pol.distance = d_consign;
258                 cs_set_consign(traj->csm_distance, d_consign);
259         }
260 }
261
262 /** go straight forward (d is in mm) */
263 void trajectory_d_rel(struct trajectory *traj, double d_mm)
264 {
265         __trajectory_goto_d_a_rel(traj, d_mm, 0, RUNNING_D,
266                                   UPDATE_D | UPDATE_A | RESET_A);
267 }
268
269 /** update distance consign without changing angle consign */
270 void trajectory_only_d_rel(struct trajectory *traj, double d_mm)
271 {
272         __trajectory_goto_d_a_rel(traj, d_mm, 0, RUNNING_D, UPDATE_D);
273 }
274
275 /** turn by 'a' degrees */
276 void trajectory_a_rel(struct trajectory *traj, double a_deg_rel)
277 {
278         __trajectory_goto_d_a_rel(traj, 0, RAD(a_deg_rel), RUNNING_A,
279                                   UPDATE_A | UPDATE_D | RESET_D);
280 }
281
282 /** turn by 'a' degrees */
283 void trajectory_a_abs(struct trajectory *traj, double a_deg_abs)
284 {
285         double posa = position_get_a_rad_double(traj->position);
286         double a;
287
288         a = RAD(a_deg_abs) - posa;
289         a = modulo_2pi(a);
290         __trajectory_goto_d_a_rel(traj, 0, a, RUNNING_A,
291                                   UPDATE_A | UPDATE_D | RESET_D);
292 }
293
294 /** turn the robot until the point x,y is in front of us */ 
295 void trajectory_turnto_xy(struct trajectory *traj, double x_abs_mm, double y_abs_mm)
296 {
297         double posx = position_get_x_double(traj->position); 
298         double posy = position_get_y_double(traj->position);
299         double posa = position_get_a_rad_double(traj->position);
300
301         DEBUG(E_TRAJECTORY, "Goto Turn To xy %f %f", x_abs_mm, y_abs_mm);
302         __trajectory_goto_d_a_rel(traj, 0,
303                         simple_modulo_2pi(atan2(y_abs_mm - posy, x_abs_mm - posx) - posa),
304                                   RUNNING_A,
305                                   UPDATE_A | UPDATE_D | RESET_D);
306 }
307
308 /** turn the robot until the point x,y is behind us */ 
309 void trajectory_turnto_xy_behind(struct trajectory *traj, double x_abs_mm, double y_abs_mm)
310 {
311         double posx = position_get_x_double(traj->position); 
312         double posy = position_get_y_double(traj->position);
313         double posa = position_get_a_rad_double(traj->position);
314
315         DEBUG(E_TRAJECTORY, "Goto Turn To xy %f %f", x_abs_mm, y_abs_mm);
316         __trajectory_goto_d_a_rel(traj, 0, 
317                         modulo_2pi(atan2(y_abs_mm - posy, x_abs_mm - posx) - posa + M_PI),
318                                   RUNNING_A,
319                                   UPDATE_A | UPDATE_D | RESET_D);
320 }
321
322 /** update angle consign without changing distance consign */
323 void trajectory_only_a_rel(struct trajectory *traj, double a_deg)
324 {
325         __trajectory_goto_d_a_rel(traj, 0, RAD(a_deg), RUNNING_A,
326                                   UPDATE_A);
327 }
328
329 /** update angle consign without changing distance consign */
330 void trajectory_only_a_abs(struct trajectory *traj, double a_deg_abs)
331 {
332         double posa = position_get_a_rad_double(traj->position);
333         double a;
334
335         a = RAD(a_deg_abs) - posa;
336         a = modulo_2pi(a);
337         __trajectory_goto_d_a_rel(traj, 0, a, RUNNING_A, UPDATE_A);
338 }
339
340 /** turn by 'a' degrees */
341 void trajectory_d_a_rel(struct trajectory *traj, double d_mm, double a_deg)
342 {
343         __trajectory_goto_d_a_rel(traj, d_mm, RAD(a_deg),
344                                   RUNNING_AD, UPDATE_A | UPDATE_D);
345 }
346
347 /** set relative angle and distance consign to 0 */
348 void trajectory_stop(struct trajectory *traj)
349 {
350         __trajectory_goto_d_a_rel(traj, 0, 0, READY,
351                                   UPDATE_A | UPDATE_D | RESET_D | RESET_A);
352 }
353
354 /** set relative angle and distance consign to 0, and break any
355  * deceleration ramp in quadramp filter */
356 void trajectory_hardstop(struct trajectory *traj)
357 {
358         struct quadramp_filter *q_d, *q_a;
359
360         q_d = traj->csm_distance->consign_filter_params;
361         q_a = traj->csm_angle->consign_filter_params;
362         __trajectory_goto_d_a_rel(traj, 0, 0, READY,
363                                   UPDATE_A | UPDATE_D | RESET_D | RESET_A);
364
365         q_d->previous_var = 0;
366         q_d->previous_out = rs_get_distance(traj->robot);
367         q_a->previous_var = 0;
368         q_a->previous_out = rs_get_angle(traj->robot);
369 }
370
371
372 /************ GOTO XY, USE EVENTS */
373
374 /** goto a x,y point, using a trajectory event */
375 void trajectory_goto_xy_abs(struct trajectory *traj, double x, double y)
376 {
377         DEBUG(E_TRAJECTORY, "Goto XY");
378         delete_event(traj);
379         traj->target.cart.x = x;
380         traj->target.cart.y = y;
381         traj->state = RUNNING_XY_START;
382         trajectory_manager_event(traj);
383         schedule_event(traj);
384 }
385
386 /** go forward to a x,y point, using a trajectory event */
387 void trajectory_goto_forward_xy_abs(struct trajectory *traj, double x, double y)
388 {
389         DEBUG(E_TRAJECTORY, "Goto XY_F");
390         delete_event(traj);
391         traj->target.cart.x = x;
392         traj->target.cart.y = y;
393         traj->state = RUNNING_XY_F_START;
394         trajectory_manager_event(traj);
395         schedule_event(traj);
396 }
397
398 /** go backward to a x,y point, using a trajectory event */
399 void trajectory_goto_backward_xy_abs(struct trajectory *traj, double x, double y)
400 {
401         DEBUG(E_TRAJECTORY, "Goto XY_B");
402         delete_event(traj);
403         traj->target.cart.x = x;
404         traj->target.cart.y = y;
405         traj->state = RUNNING_XY_B_START;
406         trajectory_manager_event(traj);
407         schedule_event(traj);
408 }
409
410 /** go forward to a d,a point, using a trajectory event */
411 void trajectory_goto_d_a_rel(struct trajectory *traj, double d, double a)
412 {
413         vect2_pol p;
414         double x = position_get_x_double(traj->position); 
415         double y = position_get_y_double(traj->position);
416         
417         DEBUG(E_TRAJECTORY, "Goto DA rel");
418
419         delete_event(traj);
420         p.r = d;
421         p.theta = RAD(a) + position_get_a_rad_double(traj->position);
422         vect2_pol2cart(&p, &traj->target.cart);
423         traj->target.cart.x += x;
424         traj->target.cart.y += y;
425         
426         traj->state = RUNNING_XY_START;
427         trajectory_manager_event(traj);
428         schedule_event(traj);
429 }
430
431 /** go forward to a x,y relative point, using a trajectory event */
432 void trajectory_goto_xy_rel(struct trajectory *traj, double x_rel_mm, double y_rel_mm)
433 {
434         vect2_cart c;
435         vect2_pol p;
436         double x = position_get_x_double(traj->position); 
437         double y = position_get_y_double(traj->position);
438
439         DEBUG(E_TRAJECTORY, "Goto XY rel");
440
441         delete_event(traj);
442         c.x = x_rel_mm;
443         c.y = y_rel_mm;
444
445         vect2_cart2pol(&c, &p);
446         p.theta += position_get_a_rad_double(traj->position);;
447         vect2_pol2cart(&p, &traj->target.cart);
448
449         traj->target.cart.x += x;
450         traj->target.cart.y += y;
451         
452         traj->state = RUNNING_XY_START;
453         trajectory_manager_event(traj);
454         schedule_event(traj);
455 }
456
457 /************ FUNCS FOR GETTING TRAJ STATE */
458
459 /** return true if the position consign is equal to the filtered
460  * position consign (after quadramp filter), for angle and
461  * distance. */
462 uint8_t trajectory_finished(struct trajectory *traj)
463 {
464         return cs_get_consign(traj->csm_angle) == cs_get_filtered_consign(traj->csm_angle) &&
465                 cs_get_consign(traj->csm_distance) == cs_get_filtered_consign(traj->csm_distance) ;
466 }
467
468 /** return true if traj is nearly finished */
469 uint8_t trajectory_in_window(struct trajectory *traj, double d_win, double a_win_rad)
470 {
471         switch(traj->state) {
472
473         case RUNNING_XY_ANGLE_OK: 
474         case RUNNING_XY_F_ANGLE_OK: 
475         case RUNNING_XY_B_ANGLE_OK: 
476                 /* if robot coordinates are near the x,y target */
477                 return is_robot_in_xy_window(traj, d_win);
478
479         case RUNNING_A: 
480                 return is_robot_in_angle_window(traj, a_win_rad);
481
482         case RUNNING_D:
483                 return is_robot_in_dist_window(traj, d_win);
484
485         case RUNNING_AD:
486                 return is_robot_in_dist_window(traj, d_win) && 
487                         is_robot_in_angle_window(traj, a_win_rad);
488
489         case RUNNING_XY_START: 
490         case RUNNING_XY_F_START:
491         case RUNNING_XY_B_START:
492         case RUNNING_XY_ANGLE: 
493         case RUNNING_XY_F_ANGLE:
494         case RUNNING_XY_B_ANGLE:
495         default:
496                 return 0;
497         }
498 }
499
500 /*********** *TRAJECTORY EVENT FUNC */
501
502 /** event called for xy trajectories */
503 static void trajectory_manager_event(void * param)
504 {
505         struct trajectory *traj = (struct trajectory *)param;
506         double coef=1.0;
507         double x = position_get_x_double(traj->position); 
508         double y = position_get_y_double(traj->position);
509         double a = position_get_a_rad_double(traj->position);
510         int32_t d_consign=0, a_consign=0;
511         
512         /* These vectors contain target position of the robot in
513          * its own coordinates */
514         vect2_cart v2cart_pos;
515         vect2_pol v2pol_target;
516
517         /* step 1 : process new commands to quadramps */
518
519         switch (traj->state) {
520         case RUNNING_XY_START:
521         case RUNNING_XY_ANGLE:
522         case RUNNING_XY_ANGLE_OK:
523         case RUNNING_XY_F_START:
524         case RUNNING_XY_F_ANGLE:
525         case RUNNING_XY_F_ANGLE_OK:
526         case RUNNING_XY_B_START:
527         case RUNNING_XY_B_ANGLE:
528         case RUNNING_XY_B_ANGLE_OK:
529
530                 /* process the command vector from absolute target and
531                  * current position */
532                 v2cart_pos.x = traj->target.cart.x - x;
533                 v2cart_pos.y = traj->target.cart.y - y;
534                 vect2_cart2pol(&v2cart_pos, &v2pol_target);
535                 v2pol_target.theta = simple_modulo_2pi(v2pol_target.theta - a);
536
537                 /* asked to go backwards */
538                 if (traj->state >= RUNNING_XY_B_START &&
539                     traj->state <= RUNNING_XY_B_ANGLE_OK ) {
540                         v2pol_target.r = -v2pol_target.r;
541                         v2pol_target.theta = simple_modulo_2pi(v2pol_target.theta + M_PI);
542                 }
543                 
544                 /* if we don't need to go forward */
545                 if (traj->state >= RUNNING_XY_START &&
546                     traj->state <= RUNNING_XY_ANGLE_OK ) {
547                         /* If the target is behind the robot, we need to go
548                          * backwards. 0.52 instead of 0.5 because we prefer to
549                          * go forward */
550                         if ((v2pol_target.theta > 0.52*M_PI) ||
551                             (v2pol_target.theta < -0.52*M_PI ) ) {
552                                 v2pol_target.r = -v2pol_target.r;
553                                 v2pol_target.theta = simple_modulo_2pi(v2pol_target.theta + M_PI);
554                         }
555                 }
556                 
557                 /* If the robot is correctly oriented to start moving in distance */
558                 /* here limit dist speed depending on v2pol_target.theta */
559                 if (ABS(v2pol_target.theta) > traj->a_start_rad) // || ABS(v2pol_target.r) < traj->d_win)
560                         set_quadramp_speed(traj, 0, traj->a_speed);
561                 else {
562                         coef = (traj->a_start_rad - ABS(v2pol_target.theta)) / traj->a_start_rad;
563                         set_quadramp_speed(traj, traj->d_speed * coef, traj->a_speed);
564                 }
565                 
566                 d_consign = (int32_t)(v2pol_target.r * (traj->position->phys.distance_imp_per_mm));
567                 d_consign += rs_get_distance(traj->robot);
568                 
569                 /* angle consign */
570                 /* XXX here we specify 2.2 instead of 2.0 to avoid oscillations */
571                 a_consign = (int32_t)(v2pol_target.theta *
572                                       (traj->position->phys.distance_imp_per_mm) *
573                                       (traj->position->phys.track_mm) / 2.2); 
574                 a_consign += rs_get_angle(traj->robot);
575                 
576                 break;
577
578         default:
579                 /* hmmm quite odd, delete the event */
580                 DEBUG(E_TRAJECTORY, "GNI ???");
581                 delete_event(traj);
582                 traj->state = READY;
583         }
584
585
586         /* step 2 : update state, or delete event if we reached the
587          * destination */
588
589         /* XXX if target is our pos !! */
590
591         switch (traj->state) {
592         case RUNNING_XY_START:
593         case RUNNING_XY_F_START:
594         case RUNNING_XY_B_START:
595                 /* START -> ANGLE */
596                 DEBUG(E_TRAJECTORY, "-> ANGLE");
597                 traj->state ++;
598                 break;
599
600         case RUNNING_XY_ANGLE:
601         case RUNNING_XY_F_ANGLE:
602         case RUNNING_XY_B_ANGLE: {
603                 struct quadramp_filter *q_a;
604                 q_a = traj->csm_angle->consign_filter_params;
605                 /* if d_speed is not 0, we are in start_angle_win */
606                 if (get_quadramp_distance_speed(traj)) {
607                         if(is_robot_in_xy_window(traj, traj->d_win)) {
608                                 delete_event(traj);
609                         }
610                         /* ANGLE -> ANGLE_OK */
611                         traj->state ++;
612                         DEBUG(E_TRAJECTORY, "-> ANGLE_OK");
613                 }
614                 break;
615         }
616
617         case RUNNING_XY_ANGLE_OK:
618         case RUNNING_XY_F_ANGLE_OK:
619         case RUNNING_XY_B_ANGLE_OK:
620                 /* If we reached the destination */
621                 if(is_robot_in_xy_window(traj, traj->d_win)) {
622                         delete_event(traj);
623                 }
624         break;
625         
626         default:
627                 break;
628         }
629
630         /* step 3 : send the processed commands to cs */
631
632         DEBUG(E_TRAJECTORY, "EVENT XY cur=(%f,%f,%f) cart=(%f,%f) pol=(%f,%f)",
633               x, y, a, v2cart_pos.x, v2cart_pos.y, v2pol_target.r, v2pol_target.theta);
634         
635         DEBUG(E_TRAJECTORY,"d_cur=%" PRIi32 ", d_consign=%" PRIi32 ", d_speed=%" PRIi32 ", "
636               "a_cur=%" PRIi32 ", a_consign=%" PRIi32 ", a_speed=%" PRIi32,
637               rs_get_distance(traj->robot), d_consign, get_quadramp_distance_speed(traj),
638               rs_get_angle(traj->robot), a_consign, get_quadramp_angle_speed(traj));
639                 
640         cs_set_consign(traj->csm_angle, a_consign);
641         cs_set_consign(traj->csm_distance, d_consign);
642 }