Skip to main content

A Python wrapper for the rs-opw-kinematics library

Project description

py-opw-kinematics

py-opw-kinematics is a Python wrapper for the rs-opw-kinematics library, providing an interface for solving inverse and forward kinematics of six-axis industrial robots with a parallel base and spherical wrist. Designed for convenience and performance, this wrapper is suitable for robotics simulation, control, and trajectory planning directly from Python.

Key Features

  • Ease of Use: Fully customizable end-effector rotation using Euler angles. Configurable to use degrees or radians.
  • High Performance: Capable of batch operations using Polars DataFrames for maximum efficiency. For example, 100,000 inverse kinematic solutions can be computed in just 0.4 seconds.
  • Full Rust Integration: Uses Rust for the core kinematic calculations, offering speed and robustness while allowing access through Python.
  • Singularity Handling: Manages kinematic singularities such as J5 = 0° or ±180°.

Installation

Install using pip:

pip install py-opw-kinematics

Note: Rust is required to compile the underlying Rust library if not using pre-built binaries.

Usage Example

Parameters

This library uses seven kinematic parameters (a1, a2, b, c1, c2, c3, and c4). This solver assumes that the arm is at zero when all joints stick straight up in the air, as seen in the image below. It also assumes that all rotations are positive about the base axis of the robot. No other setup is required.

OPW Diagram

To use the library, create a KinematicModel instance with the appropriate values for the 7 kinematic parameters and any joint offsets required to bring the paper's zero position (arm up in Z) to the manufacturer's position. The direction of each of the axes can be flipped with the flip_axes parameter if your robot's axes do not match the convention in the paper.

Additionally, you can specify the Euler convention to use for the end-effector rotation. The EulerConvention class allows you to specify the order of the rotations and whether they are extrinsic or intrinsic. The degrees parameter can be set to True to use degrees instead of radians.

If the robot has a parallelogram between joints 2 and 3, set has_parallelogram to True to link these axes.

Below is a basic example demonstrating how to define a robot, configure Euler conventions, and compute forward kinematics.

Single Operation Example

from py_opw_kinematics import KinematicModel, Robot, EulerConvention
import numpy as np

kinematic_model = KinematicModel(
    a1=400,
    a2=-250,
    b=0,
    c1=830,
    c2=1175,
    c3=1444,
    c4=230,
    offsets=(0,0,0,0,0,0),
    flip_axes=(True, False, True, True, False, True),
    has_parallelogram=True,
)
euler_convention = EulerConvention("XYZ", extrinsic=False, degrees=True)
robot = Robot(kinematic_model, euler_convention, ee_rotation=(0, -90, 0))

# Compute forward kinematics for a given set of joint angles
angles = (10, 0, -90, 0, 0, 0)
position, rotation = robot.forward(angles)
print(f"Position: {np.round(position,2)}, Rotation: {np.round(rotation,2)}")

# Compute inverse kinematics for a given position and rotation
for solution in robot.inverse((position, rotation)):
    print(f"Solution: {np.round(solution, 2)}")

This example prints:

Position: [2042.49 -360.15 2255.  ], Rotation: [  0.   0. -10.]
Solution: [ 10.   0. -90.  -0.   0.   0.]
Solution: [ 10.    90.76 -20.4   -0.    69.6    0.  ]
Solution: [  10.    0.  -90. -180.    0.  180.]
Solution: [  10.     90.76  -20.4  -180.    -69.6   180.  ]

Acknowledgements

This project builds on the Rust library rs-opw-kinematics by Bourumir Wyngs, which itself draws inspiration from:

  • The 2014 research paper: An Analytical Solution of the Inverse Kinematics Problem of Industrial Serial Manipulators with an Ortho-parallel Basis and a Spherical Wrist, authored by Mathias Brandstötter, Arthur Angerer, and Michael Hofbaur (ResearchGate link).
  • The C++ project opw_kinematics, which provided valuable insights for validation and testing.

Licensing

The py-opw-kinematics library itself is licensed under MIT.

The image opw.png, used for documentation purposes, is sourced from opw_kinematics and is licensed under the Apache License 2.0.

Contributing

We welcome contributions! Please see our Contributing Guidelines for more details on how to get started.

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

py_opw_kinematics-0.1.7.tar.gz (142.0 kB view details)

Uploaded Source

Built Distributions

py_opw_kinematics-0.1.7-cp312-none-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.12 Windows x86-64

py_opw_kinematics-0.1.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

py_opw_kinematics-0.1.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

py_opw_kinematics-0.1.7-cp312-cp312-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

