]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robofsm/competition.cc
Merge branch 'maint-demo'
[eurobot/public.git] / src / robofsm / competition.cc
1 /*
2  * competition.cc       2010/04/30
3  *
4  * Robot's control program intended for homologation (approval phase) on Eurobot 2009.
5  *
6  * Copyright: (c) 2009 - 2010 CTU Dragons
7  *            CTU FEE - Department of Control Engineering
8  * License: GNU GPL v.2
9  */
10
11 #ifndef DEBUG
12 #define DEBUG
13 #endif
14
15 #define FSM_MAIN
16 #include <robot.h>
17 #include <fsm.h>
18 #include <unistd.h>
19 #include <math.h>
20 #include <movehelper.h>
21 #include <map.h>
22 #include <sharp.h>
23 #include <robomath.h>
24 #include <string.h>
25 #include <robodim.h>
26 #include <error.h>
27 #include "actuators.h"
28 #include "match-timing.h"
29 #include "common-states.h"
30
31 int main()
32 {
33         int rv;
34
35         rv = robot_init();
36         if (rv) error(1, errno, "robot_init() returned %d\n", rv);
37
38         robot.obstacle_avoidance_enabled = true;
39
40         robot.fsm.main.debug_states = 1;
41         robot.fsm.motion.debug_states = 1;
42         //robot.fsm.act.debug_states = 1;
43
44         //robot.fsm.main.state = &fsm_state_main_start_pick_all_our_figures;
45         robot.fsm.main.state = &fsm_state_main_start_pick_two_our_figures;
46         //robot.fsm.main.state = &fsm_state_main_start_pick_fourth_figure;
47         //robot.fsm.main.state = &fsm_state_main_start_pick_third_figure;
48         //robot.fsm.main.state = &fsm_state_main_start_pick_center_figure;
49
50         //robot.fsm.main.transition_callback = trans_callback;
51         //robot.fsm.motion.transition_callback = move_trans_callback;
52
53         tcVeryFast = trajectoryConstraintsDefault;
54         tcVeryFast.maxv = 1;
55         tcVeryFast.maxacc = 0.6;
56         tcVeryFast.maxomega = 2;
57         tcFast = trajectoryConstraintsDefault;
58         tcFast.maxv = 0.6;
59         tcFast.maxacc = 0.2;
60         tcFast.maxomega = 1;
61         tcFast.maxe = 0.02;
62         tcSlow = trajectoryConstraintsDefault;
63         tcSlow.maxv = 0.4;
64         tcSlow.maxacc = 0.2;
65         tcSlow.maxomega = 1;
66         tcSlow.maxe = 0.02;
67         tcVerySlow = trajectoryConstraintsDefault;
68         tcVerySlow.maxv = 0.1;
69         tcVerySlow.maxacc = 0.1;
70         tcVerySlow.maxomega = 0.2;
71         tcVerySlow.maxe = 0.02;
72
73         rv = robot_start();
74         if (rv) error(1, errno, "robot_start() returned %d\n", rv);
75
76         robot_destroy();
77
78         return 0;
79 }
80
81 /************************************************************************
82  * STATE SKELETON
83  ************************************************************************/
84
85 /*
86 FSM_STATE()
87 {
88         switch(FSM_EVENT) {
89                 case EV_ENTRY:
90                         break;
91                 case EV_START:
92                 case EV_TIMER:
93                 case EV_RETURN:
94                 case EV_ACTION_DONE:
95                 case EV_ACTION_ERROR:
96                 case EV_MOTION_DONE:
97                 case EV_MOTION_ERROR:
98                         DBG_PRINT_EVENT("unhandled event");
99                 case EV_EXIT:
100                         break;
101         }
102 }
103 */