Skip to main content

modified dh

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdh-0.1.3.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

mdh-0.1.3-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page