Skip to main content

tinyik is a simple and naive inverse kinematics solver.

It defines the actuator as a set of links and revolute joints from an origin. Here is the example of a robot arm that consists of two joints that rotate around z-axis and two links of 1.0 length along x-axis:

>>> import tinyik
>>> arm = tinyik.Actuator(['z', [1., 0., 0.], 'z', [1., 0., 0.]])

Since the joint angles are zero by default, the end-effector position is at (2.0, 0, 0):

>>> arm.angles
array([ 0.,  0.])
>>> arm.ee
array([ 2.,  0.,  0.])

Sets the joint angles to 30 and 60 degrees to calculate a new position of the end-effector:

>>> import numpy as np
>>> arm.angles = [np.pi / 6, np.pi / 3]  # or np.deg2rad([30, 60])
>>> arm.ee
array([ 0.8660254,  1.5      ,  0.       ])

Sets a position of the end-effector to calculate the joint angles:

>>> arm.ee = [2 / np.sqrt(2), 2 / np.sqrt(2), 0.]
>>> arm.angles
array([  7.85398147e-01,   3.23715739e-08])
>>> np.round(np.rad2deg(arm.angles))
array([ 45.,   0.])

Optionally, it has the visualization feature. Passes the actuator to it to visualize its structure:

>>> leg = tinyik.Actuator([[.3, .0, .0], 'z', [.3, .0, .0], 'x', [.0, -.5, .0], 'x', [.0, -.5, .0]])
>>> leg.angles = np.deg2rad([30, 45, -90])
>>> tinyik.visualize(leg)
https://raw.githubusercontent.com/lanius/tinyik/master/assets/viz_structure.png

Passes with the target position, can compare before and after the IK. The gray links are before IK and the white links are after it. The red sphere is the target position:

>>> tinyik.visualize(leg, target=[.8, .0, .8])
https://raw.githubusercontent.com/lanius/tinyik/master/assets/viz_ik.png

Installation

$ pip install tinyik

With the visualization feature:

$ pip install tinyik[viz]

Metadata

Release files for tinyik 2.2.1

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

Source distribution (sdist)

Source distribution for tinyik 2.2.1
File Size Uploaded
tinyik-2.2.1.tar.gz 7.8 kB Details

Built distribution (wheel)

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

Total release size: 16.2 kB

Release files / tinyik-2.2.1.tar.gz

Download URL tinyik-2.2.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a8898489afea50a5e81d790eb81adafd04d6f47e53282bcb027afe432dc10ef7
BLAKE2b-256 checksum
How to use checksums
92b23755c90a221838b1d234770ee5da696dccfc4446371c7beff84857c3d5c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Windows/10

Release files / tinyik-2.2.1-py3-none-any.whl

Download URL tinyik-2.2.1-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5bb07d5eb99a98dd95d937f1d39bfb009d6cc988381ac5f98582075006dd179
BLAKE2b-256 checksum
How to use checksums
95329021c857f791ab91e470d840dd97d3567da4c1c20eeb881825fd542742b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Windows/10

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

0.0.1

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