|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": null, |
| 5 | + "execution_count": 61, |
6 | 6 | "metadata": {}, |
7 | 7 | "outputs": [], |
8 | 8 | "source": [ |
|
40 | 40 | }, |
41 | 41 | { |
42 | 42 | "cell_type": "code", |
43 | | - "execution_count": null, |
| 43 | + "execution_count": 62, |
44 | 44 | "metadata": {}, |
45 | 45 | "outputs": [], |
46 | 46 | "source": [ |
|
51 | 51 | }, |
52 | 52 | { |
53 | 53 | "cell_type": "code", |
54 | | - "execution_count": null, |
| 54 | + "execution_count": 63, |
55 | 55 | "metadata": {}, |
56 | 56 | "outputs": [], |
57 | 57 | "source": [ |
|
156 | 156 | }, |
157 | 157 | { |
158 | 158 | "cell_type": "code", |
159 | | - "execution_count": null, |
160 | | - "metadata": {}, |
161 | | - "outputs": [], |
| 159 | + "execution_count": 64, |
| 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 | + ], |
162 | 174 | "source": [ |
163 | 175 | "from one_dof_planar_robot import OneDofPlanarRobot\n", |
164 | | - "OneDofPlanarRobot.__init__??" |
| 176 | + "help(OneDofPlanarRobot.__init__)" |
165 | 177 | ] |
166 | 178 | }, |
167 | 179 | { |
168 | 180 | "cell_type": "code", |
169 | | - "execution_count": null, |
| 181 | + "execution_count": 65, |
170 | 182 | "metadata": {}, |
171 | 183 | "outputs": [], |
172 | 184 | "source": [ |
|
182 | 194 | }, |
183 | 195 | { |
184 | 196 | "cell_type": "code", |
185 | | - "execution_count": null, |
| 197 | + "execution_count": 66, |
186 | 198 | "metadata": {}, |
187 | 199 | "outputs": [], |
188 | 200 | "source": [ |
|
271 | 283 | }, |
272 | 284 | { |
273 | 285 | "cell_type": "code", |
274 | | - "execution_count": null, |
| 286 | + "execution_count": 67, |
275 | 287 | "metadata": {}, |
276 | | - "outputs": [], |
| 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 | + ], |
277 | 302 | "source": [ |
278 | | - "OneDofPlanarRobot.ikm_tx??" |
| 303 | + "help(OneDofPlanarRobot.ikm_tx)" |
279 | 304 | ] |
280 | 305 | }, |
281 | 306 | { |
282 | 307 | "cell_type": "code", |
283 | | - "execution_count": null, |
| 308 | + "execution_count": 68, |
284 | 309 | "metadata": {}, |
285 | | - "outputs": [], |
| 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 | + ], |
286 | 324 | "source": [ |
287 | | - "OneDofPlanarRobot.ikm_ty??" |
| 325 | + "help(OneDofPlanarRobot.ikm_ty)" |
288 | 326 | ] |
289 | 327 | }, |
290 | 328 | { |
|
297 | 335 | }, |
298 | 336 | { |
299 | 337 | "cell_type": "code", |
300 | | - "execution_count": null, |
| 338 | + "execution_count": 69, |
301 | 339 | "metadata": {}, |
302 | 340 | "outputs": [], |
303 | 341 | "source": [ |
|
332 | 370 | "outputs": [], |
333 | 371 | "source": [ |
334 | 372 | "# Length\n", |
335 | | - "l1 = 1;\n", |
| 373 | + "l1 = 1\n", |
336 | 374 | "\n", |
337 | 375 | "# Create robot\n", |
338 | 376 | "one_dof_planar_robot = OneDofPlanarRobot(l1)\n", |
|
395 | 433 | "cell_type": "code", |
396 | 434 | "execution_count": null, |
397 | 435 | "metadata": {}, |
398 | | - "outputs": [], |
399 | | - "source": [ |
400 | | - "OneDofPlanarRobot.translation_jacobian??" |
| 436 | + "outputs": [ |
| 437 | + { |
| 438 | + "name": "stdout", |
| 439 | + "output_type": "stream", |
| 440 | + "text": [ |
| 441 | + "\u001b[0;31mSignature:\u001b[0m \u001b[0mOneDofPlanarRobot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtranslation_jacobian\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtheta1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
| 442 | + "\u001b[0;31mSource:\u001b[0m \n", |
| 443 | + " \u001b[0;32mdef\u001b[0m \u001b[0mtranslation_jacobian\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mtheta1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\n", |
| 444 | + "\u001b[0;34m\u001b[0m \u001b[0;34m''' Calculates the translation Jacobian of the 1-DoF planar\u001b[0m\n", |
| 445 | + "\u001b[0;34m robot. '''\u001b[0m\u001b[0;34m\u001b[0m\n", |
| 446 | + "\u001b[0;34m\u001b[0m \u001b[0;34m\u001b[0m\n", |
| 447 | + "\u001b[0;34m\u001b[0m \u001b[0mj\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0ml1_\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0mi_\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0msin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtheta1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0mj_\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mcos\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtheta1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\n", |
| 448 | + "\u001b[0;34m\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mvec3\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mj\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
| 449 | + "\u001b[0;31mFile:\u001b[0m ~/git/OpenExecutableBooksRobotics/dqrobotics/lesson5/one_dof_planar_robot.py\n", |
| 450 | + "\u001b[0;31mType:\u001b[0m function" |
| 451 | + ] |
| 452 | + } |
| 453 | + ], |
| 454 | + "source": [ |
| 455 | + "help(OneDofPlanarRobot.translation_jacobian)" |
401 | 456 | ] |
402 | 457 | }, |
403 | 458 | { |
404 | 459 | "cell_type": "code", |
405 | | - "execution_count": null, |
406 | | - "metadata": {}, |
407 | | - "outputs": [], |
| 460 | + "execution_count": 72, |
| 461 | + "metadata": {}, |
| 462 | + "outputs": [ |
| 463 | + { |
| 464 | + "name": "stdout", |
| 465 | + "output_type": "stream", |
| 466 | + "text": [ |
| 467 | + "Corresponding end effector velocity\n" |
| 468 | + ] |
| 469 | + } |
| 470 | + ], |
408 | 471 | "source": [ |
409 | 472 | "# Length\n", |
410 | 473 | "l1 = 1\n", |
|
426 | 489 | }, |
427 | 490 | { |
428 | 491 | "cell_type": "code", |
429 | | - "execution_count": null, |
430 | | - "metadata": {}, |
431 | | - "outputs": [], |
| 492 | + "execution_count": 73, |
| 493 | + "metadata": {}, |
| 494 | + "outputs": [ |
| 495 | + { |
| 496 | + "name": "stdout", |
| 497 | + "output_type": "stream", |
| 498 | + "text": [ |
| 499 | + "t_dot = [-0.00302661 -0.35998728 -0. ]\n" |
| 500 | + ] |
| 501 | + } |
| 502 | + ], |
432 | 503 | "source": [ |
433 | 504 | "t_dot = Jt*theta1_dot\n", |
434 | 505 | "print(f\"t_dot = {t_dot}\")" |
|
467 | 538 | }, |
468 | 539 | { |
469 | 540 | "cell_type": "code", |
470 | | - "execution_count": null, |
471 | | - "metadata": {}, |
472 | | - "outputs": [], |
| 541 | + "execution_count": 74, |
| 542 | + "metadata": {}, |
| 543 | + "outputs": [ |
| 544 | + { |
| 545 | + "name": "stdout", |
| 546 | + "output_type": "stream", |
| 547 | + "text": [ |
| 548 | + "t_dot = - 0.19i + 0.74j - 0.71k\n" |
| 549 | + ] |
| 550 | + } |
| 551 | + ], |
473 | 552 | "source": [ |
474 | 553 | "# Length\n", |
475 | 554 | "l1 = 1\n", |
|
494 | 573 | }, |
495 | 574 | { |
496 | 575 | "cell_type": "code", |
497 | | - "execution_count": null, |
| 576 | + "execution_count": 75, |
498 | 577 | "metadata": {}, |
499 | | - "outputs": [], |
| 578 | + "outputs": [ |
| 579 | + { |
| 580 | + "name": "stdout", |
| 581 | + "output_type": "stream", |
| 582 | + "text": [ |
| 583 | + "Corresponding joint velocity\n" |
| 584 | + ] |
| 585 | + } |
| 586 | + ], |
500 | 587 | "source": [ |
501 | 588 | "\n", |
502 | 589 | "# Get the translation jacobian, based on theta\n", |
|
508 | 595 | }, |
509 | 596 | { |
510 | 597 | "cell_type": "code", |
511 | | - "execution_count": null, |
512 | | - "metadata": {}, |
513 | | - "outputs": [], |
| 598 | + "execution_count": 76, |
| 599 | + "metadata": {}, |
| 600 | + "outputs": [ |
| 601 | + { |
| 602 | + "name": "stdout", |
| 603 | + "output_type": "stream", |
| 604 | + "text": [ |
| 605 | + "theta_dot = [-0.62168767]\n" |
| 606 | + ] |
| 607 | + } |
| 608 | + ], |
514 | 609 | "source": [ |
515 | 610 | "from dqrobotics.utils.DQ_LinearAlgebra import pinv\n", |
516 | 611 | "\n", |
|
554 | 649 | }, |
555 | 650 | { |
556 | 651 | "cell_type": "code", |
557 | | - "execution_count": null, |
558 | | - "metadata": {}, |
559 | | - "outputs": [], |
| 652 | + "execution_count": 77, |
| 653 | + "metadata": {}, |
| 654 | + "outputs": [ |
| 655 | + { |
| 656 | + "name": "stdout", |
| 657 | + "output_type": "stream", |
| 658 | + "text": [ |
| 659 | + "Running control loop for 251 iterations.\n" |
| 660 | + ] |
| 661 | + } |
| 662 | + ], |
560 | 663 | "source": [ |
561 | 664 | "import numpy as np\n", |
562 | 665 | "\n", |
|
600 | 703 | }, |
601 | 704 | { |
602 | 705 | "cell_type": "code", |
603 | | - "execution_count": null, |
| 706 | + "execution_count": 78, |
604 | 707 | "metadata": {}, |
605 | 708 | "outputs": [], |
606 | 709 | "source": [ |
|
639 | 742 | }, |
640 | 743 | { |
641 | 744 | "cell_type": "code", |
642 | | - "execution_count": null, |
| 745 | + "execution_count": 79, |
643 | 746 | "metadata": {}, |
644 | 747 | "outputs": [], |
645 | 748 | "source": [ |
|
730 | 833 | }, |
731 | 834 | { |
732 | 835 | "cell_type": "code", |
733 | | - "execution_count": null, |
| 836 | + "execution_count": 80, |
734 | 837 | "metadata": {}, |
735 | 838 | "outputs": [], |
736 | 839 | "source": [ |
|
0 commit comments