@@ -19,3 +19,58 @@ module for my needs:
1919- [ pytransform3d] ( https://github.com/rock-learning/pytransform3d )
2020- [ robopy] ( https://github.com/MultipedRobotics/robopy )
2121- [ tinyik] ( https://github.com/lanius/tinyik ) , uses ` open3d ` to visualize the mechanism
22+
23+ ## Example
24+
25+ ``` python
26+ import numpy as np
27+ from mdh.kinematic_chain import KinematicChain
28+
29+ # make it print better
30+ np.set_printoptions(suppress = True )
31+
32+ # modified DH parameters: alpha a theta d
33+ # types: revolute=1, prismatic=2 (not implemented yet)
34+ dh = [
35+ {' alpha' : 0 , ' a' : 0 , ' theta' : 0 , ' d' : 0 , ' type' : 1 },
36+ {' alpha' : pi/ 2 , ' a' : 52 , ' theta' : 0 , ' d' : 0 , ' type' : 1 },
37+ {' alpha' : 0 , ' a' : 89 , ' theta' : 0 , ' d' : 0 , ' type' : 1 },
38+ {' alpha' : 0 , ' a' : 90 , ' theta' : 0 , ' d' : 0 , ' type' : 1 },
39+ {' alpha' : 0 , ' a' : 95 , ' theta' : 0 , ' d' : 0 , ' type' : 1 }
40+ ]
41+
42+ kc = KinematicChain.from_parameters(dh)
43+
44+ # forward kinematics
45+ angles = np.deg2rad([- 45.00 , 77.41 , - 98.15 , - 69.27 , 0 ])
46+ t = kc.forward(angles)
47+ print (f " >> { t} " )
48+
49+ # inverse kinematics
50+ pt = [110 ,0 ,- 70 ]
51+ deg = kc.inverse(pt)
52+ rad = np.rad2deg(deg)
53+ print (f " >> { rad} " )
54+ ```
55+
56+ # MIT License
57+
58+ ** Copyright (c) 2019 Kevin J. Walchko**
59+
60+ Permission is hereby granted, free of charge, to any person obtaining a copy
61+ of this software and associated documentation files (the "Software"), to deal
62+ in the Software without restriction, including without limitation the rights
63+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
64+ copies of the Software, and to permit persons to whom the Software is
65+ furnished to do so, subject to the following conditions:
66+
67+ The above copyright notice and this permission notice shall be included in all
68+ copies or substantial portions of the Software.
69+
70+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
71+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
72+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
73+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
74+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
75+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
76+ SOFTWARE.
0 commit comments