Skip to main content

A flexible inverse kinematics solver that supports any number of servo motors in series

Project description

InfIK

A 3D inverse kinematics solver for robotic systems with any number of linked servo motors

Features

  • Any number of joints are supported
  • Each joint can be uniquely constrained in cartesian coordinate space along any axis
    • The number of constraints equals the number of joints
  • Each servo motor's axis can be aligned in any direction relative to the previous joint
  • The solver can also predict the absolute location of any joint in the system if the position of each servo is known

Joints

All joints in a system can be modeled by the Joint object, which contains 5 fields (These fields are defined in the local space of the current joint, meaning they are independent of the other joints in the system):

  • alpha (const): The angle the rotation axis makes with the x-axis when projected onto the xy plane.
  • beta (const): The angle the rotation axis makes with the xy plane.
  • length (const): The length of this joint's lever arm, which is perpandicular to the rotation axis (the next joint orbits this joint)
  • height (const): The distance along the rotation axis from the last joint (how much the rotation point should be offset along the axis)
  • theta: The position of the servo, or the angular position around the rotation axis Alt text
  • Red: The rotation axis
  • Blue: The path traced by the next joint (end of arm) as it moves through a full rotation
  • Green: The arm
  • Orange: The local space of the next joint with the unit vectors i, j, and k corresponding to the x, y, and z-axis respectively

Local Joint Space

As mentioned, a joint is purely defined in its local space:

  • The x-axis is collinear with the line connecting this joint with the previous one (along the length of the previous joint's lever arm)
  • The z-axis is parallel to the rotation axis
  • The y-axis is the cross product of the x and z axes, and will always face "forward" such that increasing the previous joint's position will move the current joint in the direction of the y-axis

Note that theta is relative to the xy plane, meaning if alpha,beta, and theta are 0, the arm will lie along the y-axis. Increasing alpha will rotate the arm counterclockwise around the z-axis, while beta will have no effect if theta is 0. Increasing theta will rotate the arm counterclockwise around its rotation axis.

Constraints

Constraints are simple and have 3 fields:

  • joint_index: The index of the joint to place this constraint on
  • axis: The cartesian axis to constrain (x:0, y:1, z:2)
  • value: The constraint value; what value should the joint's global position have along axis? As mentioned, for the system to be solvable, the number of constraints must equal the number of joints

How to Use

  1. Import IK_3D.py and create an IKSystem object to model the system
    • joints: List of the joints in the system in the order they are connected
    • constraints: Unordered list of constraints to be placed on the system
    • allowed_error (optional): The maximum allowed difference between two consecutive guesses (Default: 1e-3)
    • max_iterations (optional): The maximum number of iterations allowed before the solver concludes that it failed to converge (Default: 100)
      • If this number is reached, the success flag returned from the Solver.solve() method will be False
  2. Solve the system by calling Solver.solve(IKSystem) on any IKSystem object, which will return a list of servo positions in the same order as the joints in the system
    • These positions can also be accessed directly from joints in the IKSystem object (Joint.theta)

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

infik-1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

InfIK-1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file infik-1.1.tar.gz.

File metadata

  • Download URL: infik-1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for infik-1.1.tar.gz
Algorithm Hash digest
SHA256 99b2914a006a06bfd6fa6bb26738268905fb04a751b10d5a766390e103962298
MD5 819288e4aba1fc92934c3f3df97c62fe
BLAKE2b-256 56811fcb0c740fecb0b7b50586498804354878ba9fd5def086e2e3543211f239

See more details on using hashes here.

File details

Details for the file InfIK-1.1-py3-none-any.whl.

File metadata

  • Download URL: InfIK-1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for InfIK-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89c8fdf2a2269565690561024014e7f47008b08fa992a05e4dd84a21d3b09908
MD5 ccde2ec1b8f28768fbb1ccd329dfc853
BLAKE2b-256 57a94f5c1ec58ed48ad584f102697b5a34720e5e45290f4961b5b9df63d1dbe5

See more details on using hashes here.

Supported by

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