Everything Will Be IK (A robust Inverse Kinematics Library for Processing)

Hello all.

I’ve developed an extremely robust and versatile Inverse Kinematics library called Everything Will Be IK, and am making it freely available.

It supports pretty much anything you could reasonably want it to (prismatic joints are unreasonable, so it doesn’t support those), and it supports it well. Features include:

  • Excellent stability (the video preview has the stability feature turned off)
  • Position AND orientation targets (6-DOF).
  • Multiple end-effector support
  • Multiple Intermediary-effector support.
  • Dampening (stiffness control).
  • Target weight/priority (per target, per degree of freedom).
  • Highly versatile 3-DOF constraints with arbitrarily shaped orientation regions.

Due to the combination of its highly versatile constraint system, and its support for orientation+position effector targets, it’s extremely well suited to motion tracking and VR applications, though, if you intend to use it for robotics applications, please take reasonable precautions to ensure that your robot only explodes in the ways it was intended to.

As an added bonus, the library is built on top of a scenegraph library I’ve created which supports arbitrary affine transformtations (the scenegraph library is called Everything Will Be Affine) with lazy updating. So feel free to use that for whatever you like.

I’ve made a processing extension of the library available here. Just follow the install instructions if you’ve never manually installed a processing library before.

The library includes examples for programatically specifying an Armature+targets+end-effectors, and for loading a prespecified Armature from a file. The examples come in single precision and double precision flavors.

Any feedback, contributions, suggestions, or questions are welcome :slight_smile: .

Have fun!

3 Likes

Thanks so much for developing this and contributing it to the community. This sounds really exciting.

Could you say just a bit more about how a Processing user might use this with a sketch? You mention programmatic control, but the video looks like mouse-controlled positioning (and/or animation keyframing?), in some IDE I’m not familiar with.

P.S. great library naming scheme! Now it just needs a companion kinetic typography library called Everything Will Be Justified

The video is of me interacting with the library inside of an animation program I’m developing. It’s only to show how well the solver behaves.

As for how one can use it in a processing sketch, the .zip comes with a couple of examples (SimpleExample is the best one to start with if you’re trying to get your bearings [pick the single precision version if you prefer working with PVectors()]). It includes a much more basic interface for interaction. But if the example is a bit confusing, the basic idea is as follows.

  1. To start, you’ll need to create an armature (which is a container for a hierarchical collection of bones). You do this with Armature armature = new Armature();
  2. Every instance of an Armature will come with a default root bone already initialized. You build your Armature by adding Bones to this root bone, or to descendants of this root bone. So, first, get the Armature’s root Bone with
    Bone rootBone = armature.getRootBone();
  3. Next, let’s add a sequence of Bones to it. The Bone class has a constructor of the form Bone(parentBone, boneName, boneHeight). Using this constructor, the Bones we declare will automatically attach themselves to the parentBone you specify. So we’ll create our chain by creating a Bone called initialBone , and setting rootBone as its parent. Then creating a Bone called secondBone, and setting initialBone as its parent. Then a Bone called thirdBone, using secondBone as its parent, and so on…
initialBone = new Bone(rootBone, "initial", 74f);
secondBone = new Bone(initialBone, "nextBone", 86f);
thirdBone = new Bone(secondBone, "anotherBone", 98f); 
fourthBone = new Bone(thirdBone, "oneMoreBone", 70f);
fifthBone = new Bone(fourthBone, "fifthBone", 80f);  
  1. At this point, we’ve created a chain of 5 bones. We haven’t constrained them, but we’ve done enough to test the IK solver. To try it out, we’ll first pin the rootBone to a position in space (optional), then we’ll pin the fifthBone to a position in space.
rootBone.enablePin(); 
fifthBone.enablePin();
  1. Finally, we can move either of the pins to whatever position we want, and tell the IK solver, to solve for the new positions. The IK solver will then rotate the bones in the chain to reach both pins (or get as close as possible if they are unreachable).
fifthBone.setPin(new PVector(200, 50, 0));
armature.IKSolver(); //solve for all Bones in the Armature.

I think that should be enough to get you started. The rest is a matter of adding adding Bones of the right shapes and sizes to make the sort of armature you need (make it a human shape if you’re trying to simulate a human, or a dog shape if you’re trying to simulate a dog. This tutorial used a snake shape :wink: ).

Let me know if anything doesn’t make sense. I realize the constraint system is a bit shy of self-explanatory. It’s pretty easy to understand once it’s explained though, so I’ll post a guide on that soon. In the meantime, you might try reading the documentation on Kusudamas in the reference folder.

Oh! Actually I have just the project for that already. A scheme for LATEX style text justification in browser without using javascipt. :laughing:

2 Likes