Skip to main content

Modified Denavit–Hartenberg (mdh)

Actions Status GitHub PyPI - Python Version PyPI

Modified Denavit-Hartenberg parameters

Work in progress, use one the other libraries below (Inspiration)

Build kinematic chains using the modified Denavit-Hartenberg paramters

  • d: offset along previous z to the common normal
  • theta: angle about previous z, from old x to new x
  • a: length of the common normal, assuming a revolute joint, this is the radius about previous z.
  • alpha: angle about common normal, from old z axis to new z axis

Inspiration

You should probably use one of these, they inspired me to write a simpler module for my needs:

  • pybotics
  • pytransform3d, some matplotlib 3d examples
  • robopy, has some good matplotlib 3d examples, but seems rather brittle and difficult to work with
  • tinyik, uses open3d to visualize the mechanism

Example

import numpy as np
from mdh.kinematic_chain import KinematicChain
from mdh import UnReachable # exception

# make it print better
np.set_printoptions(suppress=True)

# modified DH parameters: alpha a theta d
# types: revolute=1, prismatic=2 (not implemented yet)
dh = [
    {'alpha': 0,  'a': 0, 'theta': 0, 'd': 0, 'type': 1},
    {'alpha': pi/2, 'a': 52, 'theta': 0, 'd': 0, 'type': 1},
    {'alpha': 0, 'a': 89, 'theta': 0, 'd': 0, 'type': 1},
    {'alpha': 0, 'a': 90, 'theta': 0, 'd': 0, 'type': 1},
    {'alpha': 0, 'a': 95, 'theta': 0, 'd': 0, 'type': 1}
]

kc = KinematicChain.from_parameters(dh)

# forward kinematics
angles = np.deg2rad([-45.00, 77.41, -98.15, -69.27, 0])
t = kc.forward(angles)
print(f">> {t}")

# inverse kinematics
pt = [110,0,-70]
deg = kc.inverse(pt)
rad = np.rad2deg(deg)
print(f">> {rad}")

MIT License

Copyright (c) 2019 Kevin J. Walchko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release files for mdh 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdh 0.1.3
File Size Uploaded
mdh-0.1.3.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mdh 0.1.3
File Interpreter ABI Platform
mdh-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / mdh-0.1.3.tar.gz

Download URL mdh-0.1.3.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6836e54ac36f7a675e308c04db53035a6bd4c6afd3c16c6c56880cfa16c76d0f
BLAKE2b-256 checksum
How to use checksums
66b33d0395e2658529a6f1cbd6c653b455cde03006cec962f4a95cfd33a0eb51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.2 CPython/3.8.2 Linux/5.4.0-47-generic

Release files / mdh-0.1.3-py3-none-any.whl

Download URL mdh-0.1.3-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8262d86245d1ca36fb645efb5532acfd33b124bf687d6fc50eb9ba41c773362
BLAKE2b-256 checksum
How to use checksums
bf2b799ae080d5147a0fdcdda9fa76599992ddd2b28ce2010b1235e47613bd1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.2 CPython/3.8.2 Linux/5.4.0-47-generic

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page