Examples
Example code and tutorials for EmbodiK.
Not sure where to start?
New to the API โ Quickstart and Basic IK. Teleop stalls or weak tracking โ Solver Robustness & Recovery. Collision latency or safety โ Collision Constraints & Tuning. Full guide map โ Guides overview.
๐งญ Core Guides
- Basic IK Example โ Minimal
solve_position_step()IK bring-up - Multi-Task Multi-Constraints IK Example โ Hierarchical tasks with CoM support-polygon constraint
- Collision-Aware IK Example โ Self-collision avoidance with velocity-damper constraints
- CoM Constraint Example Overview โ Support-polygon inequality constraints and visualization
- Dual-Arm ECTS Example Overview โ Coordinated bimanual control modes and constraints
โญ Highlighted Scripts
These are the public examples that are kept closest to release quality and are the best starting points for users.
01_basic_ik_simple.pyโ Minimal fixed-base IK loop with velocity/acceleration solver selection02_collision_aware_IK.pyโ Collision-aware IK with velocity/acceleration solver selection and optional GPU mode03_teleop_ik.pyโ Minimal teleop input adapter into EmbodiK IK04_com_constraint_example.pyโ Visual Panda CoM, momentum, capture-point, and velocity-ZMP support demo05_dual_arm_ects.pyโ Dual-arm ECTS/Orthogonal coordination with collision handling06_bimanual_whole_body_ik.pyโ Bimanual whole-body teleop for AI Worker and RB-Y1 with opt-in centroidal support, collision handling, adaptive tuning, and optional Seer input07_unitree_g1_retargeting_ik.pyโ Unitree G1 retargeting IK with palm/foot/pelvis targets, CoM visualization, and optional self-collision constraints08_spot_full_body_ik_viser.pyโ Spot full-body IK in regular Viser with arm+torso, torso-only, full-body, and two-stage modes09_spot_locomanip_mjviser.pyโ Spot locomanipulation ONNX policy rollout in MuJoCo through mjviser10_parallel_trajectory_tracking.pyโ Model-derived Newton/Warp WBC over independently targeted Panda, AI Worker, or G1 worlds
Highlighted interactive examples use a shared solver runtime policy so example
code stays focused on tasks, targets, and visualization while robust constraint
handling remains in C++.
Viser examples share the same default browser endpoint,
http://localhost:8080; pass --port when running multiple viewers at once.
Acceleration Compatibility
Velocity remains the default solver for all IK examples. Acceleration is
selectable only where the script owns explicit q, dq, and dt state,
translates every active task and constraint, and can fail closed when the model
or policy is unsupported. A fixed-base model alone does not make a velocity
example acceleration-compatible. The acceleration-limit option on
KinematicsSolver only bounds changes in velocity output; it does not switch
the application to AccelerationSolver.
| Script | Acceleration status | Reason |
|---|---|---|
01_basic_ik_simple.py |
Selectable | Fixed-base scalar joints with explicit acceleration state and task references. |
02_collision_aware_IK.py |
Selectable | Adds explicit state ownership and a fail-closed sampled velocity-collision adapter. |
03_teleop_ik.py |
Velocity-only | The teleop backend owns velocity position-step and reset policy; no acceleration adapter is implemented. |
04_com_constraint_example.py |
Velocity-only | Owns explicit dq for position-step momentum, capture-point, and velocity-ZMP constraints; its visual runtime is not an acceleration adapter. |
05_dual_arm_ects.py |
Velocity-only | ECTS mode switching and its task semantics are not exposed by the initial acceleration task API. |
06_bimanual_whole_body_ik.py |
Velocity-only | Exposes opt-in position-step momentum, capture-point, and velocity-ZMP controls while retaining velocity-specific continuity, ownership, collision, and fallback policies. |
07_unitree_g1_retargeting_ik.py |
Unsupported | Uses a floating-base humanoid model; the acceleration solver accepts fixed-base scalar joints only. |
08_spot_full_body_ik_viser.py |
Unsupported | Uses a floating-base whole-body model and velocity-specific recovery policy. |
09_spot_locomanip_mjviser.py |
Unsupported | Couples floating-base IK to wheel/locomotion policy and MuJoCo runtime state. |
collision_hardening_demo.py |
Velocity-only | Demonstrates velocity position-step collision recovery and non-worsening-floor behavior. |
control_optimization.py |
Not applicable | Demonstrates standalone bounded least squares and positive-definite QPs without a robot solver loop. |
example_helpers/common_bimanual_teleop_app.py |
Velocity-only | Internal executable behind the bimanual example; it has the same velocity-specific policy dependencies. |
floating_base_torso_hierarchy.py |
Unsupported | Its subject is floating-base hierarchy behavior. |
gpu_collision_batch.py |
Not applicable | Benchmarks collision-distance queries, not an IK solver loop. |
harnesses/ai_worker_weighted_fallback_harness.py |
Not applicable | Measures the velocity solver's weighted-fallback policy, which the acceleration API does not import. |
harnesses/g1_four_gizmo_ik_benchmark.py |
Unsupported | Exercises the same floating-base G1 runtime as example 07. |
harnesses/joint_limit_recovery_harness.py |
Not applicable | Measures CPU velocity joint-limit redistribution, which the acceleration API does not import. |
10_parallel_trajectory_tracking.py |
Not applicable | Exercises the model-derived parallel velocity WBC pipeline. |
parallel_trajectory_tracking.py |
Not applicable | Compatibility launcher for the numbered parallel WBC example. |
robot_model_example.py |
Not applicable | Walks through model, FK, Jacobian, and CoM APIs without an IK loop. |
visualization_example.py |
Not applicable | Demonstrates visualization and marker APIs without an IK solver loop. |
For the exact supported constraints and failure behavior, see the Acceleration Solver guide.
๐งช Specialized References
These scripts remain available in a repository checkout or copied example bundle, but they are narrower benchmarks or API walkthroughs rather than the main demo path.
gpu_collision_batch.pyโ GPU batch collision detection benchmarkcontrol_optimization.pyโ Bounded actuator allocation, equality-constrained projection, and weighted affine fittingrobot_model_example.pyโ RobotModel API walkthrough (FK/Jacobians/CoM)visualization_example.pyโ Visualization and interactive marker usage
๐ Running Examples
Install and copy the example bundle once using the
Installation Guide. Then run scripts from the
copied embodik_examples directory:
If pip downloads embodik-*.tar.gz or fails while finding native CMake
packages, use the source-build fallback in the Installation Guide.
Examples default to the Panda preset; use --robot <key> to switch models.
For repository development, use Pixi:
Pass --robot <key> when you want a non-default robot preset.
๐งฐ Example Helpers
The examples/example_helpers/ directory contains reusable utilities:
ik_common.pyโ Shared defaults and small IK/collision helper functionsteleop_ik_backend.pyโ Reusable registered-task IK backend for the teleop examplecommon_bimanual_model_utils.py/common_bimanual_teleop_app.pyโ Shared bimanual whole-body IK helpers for public robot examplesdual_arm_ik_helper.pyโ Dual-arm IK utilitiesg1_model_utils.py/g1_ik_runtime.pyโ Unitree G1 model, retargeting, and IK runtime helperslimit_profiles/โ Joint limit profile configurations