py_opw_kinematics-0.1.7-cp312-cp312-macosx_10_12_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.12 macOS 10.12+ x86-64

py_opw_kinematics-0.1.7-cp311-none-win_amd64.whl (3.5 MB view details)

Uploaded CPython 3.11 Windows x86-64

py_opw_kinematics-0.1.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

py_opw_kinematics-0.1.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.8 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

py_opw_kinematics-0.1.7-cp311-cp311-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

py_opw_kinematics-0.1.7-cp311-cp311-macosx_10_12_x86_64.whl (3.5 MB view details)

Uploaded CPython 3.11 macOS 10.12+ x86-64

File details

Details for the file py_opw_kinematics-0.1.7.tar.gz.

File metadata

  • Download URL: py_opw_kinematics-0.1.7.tar.gz
  • Upload date:
  • Size: 142.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.7.4

File hashes

Hashes for py_opw_kinematics-0.1.7.tar.gz
Algorithm Hash digest
SHA256 aaee0255b597d4a74aa8efbec8ffe7e22f46ce7691608dfbc59d0c9f4401fd21
MD5 a0fe5049a84f4e6b8a43bb662674a5ae
BLAKE2b-256 148753076a8d9e8320aa3bc201dd54c0feeff0d032cb35874a05c7840df78ec0

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 6f56711e55509128276e4d16790d87f97e5cdc6b5916779ffbda89f5b62fcf71
MD5 ad5570398a2440601c64df23351b8ad1
BLAKE2b-256 1a7ae8046ff05995126c793686cff8bb72babfd762615f0de803090695e570fd

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7958f9a467ed5f35f1052805791fc55c8435181b5fba6c6673724bf3d231b3eb
MD5 d05bc69b6c4eb396bc78484c84c459fc
BLAKE2b-256 873548ddf1fe8364c18504001f28d050cd28bc2643ccef1af268dc578ccfc252

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3106508acf293ef18c2c629a3bbd8343f3f2e12906cb36329c360c253cd7ebc1
MD5 063332663c338bfb9ab5b9a2590402fe
BLAKE2b-256 752e47522428e035ca7645da1714a88547f39458f4c33c3d5b704355d1ebd3f6

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0790da1604f7cd2fff0831485418be065bf69949c28d0a1ebfee82fc439025f6
MD5 1711123df08b49e4067e525e2b6269c4
BLAKE2b-256 084d51c2e4358cd68a1f05a8f659237fad566b645880ff4c533ba1d8f3c6e11e

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d0d41eb361f067dc1ab2a7fca70546596b610d9fe2c589e4083b1b1922a57327
MD5 dc1011223dcd31ac2ae46b713752c136
BLAKE2b-256 b8a1a871f8e4ce7e5199f72565d4a8efa215d25fd1d92d5d710fa8356521b063

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 177d21f2c654babba581e5d479d8a646c234222b0830427ecca031e07bda207a
MD5 59a3aca7c8dd1e22765b01e1dcfa25a6
BLAKE2b-256 6267221cf1f7091bedb9bf709d03215fb7937e1fd89493131335886c994d3031

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af91a6752be728f7989e5056301cc2b5cda864afdfdc272f6b07b802e8643bc8
MD5 ee4f2419b3c375805c142adbe0ace70b
BLAKE2b-256 ba94c045164956e821256c4ad3b9cb7383bfa4e4e659da7d17effd229f63dd7a

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f2410a74528d0e632969f9d6d313240cfe45afb303d8f9ba7da7bb31a4d3f6da
MD5 c9f11ffecf3f3e593c9efacec96f2133
BLAKE2b-256 c54a5a29df90f60e1426bf97e6516b266cac187a9b8347218f11ef30a16e0279

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b711787f61c4026ade0b8f7184457cc3f9fc678e28085aa820c37118dc4e2de7
MD5 5ca02c0bc1afd9e5633499d17cde5962
BLAKE2b-256 448ea0bc34ce57fd92722b79225369d0dfdf40269aff07c26ae9ae4cb9ac13d1

See more details on using hashes here.

File details

Details for the file py_opw_kinematics-0.1.7-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for py_opw_kinematics-0.1.7-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 476e6a167add8821fcfce21599f0fc710de49c0e85cfeae979de53ed2a2244ec
MD5 879cd1afdccc81c3d7a53d4d6b9c0536
BLAKE2b-256 11d8181d84bb000a1fbbf24d8d2ee63440d1d2fb1355b235181c4c4c7a8441d9

See more details on using hashes here.

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