]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/motion/trgenconstr.h
7eed37ea9e51dc2aa644e11d2c52138d5777de6b
[eurobot/public.git] / src / motion / trgenconstr.h
1 #ifndef TRGENCONSTR_H
2 #define TRGENCONSTR_H
3
4 /**
5  * A structure describing various constraints used during calculation
6  * of a trajectory.
7  */
8 struct TrajectoryConstraints {
9     double maxv;                ///< maximal speed
10     double maxomega;            ///< maximal angular speed
11     double maxangacc;           ///< maximal angular acceleration (for ::TrajectorySegmentTurn)
12     double maxacc;              ///< maximal acceleration
13     double maxcenacc;           ///< maximal centripetal acceleration
14     double maxe;                ///< maximal trajectory error for Trajectory::corners2arcs()
15 };
16
17 enum turn_type { 
18         FH_DONT_TURN,
19         FH_CW,          /* Clockwise */
20         FH_CCW,         /* Counter-clockwise */
21         FH_SHORTEST     /* Shortest turn */
22 };
23
24 struct final_heading {
25         enum turn_type turn_type;
26         double heading;         /* Heading in rad */
27 };
28
29 static inline struct final_heading *__turn(enum turn_type tt, double heading)
30 {
31         static struct final_heading fh;
32         fh.turn_type = tt;
33         fh.heading = heading;
34         return &fh;
35 }
36
37 /* FIXME: Use GCC extension for this */
38 #define TURN(heading) __turn(FH_SHORTEST, (heading))
39 #define TURN_CW(heading) __turn(FH_CW, (heading))
40 #define TURN_CCW(heading) __turn(FH_CCW, (heading))
41 #define NO_TURN() __turn(FH_DONT_TURN, 0)
42
43 #endif