Skip to main content

CREATE Lab, EPFL

VirtualModelControl

virtualmodelcontrol is a Python library for Virtual Model Control. You build a controller by attaching virtual springs, dampers and masses to your robot, and the library turns them into motor torques at the control rate, in simulation and on the real robot.

virtualmodelcontrol logo   Documentation: tutorials, examples, API

A soft arm whose tip a virtual spring pulls towards a goal, and the distance from the tip to the goal over time

Install

pip install virtualmodelcontrol

The newest code, from GitHub, before it is released (the same line updates an existing install):

pip install --upgrade "git+https://github.com/vigno0405/VirtualModelControl.git"

Virtual environments, conda, ROS 2 and pinned versions are covered in Installation.

Requirements

Python 3.10 or newer, tested with 3.10 to 3.14 on Ubuntu 22.04 and 24.04. Nothing to compile; ROS and LaTeX are not needed.

Dependencies

pip installs them with the library:

Package Version Used for
numpy 1.26 or newer, 2.x included arrays
CasADi 3.6 or newer the symbolic models, their derivatives and the compiled controllers
SciPy 1.11 or newer rotations of chains built from DH tables; fitting stiffness and damping
matplotlib 3.8 or newer figures and animations
imageio-ffmpeg 0.5 or newer MP4 videos of the animations
PyYAML 6 or newer robot and hardware files

The example in the figure

The robot and the controller are two separate mechanisms: the robot mechanism describes the hardware, and the controller holds the virtual elements placed on it.

import numpy as np
import virtualmodelcontrol as vmc
from virtualmodelcontrol.robots import helyx

arm = helyx.arm("145-145-145")  # a soft arm with nine tendon motors
tip = arm.point(s=1.0)

ctrl = vmc.Mechanism("ctrl")
ctrl.add("reach", vmc.LinearSpring(tip - [0.15, 0.0, 0.35], 600.0))  # [N/m]
ctrl.add("damp", vmc.LinearDamper(tip, 5.0))  # [N·s/m]
ctrl.add("gravity", vmc.GravityCompensation(arm))
controller = vmc.VMCController(vmc.compile(vmc.VirtualMechanismSystem(arm, ctrl)))

meas = vmc.Signals(0.0, motor_position=np.zeros(9), motor_velocity=np.zeros(9))
torques = controller.step(0.0, meas)["motor_torque"]  # [N·m], one per motor

The same controller runs on a simulation built from the robot's own masses, stiffness and damping; readme_figure.py draws the figure from this run.

arm = helyx.add_dynamics(arm)
plant = vmc.sim.ModelPlant(arm)
log = vmc.sim.run(plant, controller, vmc.sim.SimClock(dt=1 / 330), T=3.0)

Examples

Each example builds a ready-made robot, controls it in simulation and animates the run:

  • Soft arm: reach past an obstacle, and limit the force with a tanh spring.
  • Hanging soft arm: identify its stiffness and damping, and reach around an obstacle.
  • Two arms: squeeze an object between the tips of two soft arms.
  • Finger: a stiff fingertip and soft joint limits.
  • Hand: grasp a ball, alone or mounted on a UR5 arm.
  • Turtle: two cranks that follow a virtual flywheel.

Documentation

The documentation holds the tutorials, the examples, the concepts and the API. What changed is in the changelog, what comes next in the roadmap, and how to contribute in Contributing.

Authors

Lorenzo Vignoli, at the CREATE Lab of EPFL (Prof. Josie Hughes), in a collaboration with the University of Cambridge (Prof. Fulvio Forni). To cite the library, see CITATION.cff. The code is under the MIT license.

Metadata

Release files for virtualmodelcontrol 0.5.0

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

Source distribution (sdist)

Source distribution for virtualmodelcontrol 0.5.0
File Size Uploaded Provenance
virtualmodelcontrol-0.5.0.tar.gz 1.0 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for virtualmodelcontrol 0.5.0
File Interpreter ABI Platform
virtualmodelcontrol-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / virtualmodelcontrol-0.5.0.tar.gz

Download URL virtualmodelcontrol-0.5.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
2a87479cec0c2a96f41dc92559c6aaba06bc5b116aca154a5f0468166223a23c
BLAKE2b-256 checksum
How to use checksums
00847aed655485f1d4c0d5c9f07576a28b5553a17e711ccbb022184298043fd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 6, 2026.

Transparency log

Release files / virtualmodelcontrol-0.5.0-py3-none-any.whl

Download URL virtualmodelcontrol-0.5.0-py3-none-any.whl
Size 203.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d81b8e68f23818b2cb8d4ea6d79b1af62f4f13977f96beca66ac3d95deec73d1
BLAKE2b-256 checksum
How to use checksums
f5e9a6f8a4853cd09c954282c60124bfe999bf91bf51969ce6c48b936f43d0e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 6, 2026.

Transparency log

Security for virtualmodelcontrol 0.5.0

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for virtualmodelcontrol-0.5.0.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 6, 2026.

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