diff --git a/theory/lab06_Trajectories.ipynb b/theory/lab06_Trajectories.ipynb index 3243ba7ce34791ca479e7e286e91eaefeae4afcd..cd13105b4559b4c00be4c74c87984cd69ed5e159 100644 --- a/theory/lab06_Trajectories.ipynb +++ b/theory/lab06_Trajectories.ipynb @@ -96,20 +96,9 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from lab_functions import *\n", "import swift\n", @@ -126,36 +115,11 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "75201648863940cdb3614b61736f0c9c", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(IntSlider(value=-90, description='qs', max=90, min=-90), IntSlider(value=0, description=…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "<function __main__.linear_interpolation(qs=-90, qe=0, T=8)>" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "def linear_interpolation(qs=-90, qe=0, T=8):\n", " steps = 20*T\n", @@ -253,36 +217,11 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "c2c8faa6117a44698eeda49897e0db71", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(IntSlider(value=-90, description='qs', max=90, min=-90), IntSlider(value=-20, descriptio…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "<function __main__.polynomial_interpolation(qs=-90, qe=-20, dss=0, dse=0, ddss=0, ddse=0, T=8)>" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from lab_functions import *\n", "\n", @@ -325,37 +264,12 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "scrolled": true, "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "241f6bfded9a4bf2bdbce19d92aec2bb", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(IntSlider(value=0, description='qs', max=90, min=-90), IntSlider(value=70, description='…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "<function __main__.polynomial_interpolation(qs=0, qe=70, dss=0, dse=0, ddss=0, ddse=0, T=8)>" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from lab_functions import *\n", "\n", @@ -410,36 +324,11 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "0fe120e1ab9345dfbd564ff8283ca25b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(IntSlider(value=0, description='xs', max=90), IntSlider(value=20, description='xe', max=…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "<function __main__.threed_interpolation(xs=0, xe=20, ys=0, ye=30, zs=0, ze=10, T=8)>" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from lab_functions import *\n", "\n", @@ -475,36 +364,11 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "121e48a235f94ab2abe47d3978219438", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(FloatSlider(value=0.6, description='xs', max=0.9, min=-0.9), FloatSlider(value=0.5, desc…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "<function __main__.eef_translation(xs=0.6, xe=0.5, ys=0.2, ye=0.4, zs=0.3, ze=0.4, T=8)>" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from lab_functions import *\n", "\n", @@ -585,36 +449,11 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "57a3822188a0430eadd83cdffb4f2c0b", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(IntSlider(value=145, description='rs', max=180, min=-180), IntSlider(value=180, descript…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "<function __main__.eef_pose(rs=145, re=180, ps=110, pe=40, yas=50, yae=90, xs=0.2, xe=0.4, ys=0.2, ye=0.4, zs=0.2, ze=0.4, T=8)>" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from lab_functions import *\n", "\n", @@ -670,36 +509,11 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "949608ef4a914c959d8ee2a0c3753735", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "interactive(children=(IntSlider(value=180, description='rs', max=180, min=-180), IntSlider(value=-20, descript…" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/plain": [ - "<function __main__.quat_vs_eul(rs=180, re=-20, ys=20, ye=180, T=8, quaternions=True)>" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "from scipy.spatial.transform import Slerp\n", "from lab_functions import *\n", @@ -768,14 +582,12 @@ "steps = 100\n", "tr = rtb.ctraj(T1,T2,steps) # tr is a collection of cartesian poses of size 'steps'\n", "\n", - "# We load our robot from the toolbox\n", - "robot = rtb.models.URDF.UR5()\n", - "\n", "# We solve the inverse kinematics for the target poses\n", - "sol = robot.ikine_LM(tr)\n", + "qs = ur5.ikine_LM(tr).q\n", "\n", - "# Animating the trajectory\n", - "robot.plot(sol.q, backend=\"swift\")" + "for i in range(steps):\n", + " ur5.q = qs[i,:]\n", + " env.step(0.05)" ] }, {