Skip to content

Commit 19684a2

Browse files
committed
Work around #113.
Pass GUI callback into `ODEProblem` ctor instead of into `solve` function, since the callback passed into the `ODEProblem` ctor is now simply replaced with the one passed into `solve`, instead of being merged into a `CallbackSet` (SciML/OrdinaryDiffEq.jl#919).
1 parent fe5c5bf commit 19684a2

File tree

1 file changed

+63
-49
lines changed

1 file changed

+63
-49
lines changed

notebooks/Quick start guide/Quick start guide.ipynb

Lines changed: 63 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,20 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": null,
19+
"execution_count": 1,
2020
"metadata": {},
21-
"outputs": [],
21+
"outputs": [
22+
{
23+
"name": "stdout",
24+
"output_type": "stream",
25+
"text": [
26+
"\u001b[32m\u001b[1mActivating\u001b[22m\u001b[39m environment at `~/.julia/dev/RigidBodySim/notebooks/Quick start guide/Project.toml`\n",
27+
"\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m registry at `~/.julia/registries/General`\n",
28+
"\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m git-repo `ssh://[email protected]/JuliaRegistries/General.git`\n",
29+
"\u001b[?25l\u001b[2K\u001b[?25h\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n"
30+
]
31+
}
32+
],
2233
"source": [
2334
"using Pkg\n",
2435
"Pkg.activate(@__DIR__);\n",
@@ -28,7 +39,7 @@
2839
},
2940
{
3041
"cell_type": "code",
31-
"execution_count": 1,
42+
"execution_count": 2,
3243
"metadata": {},
3344
"outputs": [
3445
{
@@ -58,10 +69,10 @@
5869
{
5970
"data": {
6071
"text/html": [
61-
"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/webio/dist/bundle.js'></script>"
72+
"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/webio/dist/bundle.js'></script>"
6273
],
6374
"text/plain": [
64-
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/webio/dist/bundle.js'></script>\")"
75+
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/webio/dist/bundle.js'></script>\")"
6576
]
6677
},
6778
"metadata": {},
@@ -70,10 +81,10 @@
7081
{
7182
"data": {
7283
"text/html": [
73-
"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/providers/ijulia_setup.js'></script>"
84+
"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/providers/ijulia_setup.js'></script>"
7485
],
7586
"text/plain": [
76-
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/providers/ijulia_setup.js'></script>\")"
87+
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/providers/ijulia_setup.js'></script>\")"
7788
]
7889
},
7990
"metadata": {},
@@ -127,7 +138,7 @@
127138
},
128139
{
129140
"cell_type": "code",
130-
"execution_count": 2,
141+
"execution_count": 3,
131142
"metadata": {},
132143
"outputs": [],
133144
"source": [
@@ -145,7 +156,7 @@
145156
},
146157
{
147158
"cell_type": "code",
148-
"execution_count": 3,
159+
"execution_count": 4,
149160
"metadata": {},
150161
"outputs": [],
151162
"source": [
@@ -177,7 +188,7 @@
177188
},
178189
{
179190
"cell_type": "code",
180-
"execution_count": 4,
191+
"execution_count": 5,
181192
"metadata": {},
182193
"outputs": [],
183194
"source": [
@@ -195,7 +206,7 @@
195206
},
196207
{
197208
"cell_type": "code",
198-
"execution_count": 5,
209+
"execution_count": 6,
199210
"metadata": {},
200211
"outputs": [
201212
{
@@ -206,7 +217,7 @@
206217
"u0: [0.3, 0.4, 1.0, 2.0]"
207218
]
208219
},
209-
"execution_count": 5,
220+
"execution_count": 6,
210221
"metadata": {},
211222
"output_type": "execute_result"
212223
}
@@ -246,7 +257,7 @@
246257
},
247258
{
248259
"cell_type": "code",
249-
"execution_count": 6,
260+
"execution_count": 7,
250261
"metadata": {},
251262
"outputs": [],
252263
"source": [
@@ -263,14 +274,24 @@
263274
},
264275
{
265276
"cell_type": "code",
266-
"execution_count": 7,
277+
"execution_count": 8,
267278
"metadata": {},
268-
"outputs": [],
279+
"outputs": [
280+
{
281+
"name": "stderr",
282+
"output_type": "stream",
283+
"text": [
284+
"┌ Warning: `Ext(type, data)` is deprecated, use `MsgPack.Extension(type, data)` instead.\n",
285+
"│ caller = pack(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MeshCat.PackedVector{Float32}) at msgpack.jl:7\n",
286+
"└ @ MeshCat /Users/tkoolen/.julia/packages/MeshCat/J3ExE/src/msgpack.jl:7\n"
287+
]
288+
}
289+
],
269290
"source": [
270291
"gui = GUI(mechanism, visuals)\n",
271292
"if !haskey(ENV, \"CI\") # don't try to open a GUI on a headless CI build\n",
272293
" open(gui)\n",
273-
"end"
294+
"end;"
274295
]
275296
},
276297
{
@@ -282,7 +303,7 @@
282303
},
283304
{
284305
"cell_type": "code",
285-
"execution_count": 8,
306+
"execution_count": 9,
286307
"metadata": {},
287308
"outputs": [],
288309
"source": [
@@ -299,15 +320,15 @@
299320
},
300321
{
301322
"cell_type": "code",
302-
"execution_count": 9,
323+
"execution_count": 10,
303324
"metadata": {},
304325
"outputs": [],
305326
"source": [
306327
"using Blink: Window\n",
307328
"if !haskey(ENV, \"CI\") # don't try to open a GUI on a headless CI build\n",
308329
" open(gui.controls, Window())\n",
309-
" open(gui.visualizer, Window());\n",
310-
"end"
330+
" open(gui.visualizer, Window())\n",
331+
"end;"
311332
]
312333
},
313334
{
@@ -328,7 +349,7 @@
328349
},
329350
{
330351
"cell_type": "code",
331-
"execution_count": 10,
352+
"execution_count": 11,
332353
"metadata": {},
333354
"outputs": [],
334355
"source": [
@@ -346,7 +367,7 @@
346367
},
347368
{
348369
"cell_type": "code",
349-
"execution_count": 11,
370+
"execution_count": 12,
350371
"metadata": {},
351372
"outputs": [],
352373
"source": [
@@ -369,7 +390,7 @@
369390
},
370391
{
371392
"cell_type": "code",
372-
"execution_count": 12,
393+
"execution_count": 13,
373394
"metadata": {},
374395
"outputs": [],
375396
"source": [
@@ -397,7 +418,7 @@
397418
},
398419
{
399420
"cell_type": "code",
400-
"execution_count": 13,
421+
"execution_count": 14,
401422
"metadata": {},
402423
"outputs": [],
403424
"source": [
@@ -449,30 +470,19 @@
449470
},
450471
{
451472
"cell_type": "code",
452-
"execution_count": 14,
473+
"execution_count": 15,
453474
"metadata": {},
454-
"outputs": [
455-
{
456-
"data": {
457-
"text/plain": [
458-
"control! (generic function with 1 method)"
459-
]
460-
},
461-
"execution_count": 14,
462-
"metadata": {},
463-
"output_type": "execute_result"
464-
}
465-
],
475+
"outputs": [],
466476
"source": [
467477
"function control!(τ, t, state)\n",
468478
" view(τ, velocity_range(state, shoulder)) .= 5 * sin(t)\n",
469479
" view(τ, velocity_range(state, elbow)) .= -configuration(state, shoulder)\n",
470-
"end"
480+
"end;"
471481
]
472482
},
473483
{
474484
"cell_type": "code",
475-
"execution_count": 15,
485+
"execution_count": 16,
476486
"metadata": {},
477487
"outputs": [],
478488
"source": [
@@ -499,7 +509,7 @@
499509
},
500510
{
501511
"cell_type": "code",
502-
"execution_count": 16,
512+
"execution_count": 17,
503513
"metadata": {},
504514
"outputs": [],
505515
"source": [
@@ -517,7 +527,7 @@
517527
},
518528
{
519529
"cell_type": "code",
520-
"execution_count": 17,
530+
"execution_count": 18,
521531
"metadata": {},
522532
"outputs": [
523533
{
@@ -528,14 +538,14 @@
528538
"u0: [0.0, 0.0, 0.0, 0.0]"
529539
]
530540
},
531-
"execution_count": 17,
541+
"execution_count": 18,
532542
"metadata": {},
533543
"output_type": "execute_result"
534544
}
535545
],
536546
"source": [
537547
"zero!(state)\n",
538-
"problem = ODEProblem(Dynamics(mechanism, controller), state, (0., 5.))"
548+
"problem = ODEProblem(Dynamics(mechanism, controller), state, (0., 5.), callback=gui_callback)"
539549
]
540550
},
541551
{
@@ -547,11 +557,11 @@
547557
},
548558
{
549559
"cell_type": "code",
550-
"execution_count": 18,
560+
"execution_count": 19,
551561
"metadata": {},
552562
"outputs": [],
553563
"source": [
554-
"sol = solve(problem, Tsit5(), abs_tol = 1e-10, dt = 0.05, callback = gui_callback);"
564+
"sol = solve(problem, Tsit5(), abs_tol = 1e-10, dt = 0.05);"
555565
]
556566
},
557567
{
@@ -563,7 +573,7 @@
563573
},
564574
{
565575
"cell_type": "code",
566-
"execution_count": 19,
576+
"execution_count": 20,
567577
"metadata": {},
568578
"outputs": [],
569579
"source": [
@@ -579,16 +589,20 @@
579589
}
580590
],
581591
"metadata": {
592+
"@webio": {
593+
"lastCommId": null,
594+
"lastKernelId": null
595+
},
582596
"kernelspec": {
583-
"display_name": "Julia 1.0.2",
597+
"display_name": "Julia 1.2.0",
584598
"language": "julia",
585-
"name": "julia-1.0"
599+
"name": "julia-1.2"
586600
},
587601
"language_info": {
588602
"file_extension": ".jl",
589603
"mimetype": "application/julia",
590604
"name": "julia",
591-
"version": "1.0.2"
605+
"version": "1.2.0"
592606
}
593607
},
594608
"nbformat": 4,

0 commit comments

Comments
 (0)