-
Notifications
You must be signed in to change notification settings - Fork 0
/
rover-demo-plan-autorun.ple
89 lines (73 loc) · 2.57 KB
/
rover-demo-plan-autorun.ple
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
Date Lookup time;
Command pprint (...);
Integer Lookup StartRequested;
Integer Lookup AbortRequested;
Command TurnFrontWheels(Integer);
Command TurnRearWheels(Integer);
Command MoveForward(Integer);
Command MoveBackward(Integer);
Command Stop();
CountIteration:
{
Integer stepsCount=0;
Boolean continue = true;
Boolean tickCont = true;
Boolean abortedPlan=false;
Boolean succeedPlan=false;
Duration delay = Duration ("PT0.5S");
Duration tolerance = Duration ("PT0.1S");
End abortedPlan || succeedPlan ;
Concurrence{
AbortedPlanHandler:{
Start Lookup(AbortRequested)==1;
pprint ("Plan abortion requested.");
Stop();
abortedPlan=true;
}
PlanSuccessHandler:{
Start MainPlan.state==FINISHED && MainPlan.outcome==SUCCESS;
Stop();
pprint ("Plan success!.");
succeedPlan=true;
}
MainPlan:
{
Concurrence{
obstacleCheck:
{
Start planSequence.state==FINISHED;
pprint ("Plan executed succesfully.");
}
planSequence:
{
Sequence{
StepOne:{
pprint ("Driving forward for 5 seconds.");
MoveForward(20);
WaitABit:{
Wait (delay*10),tolerance;
}
}
StepTwo:{
pprint ("Turning front wheels 30 degrees and continue for 2 seconds.");
TurnFrontWheels(30);
WaitABit:{
Wait (delay*4),tolerance;
}
}
StepThree:{
pprint ("Return front wheels to 0 degrees, and keep driving for 3 seconds.");
WaitABit:{
Wait (delay*6),tolerance;
}
}
StepFour:{
pprint ("Stop.");
Stop();
}
}
}
}
}
}
}