The kinfer-sim project
Project description
kinfer-sim
Simulation backend for visualizing K-Infer models in real-time.
Overview
kinfer-sim is a Python package that provides a simulation environment for running and visualizing exported K-Infer models. It enables developers to test and validate their trained policies in simulation before deploying them to physical K-Scale robots like K-Bot.
This tool is part of the K-Scale Labs ecosystem, which provides an integrated open-source stack for humanoid robotics—from hardware design to machine learning models.
Features
- Real-time visualization of K-Infer model policies
- Automatic MJCF downloading from the K-Scale API
- Command-line interface for quick testing
- Sim-to-real validation before hardware deployment
- Support for various robot models including K-Bot
Installation
Install via pip:
pip install kinfer-sim
Quick Start
Run an exported K-Infer model with a single command:
kinfer-sim examples/kbot_walking.kinfer kbot-headless --use-keyboard
This will:
- Load the specified
.kinfermodel file - Automatically download the robot's MJCF description from the K-Scale API
- Launch the simulation viewer
Usage
Basic Command Structure
kinfer-sim <kinfer-path> <mujoco-model-name> [OPTIONS]
Arguments
Positional Arguments:
kinfer-path: Path to your exported K-Infer model (.kinferfile)mujoco-model-name: Name of the robot model (e.g.,kbot,zbot)
MuJoCo Settings:
--mujoco-scene <str>: MuJoCo scene to use (default:smooth)--no-cache: Don't use cached metadata--debug: Enable debug logging--local-model-dir <path>: Path to local robot directory containingmetadata.jsonand*.mjcf/*.xml(bypasses K-Scale API)
Physics Settings:
--dt <float>: Simulation timestep (default:0.0001)--pd-update-frequency <float>: PD update frequency for actuators in Hz (default:1000.0)--no-gravity: Disable gravity--start-height <float>: Initial height of the robot in meters (default:1.1)--initial-quat <w,x,y,z>: Initial quaternion as comma-separated values (e.g.,1.0,0.0,0.0,0.0)--suspend: Suspend robot base in place to prevent falling--quat-name <str>: Name of the quaternion sensor (default:imu_site_quat)--acc-name <str>: Name of the accelerometer sensor (default:imu_acc)--gyro-name <str>: Name of the gyroscope sensor (default:imu_gyro)
Rendering Settings:
--no-render: Disable rendering--render-frequency <float>: Render frequency in Hz (default:1.0)--frame-width <int>: Frame width in pixels (default:640)--frame-height <int>: Frame height in pixels (default:480)--camera <str>: Camera to use for rendering--save-path <path>: Path to save logs and videos (default:logs)--save-video: Save video of the simulation--save-logs: Save simulation logs--free-camera: Enable free camera control
Model Settings:
--use-keyboard: Use keyboard to control the robot with a 16 dim command defined inkinfer_sim/keyboard.py
Randomization Settings (for domain randomization testing):
--command-delay-min <float>: Minimum command delay in seconds--command-delay-max <float>: Maximum command delay in seconds--drop-rate <float>: Drop actions with this probability (default:0.0)--joint-pos-delta-noise <float>: Joint position delta noise in degrees (default:0.0)--joint-pos-noise <float>: Joint position noise in degrees (default:0.0)--joint-vel-noise <float>: Joint velocity noise in degrees/second (default:0.0)--joint-zero-noise <float>: Joint zero noise in degrees (default:0.0)--accelerometer-noise <float>: Accelerometer noise in m/s² (default:0.0)--gyroscope-noise <float>: Gyroscope noise in rad/s (default:0.0)--projected-gravity-noise <float>: Projected gravity noise in m/s² (default:0.0)
Example Workflows
Enable 16 dimensional keyboard control:
kinfer-sim <kinfer-path> kbot-headless --use-keyboard --command-type unified
Test with domain randomization:
kinfer-sim <kinfer-path> kbot-headless \
--drop-rate 0.1 \
--joint-pos-noise 0.5 \
--gyroscope-noise 0.01
Use local robot model:
kinfer-sim <kinfer-path> kbot-headless --local-model-dir <path to local model>
Suspend robot for testing:
kinfer-sim <kinfer-path> kbot-headless --suspend
What is K-Infer?
K-Infer is K-Scale Labs' model export and inference tool. It converts trained reinforcement learning policies into an optimized format (.kinfer files) that can be:
- Visualized in simulation using
kinfer-sim - Deployed to physical robots using the K-Scale runtime
- Shared and evaluated in the K-Scale benchmarks
Integration with K-Scale Ecosystem
kinfer-sim works seamlessly with other K-Scale tools:
- K-Sim / IsaacLab / IsaacGym: GPU-accelerated training environments for learning policies
- K-Infer: Model export and inference tool
- kinfer-sim: This package - for visualization and validation (you are here!)
- Firmware: For deploying policies to physical hardware
Typical Workflow
- Train a policy using K-Sim, IsaacLab, or IsaacGym
- Export the policy using K-Infer to create a
.kinferfile - Validate the policy using
kinfer-sim(this tool) - Deploy to physical robot using firmware
Documentation and Support
For more information about the K-Scale ecosystem:
- Main Documentation: https://docs.kscale.dev
- Simulation Guide: https://docs.kscale.dev/robots/k-bot/simulation
- K-Scale Labs: https://kscale.dev
- Discord: Join our Discord community for real-time help
- Issues: Report bugs or request features on GitHub Issues
Contributing
We welcome contributions! K-Scale Labs is building the world's most accessible platform for embodied intelligence, and we believe in open-source collaboration.
To contribute:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Check out our GitHub organization for more projects to contribute to.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Citation
If you use this software in your research, please cite:
@software{kinfer_sim,
title = {kinfer-sim: Simulation backend for K-Infer models},
author = {K-Scale Labs},
year = {2025},
url = {https://github.com/kscalelabs/kinfer-sim}
}
Built with ❤️ by K-Scale Labs - Making robots accessible to everyone.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file kinfer_sim-0.0.94.tar.gz.
File metadata
- Download URL: kinfer_sim-0.0.94.tar.gz
- Upload date:
- Size: 24.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1a39e0461eecd868dbc3af866b13df188caa7923d8042ec06181967cea9e1b
|
|
| MD5 |
43079a0d07dd9f0f191b203b7eee2e7a
|
|
| BLAKE2b-256 |
ce770fb8ab4e2990135fd9c7a7e78b9c773b41575097e6729a775fd5e9a2f6b0
|
Provenance
The following attestation bundles were made for kinfer_sim-0.0.94.tar.gz:
Publisher:
publish.yml on kscalelabs/kinfer-sim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kinfer_sim-0.0.94.tar.gz -
Subject digest:
8b1a39e0461eecd868dbc3af866b13df188caa7923d8042ec06181967cea9e1b - Sigstore transparency entry: 638214288
- Sigstore integration time:
-
Permalink:
kscalelabs/kinfer-sim@033c8f926940cb7ed9bb3c8aede56e3209236613 -
Branch / Tag:
refs/tags/0.0.94 - Owner: https://github.com/kscalelabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@033c8f926940cb7ed9bb3c8aede56e3209236613 -
Trigger Event:
release
-
Statement type: