Skip to main content

No project description provided

Project description

Python Industrial Robots

This is an experimental set of python bindings for the also-experimental Industrial Robots library written in Rust.

This is a proof-of-concept for some simple tools related to generating and predicting motion and planning for industrial robots. Currently, it is only wrapping a forward and inverse kinematics solver for the Fanuc LR Mate 200iD, a small, prolific industrial robot arm. The solver itself uses the K library for kinematics, with the robot model painstakingly verified against the R30iB controller's handling of joints and the J2/J3 interaction so that values put into the model matching the controller will produce the same pose and format that the actual controller will report.

In the longer term, if the underlying Rust library proves to be useful, I will likely expand it to perform some amount of motion planning and collision detection and leave it open for others to add robots, and will update these bindings to match as many features as possible.

Simple Use

import numpy
from py_industrial_robots import fanuc_fk, fanuc_ik

# Forward Kinematics
# =============================================

# Specify the joint angles in degrees exactly as they would go into the R30iB
poses = fanuc_fk([0.0, 0.0, 0.0, 0.0, 0.0, 0.0])

The result is a list of six poses, one for each joint. The poses themselves are in the form of lists 16 elements long, representing a 4x4 matrix in row-major order. The last pose is the pose of the robot flange and will match what the controller reports when set to an empty tool frame. The other poses will have origins which lie on the X-Z plane on the axis of the joint, but the orientation of the poses will match the world coordinate system when the robot is at its zero position.

Physical distance units are in millimeters, as that's what the robot itself uses.

Poses can be converted to numpy matrices as follows:

for i, pose in enumerate(poses):
    mat = numpy.matrix(pose).reshape(4, 4)
    print(f"Joint {i} pose:\n{mat}\n")

Inverse kinematics can be performed by passing a pose (in the same list-based, row-major format as they are received) and a list of initial joint angles to the fanuc_ik function. The underlying solver uses a Jacobian based approach. The function will throw an exception if the solver does not find a result. The result will be a list of six joint values in degrees as they would be sent to the R30iB controller.

current_joints = [20.0, 30.0, -10.0, 15.0, 90.0, 12.0]
poses = fanuc_fk(current_joints)

# Get the pose of the robot flange and turn it into a numpy matrix
end_pose = numpy.matrix(poses[-1]).reshape(4, 4)

# Build a transform that moves the current position by x=10, y=20, z=30
transform = numpy.identity(4)
transform[:3, 3] = [10.0, 20.0, 30.0]

# Generate a new desired target pose
target_pose = transform * end_pose

# Convert into the list-based, row-major format
target = list(target_pose.flat)

# Run the IK solver
new_joints = fanuc_ik(target, current_joints)

Note: I currently use lists to move numbers back and forth across the boundary of Python and the compiled Rust binaries because I have yet to figure out how to use the Rust numpy package to create native numpy arrays.

Building

The goal is to be able to cross compile libraries for x86_64 Windows and Linux in a Linux based build environment. I've managed to do that locally with the following.

Prerequisites

  • The Rust toolchain must be installed first
  • MinGW-w64 must be installed. On Debian based systems this is the mingw-w64 package.
  • llvm must be installed, on Debian based systems this is the llvm package.
  • The Windows target must be added to the Rust toolchain. This can be done with rustup target add x86_64-pc-windows-msvc. There is a -gnu version as well, but the default Python Windows binaries are built with MSVC.
  • Python must be installed and maturin must be installed into the Python environment. This can be done with pip install maturin.

Example on Debian/Ubuntu build environment:

sudo apt-get install mingw-w64 llvm curl python3 python3-pip 
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add x86_64-pc-windows-msvc

# Install maturin into the Python environment, if you're not in a container you 
probably want to do this in a virtualenv 
pip3 install maturin

Building

# Build for Linux
maturin build --release --strip

# Build for Windows
maturin build --release --strip --target x86_64-pc-windows-msvc

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_industrial_robots-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distributions

py_industrial_robots-0.1.1-cp37-abi3-win_amd64.whl (196.9 kB view details)

Uploaded CPython 3.7+ Windows x86-64

py_industrial_robots-0.1.1-cp37-abi3-win32.whl (185.5 kB view details)

Uploaded CPython 3.7+ Windows x86

