]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robofsm/competition.cc
robofsm: add jerky motion when unloading oranges
[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 <robodata.h>
17 #include <robot.h>
18 #include <fsm.h>
19 #include <unistd.h>
20 #include <math.h>
21 #include <movehelper.h>
22 #include <map.h>
23 #include <sharp.h>
24 #include <robomath.h>
25 #include <string.h>
26 #include <robodim.h>
27 #include <error.h>
28 #include "corns_configs.h"
29 #include "actuators.h"
30 #include "match-timing.h"
31 #include "eb2010misc.h"
32 #include "common-states.h"
33
34 int main()
35 {
36         int rv;
37
38         rv = robot_init();
39         if (rv) error(1, errno, "robot_init() returned %d\n", rv);
40
41         robot.obstacle_avoidance_enabled = true;
42
43         robot.fsm.main.debug_states = 1;
44         robot.fsm.motion.debug_states = 1;
45         //robot.fsm.act.debug_states = 1;
46
47         //robot.fsm.main.state = &fsm_state_main_start_opp_corn;
48         //robot.fsm.main.state = &fsm_state_main_start_opp_oranges;
49         robot.fsm.main.state = &fsm_state_main_start_six_oranges;
50
51         //robot.fsm.main.transition_callback = trans_callback;
52         //robot.fsm.motion.transition_callback = move_trans_callback;
53
54         tcJerk = trajectoryConstraintsDefault;
55         tcJerk.maxv = 1;
56         tcJerk.maxacc = 1.5;
57         tcJerk.maxomega = 2;
58         tcFast = trajectoryConstraintsDefault;
59         tcFast.maxv = 1;
60         tcFast.maxacc = 0.3;
61         tcFast.maxomega = 2;
62         tcSlow = trajectoryConstraintsDefault;
63         tcSlow.maxv = 0.3;
64         tcSlow.maxacc = 0.1;
65         tcVerySlow = trajectoryConstraintsDefault;
66         tcVerySlow.maxv = 0.05;
67         tcVerySlow.maxacc = 0.05;
68
69         rv = robot_start();
70         if (rv) error(1, errno, "robot_start() returned %d\n", rv);
71
72         robot_destroy();
73
74         return 0;
75 }
76
77 /************************************************************************
78  * STATE SKELETON
79  ************************************************************************/
80
81 /*
82 FSM_STATE()
83 {
84         switch(FSM_EVENT) {
85                 case EV_ENTRY:
86                         break;
87                 case EV_START:
88                 case EV_TIMER:
89                 case EV_RETURN:
90                 case EV_ACTION_DONE:
91                 case EV_ACTION_ERROR:
92                 case EV_MOTION_DONE:
93                 case EV_MOTION_ERROR:
94                         DBG_PRINT_EVENT("unhandled event");
95                 case EV_EXIT:
96                         break;
97         }
98 }
99 */