{"id":14992266,"url":"https://github.com/openrr/k","last_synced_at":"2025-05-15T10:02:46.260Z","repository":{"id":37684700,"uuid":"99237988","full_name":"openrr/k","owner":"openrr","description":"k: Kinematics Library for rust-lang","archived":false,"fork":false,"pushed_at":"2025-02-25T06:27:56.000Z","size":518,"stargazers_count":190,"open_issues_count":10,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-14T16:53:57.202Z","etag":null,"topics":["kinematics","robotics","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openrr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-03T13:54:13.000Z","updated_at":"2025-03-01T14:45:50.000Z","dependencies_parsed_at":"2024-05-31T05:42:45.024Z","dependency_job_id":"7a83f636-ca67-4fc6-919a-abfaa0c7cb68","html_url":"https://github.com/openrr/k","commit_stats":{"total_commits":331,"total_committers":10,"mean_commits":33.1,"dds":"0.46827794561933533","last_synced_commit":"9b814ad2fbc0c525325b0a82b16b60a33b96654a"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrr%2Fk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrr%2Fk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrr%2Fk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openrr%2Fk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openrr","download_url":"https://codeload.github.com/openrr/k/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319716,"owners_count":22051072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kinematics","robotics","rust"],"created_at":"2024-09-24T15:00:53.941Z","updated_at":"2025-05-15T10:02:39.501Z","avatar_url":"https://github.com/openrr.png","language":"Rust","funding_links":[],"categories":["Motion Control"],"sub_categories":[],"readme":"# `k`: Kinematics library for rust-lang\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/openrr/k/ci.yml?branch=main\u0026logo=github)](https://github.com/openrr/k/actions) [![crates.io](https://img.shields.io/crates/v/k.svg?logo=rust)](https://crates.io/crates/k) [![codecov](https://codecov.io/gh/openrr/k/branch/main/graph/badge.svg?token=A0MGJ1V6US)](https://codecov.io/gh/openrr/k) [![docs](https://docs.rs/k/badge.svg)](https://docs.rs/k) [![discord](https://dcbadge.vercel.app/api/server/8DAFFKc88B?style=flat)](https://discord.gg/8DAFFKc88B)\n\n`k` has below functionalities.\n\n1. Forward kinematics\n1. Inverse kinematics\n1. URDF Loader\n\n`k` uses [nalgebra](https://nalgebra.org) as math library.\n\nSee [Document](https://docs.rs/k) and examples/ for more details.\n\n## Requirements to build examples\n\n```bash\nsudo apt install g++ cmake xorg-dev libglu1-mesa-dev\n```\n\n## IK example with GUI\n\n```bash\ncargo run --release --example interactive_ik\n```\n\n![ik_sample](https://github.com/openrr/k/raw/main/img/screenshot.png)\n\nPush below keys to move the end of the manipulator.\n\n- `f`: forward\n- `b`: backward\n- `p`: up\n- `n`: down\n- `l`: left\n- `r`: right\n- `z`: reset the manipulator state.\n\n## Create link tree from urdf and solve IK\n\n```rust\nuse k::prelude::*;\n\nfn main() {\n    // Load urdf file\n    let chain = k::Chain::\u003cf32\u003e::from_urdf_file(\"urdf/sample.urdf\").unwrap();\n    println!(\"chain: {chain}\");\n\n    // Set initial joint angles\n    let angles = vec![0.2, 0.2, 0.0, -1.0, 0.0, 0.0, 0.2, 0.2, 0.0, -1.0, 0.0, 0.0];\n\n    chain.set_joint_positions(\u0026angles).unwrap();\n    println!(\"initial angles={:?}\", chain.joint_positions());\n\n    let target_link = chain.find(\"l_wrist_pitch\").unwrap();\n\n    // Get the transform of the end of the manipulator (forward kinematics)\n    chain.update_transforms();\n    let mut target = target_link.world_transform().unwrap();\n\n    println!(\"initial target pos = {}\", target.translation);\n    println!(\"move z: +0.1\");\n    target.translation.vector.z += 0.1;\n\n    // Create IK solver with default settings\n    let solver = k::JacobianIkSolver::default();\n\n    // Create a set of joints from end joint\n    let arm = k::SerialChain::from_end(target_link);\n    // solve and move the manipulator angles\n    solver.solve(\u0026arm, \u0026target).unwrap();\n    println!(\"solved angles={:?}\", chain.joint_positions());\n\n    chain.update_transforms();\n    let solved_pose = target_link.world_transform().unwrap();\n    println!(\"solved target pos = {}\", solved_pose.translation);\n}\n```\n\n## Structure of API\n\nTop level interface is `Chain` struct. It contains `Node`s and they have the relations between nodes (parent/children).\nActual data (joint angle(position), transform between nodes) is stored in `Joint` object inside nodes.\n\n![ik_sample](https://github.com/openrr/k/raw/main/img/chain.png)\n\nYou can get local/world transform of nodes. See below figure to understand what is the node's `local_transform()` and `world_transform()`.\n\n![ik_sample](https://github.com/openrr/k/raw/main/img/transform.png)\n\n## `OpenRR` Community\n\n[Here](https://discord.gg/8DAFFKc88B) is a discord server for `OpenRR` users and developers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenrr%2Fk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenrr%2Fk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenrr%2Fk/lists"}