py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ s390x

py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.3 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ppc64le

py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (1.1 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (1.2 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

py_industrial_robots-0.1.1-cp37-abi3-macosx_11_0_arm64.whl (294.3 kB view details)

Uploaded CPython 3.7+ macOS 11.0+ ARM64

py_industrial_robots-0.1.1-cp37-abi3-macosx_10_7_x86_64.whl (321.8 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

Details for the file py_industrial_robots-0.1.1.tar.gz.

File metadata

  • Download URL: py_industrial_robots-0.1.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for py_industrial_robots-0.1.1.tar.gz
Algorithm Hash digest
SHA256 964109f58a673c18b1ba48b10ea926ae55610e110931768eba47d5a75bcec3f8
MD5 a4a2374f0ce80bea56db1380e671922e
BLAKE2b-256 694722afce9bbe94377aa67fd7610be3fc6c6f32341dec72130eb7d1b2dcbe54

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6da821971b32ed2cd86ec6dc3103d9b8b90795af59d73ef25ea616dbd27d3ad0
MD5 1a8cb1a14b52b7855efda84f6a9a7964
BLAKE2b-256 10bbc5a5e4d6ec8c2fefaa2ba4d986dde2748f55d138a8a1c24ad79c12297c65

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-win32.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 37dd7814503742f25fd2dab63080f408a7c0c13100b80795aeeb25cfb2856418
MD5 b5cc3976bf17a506282309e3cc52f106
BLAKE2b-256 2cfa47c306c356d983863f8de6f70c6c894c1c7e96e1803fbe633146e30cd0e6

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b587a8ffa5092ac99e477ab566199b7a445be86460e4b6ab46332fa675497f91
MD5 ee4d5ff54c37d9ea8bedcbefa27ab772
BLAKE2b-256 aa53d3cdf134c98cf0628b751fcf56817d510673e822677825fa01f032d34f45

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 627113fd28c0d7a529652dc860578efedd293b94bf45b2bc7ef6a1b382e3e1e4
MD5 29e013e0ca51983d6f4db0cb5d773b45
BLAKE2b-256 ef95d338fc8d9e056cbc3fa50e865ecfcae419b47a30debac97226b864df61bd

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 dd51f4d544de52424e9074cff32395adc72cc6e403951780e8b1e35c1dda846e
MD5 aab2f8a6ebffaf1dff7bb89c5664dad6
BLAKE2b-256 f4b611081f27e794a5a9e7263e2faaac9435f80e40cd16f6624ba61cbdcf9368

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 e55d927bd5af54cefbf64fd594a4a8a1994f6d313675e696ba5361da5b01e1fb
MD5 67ffefe8c79a0cdb29e38c348ceaa621
BLAKE2b-256 eb1255f21e462a436619c06010c63092b31fd672472f5197228a305a2798bfe7

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8fe5722f6bad1d2626d4c4a8ede848db2bd5971ed3020f33b24761f95e3d6b5d
MD5 1db6bac5f16a5c13de7446b0afa5637b
BLAKE2b-256 f7a2b85195243e56d44faa70ff4d12ce9f7690f823264c34616393cbd0f78ede

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 3a6e62f28a1cbf7e743347d312919b25e2e381ae2ca9c973bdca318170661cee
MD5 9d5a4ada1b65525ab9a3980a9d4d58f1
BLAKE2b-256 be35a9eb3d7d63d006c3850e48a54c9a02219232f3c854342e0be8366982bc23

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 176f8bc13bedee1d9ff43edc2a70963cec1aec195a01d3dcb274df3288b78278
MD5 d6b4430b4ffc4fda39ea30a72868fe96
BLAKE2b-256 f700cfa96393c51f9c1937efe97a5b88938c4d141f6d2691880ba15b94fcf442

See more details on using hashes here.

File details

Details for the file py_industrial_robots-0.1.1-cp37-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for py_industrial_robots-0.1.1-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 701dc3d8cfe8438023bf6cf6b3d3256e6e7943b5fda3409efa552e8af08f7591
MD5 0ccf4a753abe8f514484c2c34c2dfe16
BLAKE2b-256 a0ec94b57167c5d6c051946b02cc335247b8fda9ab0566a3767202d67d3ee7ed

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