Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ jobs:
# version-pinning section for the full story before bumping this.
# Once Safari (and Firefox out-of-flag) ship JSPI, revisit this pin
# across RTB/MVTB/bdsim together.
# ipympl is installed here, in the build environment, so that the
# jupyter-matplotlib extension is bundled into the site: the notebooks
# use %matplotlib ipympl, and without the extension a figure is blank.
# (The notebooks install ipympl itself into the in-browser kernel.)
run: |
pip install jupyterlite-core "jupyterlite-pyodide-kernel==0.6.1" jupyter-server
pip install jupyterlite-core "jupyterlite-pyodide-kernel==0.6.1" jupyter-server ipympl
cd docs/lite && jupyter lite build --output-dir ../build/html/lite

- name: Upload Pages artifact
Expand Down
15 changes: 7 additions & 8 deletions docs/notebooks/dynamics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"source": [
"try:\n",
" import piplite\n",
" await piplite.install([\"roboticstoolbox-python\"])\n",
" await piplite.install([\"ipympl\", \"roboticstoolbox-python\"])\n",
"except ImportError:\n",
" pass # not running in Pyodide (e.g. local Jupyter) -- assume it's already pip-installed\n",
"\n",
Expand All @@ -29,7 +29,8 @@
" formatter={\"float\": lambda x: f\"{x:8.4g}\" if abs(x) > 1e-10 else f\"{0:8.4g}\"},\n",
")\n",
"\n",
"%matplotlib notebook\n",
"%matplotlib ipympl\n",
"plt.close(\"all\")\n",
"%config NotebookBackend.figure_format = 'retina'"
]
},
Expand Down Expand Up @@ -1037,7 +1038,7 @@
}
],
"source": [
"p560.plot(p560.qn, block=False);"
"p560.plot(p560.qn);"
]
},
{
Expand Down Expand Up @@ -2139,8 +2140,7 @@
"fig.colorbar(surf, shrink=0.9, aspect=10, pad=0.12)\n",
"ax.set_xlabel(\"$q_2$ (rad)\")\n",
"ax.set_ylabel(\"$q_3$ (rad)\")\n",
"ax.set_zlabel(\"$M_{11}$ ($kg.m^2$)\")\n",
"plt.show()"
"ax.set_zlabel(\"$M_{11}$ ($kg.m^2$)\")"
]
},
{
Expand Down Expand Up @@ -3163,8 +3163,7 @@
"fig.colorbar(surf, shrink=0.9, aspect=10, pad=0.12)\n",
"ax.set_xlabel(\"$q_2$ (rad)\")\n",
"ax.set_ylabel(\"$q_3$ (rad)\")\n",
"ax.set_zlabel(\"$M_{12}$ ($kg.m^2$)\")\n",
"plt.show()"
"ax.set_zlabel(\"$M_{12}$ ($kg.m^2$)\")"
]
},
{
Expand Down Expand Up @@ -4382,7 +4381,7 @@
}
],
"source": [
"rtb.tools.trajectory.qplot(tg.t, tg.q)"
"rtb.tools.plot.xplot(tg.t, tg.q)"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/notebooks/ets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"source": [
"try:\n",
" import piplite\n",
" await piplite.install([\"roboticstoolbox-python\"])\n",
" await piplite.install([\"ipympl\", \"roboticstoolbox-python\"])\n",
"except ImportError:\n",
" pass # not running in Pyodide (e.g. local Jupyter) -- assume it's already pip-installed\n",
"\n",
Expand All @@ -60,7 +60,7 @@
"from spatialmath import SE3\n",
"from spatialmath.base import sym\n",
"\n",
"%matplotlib notebook"
"%matplotlib ipympl"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions docs/notebooks/icra2021.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"source": [
"try:\n",
" import piplite\n",
" await piplite.install([\"roboticstoolbox-python\"])\n",
" await piplite.install([\"ipympl\", \"roboticstoolbox-python\"])\n",
"except ImportError:\n",
" pass # not running in Pyodide (e.g. local Jupyter) -- assume it's already pip-installed\n",
"\n",
Expand Down Expand Up @@ -67,7 +67,7 @@
"\"\"\"\n",
" )\n",
")\n",
"%matplotlib notebook"
"%matplotlib ipympl"
]
},
{
Expand Down Expand Up @@ -3458,7 +3458,7 @@
],
"source": [
"traj = jtraj(puma.qz, puma.qr, 100)\n",
"qplot(traj.q)"
"traj.qplot()"
]
},
{
Expand Down Expand Up @@ -4047,7 +4047,7 @@
}
],
"source": [
"panda.plot(panda.qr, block=False);"
"panda.plot(panda.qr);"
]
},
{
Expand Down
16 changes: 7 additions & 9 deletions docs/notebooks/iros2020-workshop.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"source": [
"try:\n",
" import piplite\n",
" await piplite.install([\"roboticstoolbox-python\"])\n",
" await piplite.install([\"ipympl\", \"roboticstoolbox-python\"])\n",
"except ImportError:\n",
" pass # not running in Pyodide (e.g. local Jupyter) -- assume it's already pip-installed\n",
"\n",
Expand All @@ -43,7 +43,8 @@
" formatter={\"float\": lambda x: f\"{x:8.4g}\" if abs(x) > 1e-10 else f\"{0:8.4g}\"},\n",
")\n",
"\n",
"%matplotlib notebook"
"%matplotlib ipympl\n",
"plt.close(\"all\")"
]
},
{
Expand Down Expand Up @@ -1465,7 +1466,7 @@
"outputs": [],
"source": [
"tg = puma.nofriction().fdyn(5, puma.qn, dt=0.05)\n",
"rtb.tools.trajectory.qplot(tg.q, tg.t, block=True)"
"rtb.tools.plot.xplot(tg.t, tg.q)"
]
},
{
Expand Down Expand Up @@ -1672,9 +1673,7 @@
"ax.set_ylim3d(-10, 10)\n",
"ax.set_zlim3d(-10, 10)\n",
"\n",
"tw.line().plot(color=\"red\", linewidth=2)\n",
"\n",
"plt.show()"
"tw.line().plot(color=\"red\", linewidth=2)"
]
},
{
Expand Down Expand Up @@ -1914,9 +1913,8 @@
"metadata": {},
"outputs": [],
"source": [
"fig = puma.plot(puma.qz, block=False)\n",
"lines.plot(\"k--\", linewidth=1.5, bounds=np.r_[-1, 1, -1, 1, -1, 1.5])\n",
"plt.show()"
"fig = puma.plot(puma.qz)\n",
"lines.plot(\"k--\", linewidth=1.5, bounds=np.r_[-1, 1, -1, 1, -1, 1.5])"
]
},
{
Expand Down
9 changes: 5 additions & 4 deletions docs/notebooks/kinematics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"try:\n",
" import piplite\n",
" await piplite.install([\"roboticstoolbox-python\"])\n",
" await piplite.install([\"ipympl\", \"roboticstoolbox-python\"])\n",
"except ImportError:\n",
" pass # not running in Pyodide (e.g. local Jupyter) -- assume it's already pip-installed\n",
"\n",
Expand All @@ -27,7 +27,8 @@
" formatter={\"float\": lambda x: f\"{x:8.4g}\" if abs(x) > 1e-10 else f\"{0:8.4g}\"},\n",
")\n",
"\n",
"%matplotlib notebook"
"%matplotlib ipympl\n",
"plt.close(\"all\")"
]
},
{
Expand Down Expand Up @@ -1417,7 +1418,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We can plot this trajectory as a function of time using the convenience function `qplot`"
"We can plot this trajectory as a function of time using the convenience method `qplot`"
]
},
{
Expand Down Expand Up @@ -2370,7 +2371,7 @@
}
],
"source": [
"rtb.tools.trajectory.qplot(qt.q, block=False)"
"qt.qplot()"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/robotics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@
"from roboticstoolbox import VehiclePolygon\n",
"\n",
"va = VehiclePolygon(piano)\n",
"map.plot(block=None)\n",
"map.plot()\n",
"for i in np.unique(np.rint(np.linspace(0, len(path) - 1, 20)).astype(int)):\n",
" va.plot(path[i, :], alpha=0.2)\n"
]
Expand Down
4 changes: 2 additions & 2 deletions docs/notebooks/symbolic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"try:\n",
" import piplite\n",
" await piplite.install([\"roboticstoolbox-python\"])\n",
" await piplite.install([\"ipympl\", \"roboticstoolbox-python\"])\n",
"except ImportError:\n",
" pass # not running in Pyodide (e.g. local Jupyter) -- assume it's already pip-installed\n",
"\n",
Expand All @@ -22,7 +22,7 @@
"from spatialmath import SE3\n",
"import spatialmath.base.symbolic as sym\n",
"\n",
"%matplotlib notebook"
"%matplotlib ipympl"
]
},
{
Expand Down
Loading