Skip to main content

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:

  1. Load the specified .kinfer model file
  2. Automatically download the robot's MJCF description from the K-Scale API
  3. 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 (.kinfer file)
  • 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 containing metadata.json and *.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 in kinfer_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

  1. Train a policy using K-Sim, IsaacLab, or IsaacGym
  2. Export the policy using K-Infer to create a .kinfer file
  3. Validate the policy using kinfer-sim (this tool)
  4. Deploy to physical robot using firmware

Documentation and Support

For more information about the K-Scale ecosystem:

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:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. 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.

Metadata

Release files for kinfer-sim 0.0.94

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kinfer-sim 0.0.94
File Size Uploaded Provenance
kinfer_sim-0.0.94.tar.gz 24.5 kB With provenance Details

Release files / kinfer_sim-0.0.94.tar.gz

Download URL kinfer_sim-0.0.94.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8b1a39e0461eecd868dbc3af866b13df188caa7923d8042ec06181967cea9e1b
BLAKE2b-256 checksum
How to use checksums
ce770fb8ab4e2990135fd9c7a7e78b9c773b41575097e6729a775fd5e9a2f6b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2025.

Transparency log

Security for kinfer-sim 0.0.94

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for kinfer_sim-0.0.94.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page