k: Kinematics library for rust-lang Build Status crates.io

k has below functionalities.

  1. Forward kinematics
  2. Inverse kinematics
  3. URDF Loader

k uses nalgebra as math library.

See Document and examples/ for more details.

IK example with GUI

bash cargo run --release --example interactive_ik

ik_sample

Push below keys to move the end of the manipulator.

Create link tree from urdf and solve IK

```rust extern crate k;

use k::InverseKinematicsSolver; use k::KinematicChain;

fn main() { let robot = k::urdf::createtreefromfile("urdf/sample.urdf").unwrap(); let mut arms = k::createkinematicchains(&robot); // set joint angles let angles = vec![0.8, 0.2, 0.0, -1.5, 0.0, -0.3]; arms[0].setjointangles(&angles).unwrap(); println!("initial angles={:?}", arms[0].getjointangles()); // get the transform of the end of the manipulator (forward kinematics) let mut target = arms[0].calcendtransform(); println!("initial target pos = {}", target.translation); println!("move z: +0.2"); target.translation.vector[2] += 0.2; let solver = k::JacobianIKSolverBuilder::new().finalize(); // solve and move the manipulator angles solver .solve(&mut arms[0], &target) .unwraporelse(|err| { println!("Err: {}", err); 0.0f32 }); println!("solved angles={:?}", arms[0].getjointangles()); println!("solved target pos = {}", arms[0].calcend_transform().translation); } ```