Skip to content

Commit c8e4a49

Browse files
author
Murilo Marinho
committed
[dqrobotics] Removing MATLAB headers, TOCs, and fixing to Python.
1 parent 57e01dc commit c8e4a49

4 files changed

Lines changed: 438 additions & 577 deletions

dqrobotics/lesson5/lesson_dq5_robot_control_basics_part1.ipynb

Lines changed: 142 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -40,7 +40,7 @@
4040
},
4141
{
4242
"cell_type": "code",
43-
"execution_count": null,
43+
"execution_count": 2,
4444
"metadata": {},
4545
"outputs": [],
4646
"source": [
@@ -51,7 +51,7 @@
5151
},
5252
{
5353
"cell_type": "code",
54-
"execution_count": null,
54+
"execution_count": 3,
5555
"metadata": {},
5656
"outputs": [],
5757
"source": [
@@ -156,17 +156,29 @@
156156
},
157157
{
158158
"cell_type": "code",
159-
"execution_count": null,
160-
"metadata": {},
161-
"outputs": [],
159+
"execution_count": 4,
160+
"metadata": {},
161+
"outputs": [
162+
{
163+
"name": "stdout",
164+
"output_type": "stream",
165+
"text": [
166+
"Help on function __init__ in module one_dof_planar_robot:\n",
167+
"\n",
168+
"__init__(self, l1)\n",
169+
" Initialize self. See help(type(self)) for accurate signature.\n",
170+
"\n"
171+
]
172+
}
173+
],
162174
"source": [
163175
"from one_dof_planar_robot import OneDofPlanarRobot\n",
164176
"help(OneDofPlanarRobot.__init__)"
165177
]
166178
},
167179
{
168180
"cell_type": "code",
169-
"execution_count": null,
181+
"execution_count": 5,
170182
"metadata": {},
171183
"outputs": [],
172184
"source": [
@@ -182,7 +194,7 @@
182194
},
183195
{
184196
"cell_type": "code",
185-
"execution_count": null,
197+
"execution_count": 6,
186198
"metadata": {},
187199
"outputs": [],
188200
"source": [
@@ -271,18 +283,44 @@
271283
},
272284
{
273285
"cell_type": "code",
274-
"execution_count": null,
275-
"metadata": {},
276-
"outputs": [],
286+
"execution_count": 7,
287+
"metadata": {},
288+
"outputs": [
289+
{
290+
"name": "stdout",
291+
"output_type": "stream",
292+
"text": [
293+
"Help on function ikm_tx in module one_dof_planar_robot:\n",
294+
"\n",
295+
"ikm_tx(self, tx)\n",
296+
" fkm calculates the IKM for the 1-DoF planar robot using the \n",
297+
" desired x-axis translation.\n",
298+
"\n"
299+
]
300+
}
301+
],
277302
"source": [
278303
"help(OneDofPlanarRobot.ikm_tx)"
279304
]
280305
},
281306
{
282307
"cell_type": "code",
283-
"execution_count": null,
284-
"metadata": {},
285-
"outputs": [],
308+
"execution_count": 8,
309+
"metadata": {},
310+
"outputs": [
311+
{
312+
"name": "stdout",
313+
"output_type": "stream",
314+
"text": [
315+
"Help on function ikm_ty in module one_dof_planar_robot:\n",
316+
"\n",
317+
"ikm_ty(self, ty)\n",
318+
" fkm calculates the IKM for the 1-DoF planar robot using the \n",
319+
" desired y-axis translation.\n",
320+
"\n"
321+
]
322+
}
323+
],
286324
"source": [
287325
"help(OneDofPlanarRobot.ikm_ty)"
288326
]
@@ -297,7 +335,7 @@
297335
},
298336
{
299337
"cell_type": "code",
300-
"execution_count": null,
338+
"execution_count": 9,
301339
"metadata": {},
302340
"outputs": [],
303341
"source": [
@@ -327,7 +365,7 @@
327365
},
328366
{
329367
"cell_type": "code",
330-
"execution_count": null,
368+
"execution_count": 10,
331369
"metadata": {},
332370
"outputs": [],
333371
"source": [
@@ -393,18 +431,39 @@
393431
},
394432
{
395433
"cell_type": "code",
396-
"execution_count": null,
397-
"metadata": {},
398-
"outputs": [],
434+
"execution_count": 11,
435+
"metadata": {},
436+
"outputs": [
437+
{
438+
"name": "stdout",
439+
"output_type": "stream",
440+
"text": [
441+
"Help on function translation_jacobian in module one_dof_planar_robot:\n",
442+
"\n",
443+
"translation_jacobian(self, theta1)\n",
444+
" Calculates the translation Jacobian of the 1-DoF planar\n",
445+
" robot.\n",
446+
"\n"
447+
]
448+
}
449+
],
399450
"source": [
400451
"help(OneDofPlanarRobot.translation_jacobian)"
401452
]
402453
},
403454
{
404455
"cell_type": "code",
405-
"execution_count": null,
406-
"metadata": {},
407-
"outputs": [],
456+
"execution_count": 12,
457+
"metadata": {},
458+
"outputs": [
459+
{
460+
"name": "stdout",
461+
"output_type": "stream",
462+
"text": [
463+
"Corresponding end effector velocity\n"
464+
]
465+
}
466+
],
408467
"source": [
409468
"# Length\n",
410469
"l1 = 1\n",
@@ -426,9 +485,17 @@
426485
},
427486
{
428487
"cell_type": "code",
429-
"execution_count": null,
430-
"metadata": {},
431-
"outputs": [],
488+
"execution_count": 13,
489+
"metadata": {},
490+
"outputs": [
491+
{
492+
"name": "stdout",
493+
"output_type": "stream",
494+
"text": [
495+
"t_dot = [-0.00302661 -0.35998728 -0. ]\n"
496+
]
497+
}
498+
],
432499
"source": [
433500
"t_dot = Jt*theta1_dot\n",
434501
"print(f\"t_dot = {t_dot}\")"
@@ -469,7 +536,15 @@
469536
"cell_type": "code",
470537
"execution_count": null,
471538
"metadata": {},
472-
"outputs": [],
539+
"outputs": [
540+
{
541+
"name": "stdout",
542+
"output_type": "stream",
543+
"text": [
544+
"t_dot = - 0.19i + 0.74j - 0.71k\n"
545+
]
546+
}
547+
],
473548
"source": [
474549
"# Length\n",
475550
"l1 = 1\n",
@@ -481,11 +556,11 @@
481556
"theta1 = -2.27\n",
482557
"\n",
483558
"# vx, in m/s\n",
484-
"vx =-0.19\n",
559+
"vx = -0.19\n",
485560
"# vy, in m/s\n",
486-
"vy =0.74\n",
561+
"vy = 0.74\n",
487562
"# vz, in m/s\n",
488-
"vz =-0.71\n",
563+
"vz = -0.71\n",
489564
"\n",
490565
"# Compose the end effector velocity into a pure quaternion\n",
491566
"t_dot = DQ([vx, vy, vz])\n",
@@ -494,9 +569,17 @@
494569
},
495570
{
496571
"cell_type": "code",
497-
"execution_count": null,
572+
"execution_count": 15,
498573
"metadata": {},
499-
"outputs": [],
574+
"outputs": [
575+
{
576+
"name": "stdout",
577+
"output_type": "stream",
578+
"text": [
579+
"Corresponding joint velocity\n"
580+
]
581+
}
582+
],
500583
"source": [
501584
"\n",
502585
"# Get the translation jacobian, based on theta\n",
@@ -508,9 +591,17 @@
508591
},
509592
{
510593
"cell_type": "code",
511-
"execution_count": null,
512-
"metadata": {},
513-
"outputs": [],
594+
"execution_count": 16,
595+
"metadata": {},
596+
"outputs": [
597+
{
598+
"name": "stdout",
599+
"output_type": "stream",
600+
"text": [
601+
"theta_dot = [-0.62168767]\n"
602+
]
603+
}
604+
],
514605
"source": [
515606
"from dqrobotics.utils.DQ_LinearAlgebra import pinv\n",
516607
"\n",
@@ -556,7 +647,15 @@
556647
"cell_type": "code",
557648
"execution_count": null,
558649
"metadata": {},
559-
"outputs": [],
650+
"outputs": [
651+
{
652+
"name": "stdout",
653+
"output_type": "stream",
654+
"text": [
655+
"Running control loop for 251 iterations.\n"
656+
]
657+
}
658+
],
560659
"source": [
561660
"import numpy as np\n",
562661
"\n",
@@ -580,11 +679,11 @@
580679
"\n",
581680
"## Desired task-space velocity\n",
582681
"# vx [m/s]\n",
583-
"vx =3.29\n",
682+
"vx = 3.29\n",
584683
"# vy [m/s]\n",
585-
"vy =3.7\n",
684+
"vy = 3.7\n",
586685
"# vz [m/s]\n",
587-
"vz =3.5\n",
686+
"vz = 3.5\n",
588687
"\n",
589688
"# Compose the end effector velocity into a pure quaternion\n",
590689
"td_dot = DQ([vx, vy, vz])\n",
@@ -600,7 +699,7 @@
600699
},
601700
{
602701
"cell_type": "code",
603-
"execution_count": null,
702+
"execution_count": 18,
604703
"metadata": {},
605704
"outputs": [],
606705
"source": [
@@ -639,7 +738,7 @@
639738
},
640739
{
641740
"cell_type": "code",
642-
"execution_count": null,
741+
"execution_count": 19,
643742
"metadata": {},
644743
"outputs": [],
645744
"source": [
@@ -730,7 +829,7 @@
730829
},
731830
{
732831
"cell_type": "code",
733-
"execution_count": null,
832+
"execution_count": 20,
734833
"metadata": {},
735834
"outputs": [],
736835
"source": [
@@ -827,7 +926,7 @@
827926
],
828927
"metadata": {
829928
"kernelspec": {
830-
"display_name": ".venv",
929+
"display_name": "Python 3",
831930
"language": "python",
832931
"name": "python3"
833932
},
@@ -841,7 +940,7 @@
841940
"name": "python",
842941
"nbconvert_exporter": "python",
843942
"pygments_lexer": "ipython3",
844-
"version": "3.12.9"
943+
"version": "3.9.6"
845944
}
846945
},
847946
"nbformat": 4,

0 commit comments

Comments
 (0)