-
Notifications
You must be signed in to change notification settings - Fork 1
/
USV_obstacle_nav_v2_Domain.rddl
86 lines (64 loc) · 2.44 KB
/
USV_obstacle_nav_v2_Domain.rddl
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
domain USV_obstacle_nav_v2 {
requirements = {
concurrent,
reward-deterministic,
cpf-deterministic,
constrained-state,
multivalued,
continuous
};
types {
obs : object;
USV : object;
};
pvariables {
XG : {non-fluent, real, default = 50.0};
YG : {non-fluent, real, default = 50.0};
//testVariable : {non-fluent, bool, default = true};
damaged(USV) : {state-fluent, bool, default = false};
distance(USV) : {state-fluent, real, default = 0.0};
time : {state-fluent, int, default = 0};
xPos(USV) : {state-fluent, real, default = 0.0};
yPos(USV) : {state-fluent, real, default = 0.0};
xVel(USV) : {state-fluent, real, default = 0.0};
yVel(USV) : {state-fluent, real, default = 0.0};
heading(USV) : {action-fluent, real, default = 0.0};
//headAdj : {action-fluent, real, default = 0.0};
tVel(USV) : {action-fluent, real, default = 0.0};
obsXp(obs) : {state-fluent, real, default = 0.0};
obsYp(obs) : {state-fluent, real, default = 0.0};
obsV(obs) : {state-fluent, real, default = 0.0};
obsHead(obs) : {state-fluent, real, default = 0.0};
};
cpfs {
//update position counters
xPos'(?b) = xPos(?b) + xVel(?b)*0.5;
yPos'(?b) = yPos(?b) + yVel(?b)*0.5;
//update velocities
xVel'(?b) = cos[heading(?b)]*tVel(?b);
yVel'(?b) = sin[heading(?b)]*tVel(?b);
distance'(?b) = hypot[(XG - xPos(?b)), (YG - yPos(?b))];
damaged'(?b) = if (exists_{?o : obs}(hypot[(xPos(?b) - obsXp(?o)), (yPos(?b) - obsYp(?o))] <= 10))
then true
else
if (damaged(?b))
then true
else
false;
//damaged'(?b) = false;
obsHead'(?o) = obsHead(?o) + Normal(0,0.001);
obsV'(?o) = obsV(?o) + 0;
obsXp'(?o) = obsXp(?o) + cos[obsHead(?o)]*obsV(?o)*0.5;
obsYp'(?o) = obsYp(?o) + sin[obsHead(?o)]*obsV(?o)*0.5;
//obsXp'(?o) = obsXp(?o) + 0;
//obsYp'(?o) = obsYp(?o) + 0;
time' = time + 1;
};
action-preconditions {
//Speed and heading change cap!
forall_{?b : USV}[tVel(?b) <= 2];
forall_{?b : USV}[tVel(?b) >= -0.5];
};
reward = -sum_{?b:USV}(distance(?b) + damaged(?b)*100000);
//reward = -sum_{?b:USV}(distance(?b));
}