]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robofsm/competition2012.cc
64d1e2186eade497da8a95315b18daa1478fd710
[eurobot/public.git] / src / robofsm / competition2012.cc
1  /*
2  * competition.cc       12/02/28
3  *
4  * Robot's control program intended for competition on Eurobot 2012.
5  *
6  * Copyright: (c) 2012 CTU Flamingos
7  *            CTU FEE - Department of Control Engineering
8  * License: GNU GPL v.2
9  */
10
11 #define FSM_MAIN
12 #include <robot.h>
13 #include <fsm.h>
14 #include <unistd.h>
15 #include <math.h>
16 #include <movehelper.h>
17 #include <map.h>
18 #include <sharp.h>
19 #include <robomath.h>
20 #include <string.h>
21 #include <robodim.h>
22 #include <error.h>
23 #include "actuators.h"
24 #include <trgen.h>
25 #include "match-timing.h"
26 #include <ul_log.h>
27 #include "common-states.h"
28
29 UL_LOG_CUST(ulogd_homologation); /* Log domain name = ulogd + name of the file */
30
31 /************************************************************************
32  * Trajectory constraints used, are initialized in the init state
33  ************************************************************************/
34
35 /************************************************************************
36  * MAIN FUNCTION
37  ************************************************************************/
38
39 int main()
40 {
41         int rv;
42         //robot_calibrate_odometry(); // calibrate odometry
43         rv = robot_init();
44         if (rv) error(1, errno, "robot_init() returned %d\n", rv);
45
46         robot.obstacle_avoidance_enabled = true;
47
48         robot.fsm.main.debug_states = 1;
49         robot.fsm.motion.debug_states = 1;
50         //robot.fsm.act.debug_states = 1;
51
52         robot.fsm.main.state = &fsm_state_main_calibrate;
53         //robot.fsm.main.transition_callback = trans_callback;
54         //robot.fsm.motion.transition_callback = move_trans_callback;
55
56         tcVeryFast = trajectoryConstraintsDefault;
57         tcVeryFast.maxv = 1;
58         tcVeryFast.maxacc = 0.6;
59         tcVeryFast.maxomega = 2;
60         tcFast = trajectoryConstraintsDefault;
61         tcFast.maxv = 0.6;
62         tcFast.maxacc = 0.2;
63         tcFast.maxomega = 1;
64         tcFast.maxe = 0.02;
65         tcSlow = trajectoryConstraintsDefault;
66         tcSlow.maxv = 0.4;
67         tcSlow.maxacc = 0.2;
68         tcSlow.maxomega = 1;
69         tcSlow.maxe = 0.02;
70         tcVerySlow = trajectoryConstraintsDefault;
71         tcVerySlow.maxv = 0.1;
72         tcVerySlow.maxacc = 0.1;
73         tcVerySlow.maxomega = 0.2;
74         tcVerySlow.maxe = 0.02;
75         rv = robot_start();
76         if (rv) error(1, errno, "robot_start() returned %d\n", rv);
77
78         robot_destroy();
79
80         return 0;
81 }