-
Notifications
You must be signed in to change notification settings - Fork 3
/
readyState
106 lines (101 loc) · 2.02 KB
/
readyState
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/** behavior for the ready state */
option(ReadyState)
{
Vector2f kickOffPos;
int pNumber=Global::getSettings().playerNumber;
if(pNumber==1)
{
//My Keeper();
kickOffPos=Transformation::fieldToRobot(theRobotPose,Vector2f(-4200.f,0.f));
}
else if(pNumber==3)
{
//MyStriker();
kickOffPos=Transformation::fieldToRobot(theRobotPose,Vector2f(-950.f,0.f));
}
else if(pNumber==5)
{
//MyDefender();
kickOffPos=Transformation::fieldToRobot(theRobotPose,Vector2f(-3200.f,-800.f));
}
else if(pNumber==2)
{
//MyDefender2();
kickOffPos=Transformation::fieldToRobot(theRobotPose,Vector2f(-3200.f,800.f));
}
else if(pNumber==4)
{
//Supporter
kickOffPos=Transformation::fieldToRobot(theRobotPose,Vector2f(-1550.f,-200.f));
}
initial_state(stand)
{
transition
{
if(action_done||state_time>3000)
{
goto turnToKickOffPos;
}
}
action
{
LookForward();
Stand();
//WalkToTarget(Pose2f(50.f,50.f,50.f),Pose2f(libCodeRelease.angleToGoal,Transformation::fieldToRobot(theRobotPose,Vector2f(-theFieldDimensions.centerCircleRadius-200.f,0.f))));
}
}
state(turnToKickOffPos)
{
transition
{
if(kickOffPos.angle()<5_deg)
{
goto walkToKickOffPos;
}
}
action
{
LookForward();
WalkToTarget(Pose2f(10.f,10.f,10.f),Pose2f(kickOffPos.angle(),0.f,0.f));
}
}
state(walkToKickOffPos)
{
transition
{
if(kickOffPos.norm()<100.f)
{
goto turnToBall;
}
}
action
{
LookForward();
WalkToTarget(Pose2f(10.f,10.f,10.f),Pose2f(kickOffPos.angle(),kickOffPos));
}
}
state(turnToBall)
{
transition
{
if(kickOffPos.norm()<20.f&&std::abs(Transformation::fieldToRobot(theRobotPose,Vector2f(0.f,0.f)).angle())<3_deg)
{
goto finish;
}
}
action
{
LookForward();
WalkToTarget(Pose2f(10.f,10.f,10.f),Pose2f(Transformation::fieldToRobot(theRobotPose,Vector2f(0.f,0.f)).angle(),kickOffPos));
}
}
state(finish)
{
action
{
// LookRound(1.f);
LookForward();
Stand();
}
}
}