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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file py_opw_kinematics-0.1.8.tar.gz
.
File metadata
- Download URL: py_opw_kinematics-0.1.8.tar.gz
- Upload date:
- Size: 144.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87ec0ab95790c1538ab4e226d4bdebc7c454f34302e956cccc2442d91ce044eb |
|
MD5 | cf8fa678391724e567ceec915da62086 |
|
BLAKE2b-256 | 1a7f63158e8dd1439e140c836b4665e90cd98cbd3d32cf7c43fc967aedab59a6 |
File details
Details for the file py_opw_kinematics-0.1.8-cp312-none-win_amd64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp312-none-win_amd64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2caad97443fe5a193f0279cb4faef0364b35b8705824339755ca94f54e26d139 |
|
MD5 | e97f08f47e4acf50562b6baccca7e554 |
|
BLAKE2b-256 | 917c006013cdaf817c87503bd400e988b4f13f5d67d620a97903ba1aa347f68c |
File details
Details for the file py_opw_kinematics-0.1.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b309bd4d70f27a710b49141f7d8fb463fe1bcbd7bc6cfaafc9b667512a5adc89 |
|
MD5 | c6d6c2b9a368791c9b8527f4ed9e28dd |
|
BLAKE2b-256 | 7fe7c2789b21456377c6e76b764c11b700beff61f61c47741a3353ced087d392 |
File details
Details for the file py_opw_kinematics-0.1.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 779b7c59f078be1ee643de01fb2171ebe5ab422f6f5480bc528975095d6a9eac |
|
MD5 | 034b884f3cbfc78b91e3cbac9a29d4a2 |
|
BLAKE2b-256 | e1a4e8fc65143ecf4043d841d51f5e3540db7d0770f2a5ceee68631fe7c3a278 |
File details
Details for the file py_opw_kinematics-0.1.8-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f0a495a7c3170cb0dffd50cf12ed31699cd86ecec93ad3d3c10c90453685f3b |
|
MD5 | 2f02498a429e8f7b81811873c57f85b9 |
|
BLAKE2b-256 | 145df0530704ea40ece74b625fc81f8e0fd606cac9d8f0885720b69e324e6fb5 |
File details
Details for the file py_opw_kinematics-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f36f074eccd480cb68a9c29d75f97705d02c011fe1b52fba125282806151d9f |
|
MD5 | ba2d27680a37f9e5eb977f316e07134c |
|
BLAKE2b-256 | 5d4226665ce0bc03f80f49aedac7b022acfb94872371302a717cf5deed7eb598 |
File details
Details for the file py_opw_kinematics-0.1.8-cp311-none-win_amd64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp311-none-win_amd64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e37a93102bab56cee80f047afb88f3f90be4b7611a1f79b5011f05b086a4872 |
|
MD5 | c1eed70b638bfd4736544d8541ca13d2 |
|
BLAKE2b-256 | 7635e17395e2bff827e5763a5ddeff8fc351bd97673dea482d995ea4a9191669 |
File details
Details for the file py_opw_kinematics-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbc384d6f1c7bc98122914491403a18005508f0091721d31850fecea485595a8 |
|
MD5 | 007ef616df254365d8980f128b0a6af7 |
|
BLAKE2b-256 | dd0509739063ebc196778b76a7cb9ba7347540b8eb8957cb3472ed5f0be94e66 |
File details
Details for the file py_opw_kinematics-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 3.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8f9983dcb911b8d0d3318fb86b4e7aab504c6227b903f49455f7ab5d33e1a4a |
|
MD5 | 068a6f7d61fee6a15eb382ee2d19330d |
|
BLAKE2b-256 | ef40270e73c576a72b9e0625f9127269a4327c96007f803576ecc27511f45639 |
File details
Details for the file py_opw_kinematics-0.1.8-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 118817fc555205175971eb9a815e34e8d600ef76c177927eb921f9fb1f05cc64 |
|
MD5 | 8a01b8708fcaa822efb0e9b823b48684 |
|
BLAKE2b-256 | 648a0443ac37ed24adbf008486364a48d4f4ea8aa7cabbadbc706036f054b2e7 |
File details
Details for the file py_opw_kinematics-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: py_opw_kinematics-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59357f161379b67f79574eebde6ad61f292543fba6623d6bb3dfc55eb91336ba |
|
MD5 | 6ceec70805181f3e532e409024c5bf75 |
|
BLAKE2b-256 | 025c00cd84cbf7b59ca53743a42c9395bb462039299b577b62e29efad9b60804 |