]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robofsm/competition.cc
robofsm: Add competition sources.
[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_opp_corn;
45         //robot.fsm.main.state = &fsm_state_main_start_opp_oranges;
46         robot.fsm.main.state = &fsm_state_main_start_all_our_figures;
47
48         //robot.fsm.main.transition_callback = trans_callback;
49         //robot.fsm.motion.transition_callback = move_trans_callback;
50
51         tcJerk = trajectoryConstraintsDefault;
52         tcJerk.maxv = 1.5;
53         tcJerk.maxacc = 5;
54         tcJerk.maxomega = 2;
55         tcFast = trajectoryConstraintsDefault;
56         tcFast.maxv = 1;
57         tcFast.maxacc = 0.3;
58         tcFast.maxomega = 2;
59         tcSlow = trajectoryConstraintsDefault;
60         tcSlow.maxv = 0.3;
61         tcSlow.maxacc = 0.1;
62         tcVerySlow = trajectoryConstraintsDefault;
63         tcVerySlow.maxv = 0.05;
64         tcVerySlow.maxacc = 0.05;
65
66         rv = robot_start();
67         if (rv) error(1, errno, "robot_start() returned %d\n", rv);
68
69         robot_destroy();
70
71         return 0;
72 }
73
74 /************************************************************************
75  * STATE SKELETON
76  ************************************************************************/
77
78 /*
79 FSM_STATE()
80 {
81         switch(FSM_EVENT) {
82                 case EV_ENTRY:
83                         break;
84                 case EV_START:
85                 case EV_TIMER:
86                 case EV_RETURN:
87                 case EV_ACTION_DONE:
88                 case EV_ACTION_ERROR:
89                 case EV_MOTION_DONE:
90                 case EV_MOTION_ERROR:
91                         DBG_PRINT_EVENT("unhandled event");
92                 case EV_EXIT:
93                         break;
94         }
95 }
96 */