Skip to content

Commit 50ec387

Browse files
committed
up
1 parent 9cc0ee9 commit 50ec387

5 files changed

Lines changed: 177 additions & 0 deletions

File tree

docs/basics.ipynb

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"ename": "ModuleNotFoundError",
10+
"evalue": "No module named 'mdh.models'",
11+
"output_type": "error",
12+
"traceback": [
13+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
14+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
15+
"\u001b[0;32m<ipython-input-1-016134810506>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmdh\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlink\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmdh_params\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mJointType\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmdh\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkinematic_chain\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mKinematicChain\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmdh\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodels\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpuma500\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpandas\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
16+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'mdh.models'"
17+
]
18+
}
19+
],
20+
"source": [
21+
"import numpy as np\n",
22+
"np.set_printoptions(suppress=True)\n",
23+
"\n",
24+
"import mdh\n",
25+
"from mdh.link import mdh_params, JointType\n",
26+
"from mdh.kinematic_chain import KinematicChain\n",
27+
"from mdh.models import puma500\n",
28+
"\n",
29+
"import pandas\n",
30+
"\n",
31+
"print(mdh.__version__)"
32+
]
33+
},
34+
{
35+
"cell_type": "code",
36+
"execution_count": 2,
37+
"metadata": {},
38+
"outputs": [
39+
{
40+
"ename": "AttributeError",
41+
"evalue": "module 'mdh' has no attribute 'models'",
42+
"output_type": "error",
43+
"traceback": [
44+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
45+
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
46+
"\u001b[0;32m<ipython-input-2-ff10bdcf3762>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mparams\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmdh\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodels\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpuma500\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mdf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpandas\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
47+
"\u001b[0;31mAttributeError\u001b[0m: module 'mdh' has no attribute 'models'"
48+
]
49+
}
50+
],
51+
"source": [
52+
"params = mdh.models.puma500()\n",
53+
"df = pandas.DataFrame(params)"
54+
]
55+
},
56+
{
57+
"cell_type": "code",
58+
"execution_count": 4,
59+
"metadata": {},
60+
"outputs": [
61+
{
62+
"data": {
63+
"text/plain": [
64+
"'0.1.2'"
65+
]
66+
},
67+
"execution_count": 4,
68+
"metadata": {},
69+
"output_type": "execute_result"
70+
}
71+
],
72+
"source": [
73+
"from importlib_metadata import version\n",
74+
"version(\"mdh\")"
75+
]
76+
},
77+
{
78+
"cell_type": "code",
79+
"execution_count": null,
80+
"metadata": {},
81+
"outputs": [],
82+
"source": []
83+
}
84+
],
85+
"metadata": {
86+
"kernelspec": {
87+
"display_name": "Python 3",
88+
"language": "python",
89+
"name": "python3"
90+
},
91+
"language_info": {
92+
"codemirror_mode": {
93+
"name": "ipython",
94+
"version": 3
95+
},
96+
"file_extension": ".py",
97+
"mimetype": "text/x-python",
98+
"name": "python",
99+
"nbconvert_exporter": "python",
100+
"pygments_lexer": "ipython3",
101+
"version": "3.7.5"
102+
}
103+
},
104+
"nbformat": 4,
105+
"nbformat_minor": 4
106+
}

docs/pics/3-Figure1-1.png

105 KB
Loading

docs/pics/3-Table1-1.png

18.1 KB
Loading
65.7 KB
Loading

mdh/models.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# MIT Licensed
2+
3+
4+
import numpy as np
5+
from collections import namedtuple
6+
7+
RobotModel = namedtuple('RobotModel', "dh angles")
8+
9+
def kuka_lbr_iiwa_7():
10+
"""Get KUKA LBR iiwa 7 MDH model. (https://github.com/nnadeau/pybotics)"""
11+
dh = [
12+
{'alpha': 0, 'theta': 0, 'd': 0, 'a': 0.340},
13+
{'alpha': -np.pi / 2, 'theta': 0, 'd': 0, 'a': 0},
14+
{'alpha': np.pi / 2, 'theta': 0, 'd': 0, 'a': 0.400},
15+
{'alpha': np.pi / 2, 'theta': 0, 'd': 0, 'a': 0},
16+
{'alpha': -np.pi / 2, 'theta': 0, 'd': 0, 'a': 0.400},
17+
{'alpha': -np.pi / 2, 'theta': 0, 'd': 0, 'a': 0},
18+
{'alpha': np.pi / 2, 'theta': 0, 'd': 0, 'a': 0.126},
19+
]
20+
return dh
21+
22+
def kuka_kr_500():
23+
"""KUKA KR 500 (Forces Acting on the Robot during Grinding, Thesis, Adam Tresnak, 2017)"""
24+
dh = [
25+
{'alpha': np.pi / 2, 'theta': 0, 'd': -1.045, 'a': 0.5},
26+
{'alpha': 0, 'theta': 0, 'd': 0, 'a': 1.3},
27+
{'alpha': -np.pi / 2, 'theta': 0, 'd': 0, 'a': 0.055},
28+
{'alpha': np.pi / 2, 'theta': 0, 'd': -1.025, 'a': 0},
29+
{'alpha': -np.pi / 2, 'theta': 0, 'd': 0, 'a': 0},
30+
{'alpha': np.pi, 'theta': 0, 'd': -0.290, 'a': 0},
31+
]
32+
return dh
33+
34+
# def mecademic_meca500():
35+
# """Get Meca500 MDH model."""
36+
# return np.array(
37+
# {
38+
# {0, 0, 0, 135},
39+
# {-np.pi / 2, 0, -np.pi / 2, 0},
40+
# {0, 135, 0, 0},
41+
# {-np.pi / 2, 38, 0, 120},
42+
# {np.pi / 2, 0, 0, 0},
43+
# {-np.pi / 2, 0, np.pi, 72},
44+
# }
45+
# )
46+
#
47+
#
48+
def puma560():
49+
"""Get PUMA560 MDH model."""
50+
return [
51+
{'alpha': 0, 'a': 0, 'theta': 0, 'd': 0},
52+
{'alpha': -np.pi / 2, 'a': 0, 'theta': 0, 'd': 0},
53+
{'alpha': 0, 'a': 612.7, 'theta': 0, 'd': 0},
54+
{'alpha': 0, 'a': 571.6, 'theta': 0, 'd': 163.9},
55+
{'alpha': -np.pi / 2, 'a': 0, 'theta': 0, 'd': 115.7},
56+
{'alpha': np.pi / 2, 'a': 0, 'theta': np.pi, 'd': 92.2},
57+
]
58+
#
59+
#
60+
# def ur10():
61+
# """Get UR10 MDH model."""
62+
# return np.array(
63+
# {
64+
# {0, 0, 0, 118},
65+
# {np.pi / 2, 0, np.pi, 0},
66+
# {0, 612.7, 0, 0},
67+
# {0, 571.6, 0, 163.9},
68+
# {-np.pi / 2, 0, 0, 115.7},
69+
# {np.pi / 2, 0, np.pi, 92.2},
70+
# }
71+
# )

0 commit comments

Comments
 (0)