Skip to content

Commit

Permalink
Merge pull request #116 from JuliaRobotics/tk/fix-113
Browse files Browse the repository at this point in the history
Work around #113.
  • Loading branch information
tkoolen authored Oct 7, 2019
2 parents 39597ea + 19684a2 commit f605257
Showing 1 changed file with 63 additions and 49 deletions.
112 changes: 63 additions & 49 deletions notebooks/Quick start guide/Quick start guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[32m\u001b[1mActivating\u001b[22m\u001b[39m environment at `~/.julia/dev/RigidBodySim/notebooks/Quick start guide/Project.toml`\n",
"\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m registry at `~/.julia/registries/General`\n",
"\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m git-repo `ssh://[email protected]/JuliaRegistries/General.git`\n",
"\u001b[?25l\u001b[2K\u001b[?25h\u001b[32m\u001b[1mPrecompiling\u001b[22m\u001b[39m project...\n"
]
}
],
"source": [
"using Pkg\n",
"Pkg.activate(@__DIR__);\n",
Expand All @@ -28,7 +39,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -58,10 +69,10 @@
{
"data": {
"text/html": [
"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/webio/dist/bundle.js'></script>"
"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/webio/dist/bundle.js'></script>"
],
"text/plain": [
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/webio/dist/bundle.js'></script>\")"
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/webio/dist/bundle.js'></script>\")"
]
},
"metadata": {},
Expand All @@ -70,10 +81,10 @@
{
"data": {
"text/html": [
"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/providers/ijulia_setup.js'></script>"
"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/providers/ijulia_setup.js'></script>"
],
"text/plain": [
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/d00ee8fccd1d3e94c11866a3589118e637f8d9e1-assets/providers/ijulia_setup.js'></script>\")"
"HTML{String}(\"<script class='js-collapse-script' src='/assetserver/292f6e6efeb6819ddb313f5cc13018054e00772b-assets/providers/ijulia_setup.js'></script>\")"
]
},
"metadata": {},
Expand Down Expand Up @@ -127,7 +138,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -145,7 +156,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -177,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -195,7 +206,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -206,7 +217,7 @@
"u0: [0.3, 0.4, 1.0, 2.0]"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -246,7 +257,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -263,14 +274,24 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Warning: `Ext(type, data)` is deprecated, use `MsgPack.Extension(type, data)` instead.\n",
"│ caller = pack(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MeshCat.PackedVector{Float32}) at msgpack.jl:7\n",
"└ @ MeshCat /Users/tkoolen/.julia/packages/MeshCat/J3ExE/src/msgpack.jl:7\n"
]
}
],
"source": [
"gui = GUI(mechanism, visuals)\n",
"if !haskey(ENV, \"CI\") # don't try to open a GUI on a headless CI build\n",
" open(gui)\n",
"end"
"end;"
]
},
{
Expand All @@ -282,7 +303,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -299,15 +320,15 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"using Blink: Window\n",
"if !haskey(ENV, \"CI\") # don't try to open a GUI on a headless CI build\n",
" open(gui.controls, Window())\n",
" open(gui.visualizer, Window());\n",
"end"
" open(gui.visualizer, Window())\n",
"end;"
]
},
{
Expand All @@ -328,7 +349,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -346,7 +367,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -369,7 +390,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -397,7 +418,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -449,30 +470,19 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"control! (generic function with 1 method)"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"function control!(τ, t, state)\n",
" view(τ, velocity_range(state, shoulder)) .= 5 * sin(t)\n",
" view(τ, velocity_range(state, elbow)) .= -configuration(state, shoulder)\n",
"end"
"end;"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -499,7 +509,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -517,7 +527,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"metadata": {},
"outputs": [
{
Expand All @@ -528,14 +538,14 @@
"u0: [0.0, 0.0, 0.0, 0.0]"
]
},
"execution_count": 17,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zero!(state)\n",
"problem = ODEProblem(Dynamics(mechanism, controller), state, (0., 5.))"
"problem = ODEProblem(Dynamics(mechanism, controller), state, (0., 5.), callback=gui_callback)"
]
},
{
Expand All @@ -547,11 +557,11 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"sol = solve(problem, Tsit5(), abs_tol = 1e-10, dt = 0.05, callback = gui_callback);"
"sol = solve(problem, Tsit5(), abs_tol = 1e-10, dt = 0.05);"
]
},
{
Expand All @@ -563,7 +573,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -579,16 +589,20 @@
}
],
"metadata": {
"@webio": {
"lastCommId": null,
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.0.2",
"display_name": "Julia 1.2.0",
"language": "julia",
"name": "julia-1.0"
"name": "julia-1.2"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.0.2"
"version": "1.2.0"
}
},
"nbformat": 4,
Expand Down

0 comments on commit f605257

Please sign in to comment.