-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
212 lines (146 loc) · 11.5 KB
/
index.html
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Planimation Demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
<script>
let domainPDDL = `(define (domain blocksworld)
(:requirements :strips)
(:predicates (on ?x ?y)
(ontable ?x)
(clear ?x)
(arm-free)
(holding ?x)
)
(:action pick-up
:parameters (?x)
:precondition (and (clear ?x) (ontable ?x) (arm-free))
:effect
(and (not (ontable ?x))
(not (clear ?x))
(not (arm-free))
(holding ?x)))
(:action put-down
:parameters (?x)
:precondition (holding ?x)
:effect
(and (not (holding ?x))
(clear ?x)
(arm-free)
(ontable ?x)))
(:action stack
:parameters (?x ?y)
:precondition (and (holding ?x) (clear ?y))
:effect
(and (not (holding ?x))
(not (clear ?y))
(clear ?x)
(arm-free)
(on ?x ?y)))
(:action unstack
:parameters (?x ?y)
:precondition (and (on ?x ?y) (clear ?x) (arm-free))
:effect
(and (holding ?x)
(clear ?y)
(not (clear ?x))
(not (arm-free))
(not (on ?x ?y)))))`
let problemPDDL = `(define (problem blocksworld-10-0)
(:domain blocksworld)
(:objects d a h g b j e i f c )
(:init (clear c) (clear f) (ontable i) (ontable f) (on c e) (on e j) (on j b)
(on b g) (on g h) (on h a) (on a d) (on d i) (arm-free))
(:goal (and (on d c) (on c f) (on f j) (on j e) (on e h) (on h b) (on b a) (on a g) (on g i))))`
let animationPDDL = `(define (animation blocksworld)
; Defines the Animation profile for BlocksWorld
; See worked example in AP Guide.md for more comments.
; Available at https://bitbucket.org/planning-researchers/classical-domains/src/208a850d2ff2a27068329ad578ad99af9ec7e5c5/classical/?at=master
; 08/10/2018
; Written for Project Planning Visualisation
; By Yi Ding
; Specifies one object is on top of the other
(:predicate on
:parameters (?x ?y)
:effect(
(equal (?x x) (?y x))
(equal (?x y) (add (?y y) (?y height) 2))
)
)
; Specifies an object is on the table
(:predicate ontable
:parameters (?x)
:effect(
(assign (?x x) (function distributex (objects ?x) (settings (spacebtwn 40))))
(equal (?x y) 0)
)
)
; Specifies an object is being held by the vlaw
(:predicate holding
:parameters (?x)
:custom claw
:effect (
(equal (?x x) (claw x))
(equal (?x y) (add (claw y) -60))
)
)
; Visual Object for the Block (default object)
(:visual block
:type default
:properties(
(prefabImage img-block)
(showName True)
(x Null)
(y Null)
(color RANDOMCOLOR)
(width 80)
(height 80)
)
)
; Custom object representing the claw
(:visual claw
:type custom
:objects claw
:properties(
(prefabImage img-claw)
(showName FALSE)
(x 300)
(y 880)
(color BLACK)
(width 80)
(height 40)
(depth 1)
)
)
; Custom object representing the board (ie rectangle on which blocks are placed)
(:visual board
:type custom
:objects board
:properties(
(prefabImage img-board)
(showName FALSE)
(x 0)
(y 0)
(color BLACK)
(width PANEL_SIZE)
(height 5)
)
)
(:image (img-claw iVBORw0KGgoAAAANSUhEUgAAAEoAAABUCAYAAAAlDKGaAAABdklEQVR4Xu3cPU7DQBhF0cnKYGfAzsLO0Efl/IBuEzQox1WKJySOb1yNc1quJHBKK6O1G9TLWuv1cF/Oa63PHe7TblBva633A8x8/gB1KwAqVgEKVB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Y6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YjhhMTA1MjQtNGViMS00NGEwLWI4ZDgtNGQwNWY2Y2U2NjdhIiBzdEV2dDp3aGVuPSIyMDE4LTA4LTEyVDEyOjIxOjU0KzEwOjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoTWFjaW50b3NoKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz59ZURaAAAAPElEQVRoge3WQQ0AIBAEMQ4fvM6/GRRhgg0JaRXMc2qvHgAAwG3zdQAAAPzJagMAQITVBgCACKsNAAARB3NVARwx5z0PAAAAAElFTkSuQmCC)
)
)`
window.onload = function () {
require(["plugin/planimationPixi.js"], function (Planimation) {
planimation = new Planimation(domainPDDL, problemPDDL, animationPDDL, 500, 500);
document.getElementById("planimation").appendChild(planimation.getView());
});
}
</script>
</head>
<body>
<div id="planimation"></div>
</body>
</html>