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.
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 |
| 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 |
| Dynamixel SDK | 3.7 or newer | Dynamixel motors |
| pyserial | 3.5 or newer | serial sensors |
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-290-290") # a soft arm with nine tendon motors
tip = arm.point(s=1.0)
ctrl = vmc.Mechanism("ctrl")
ctrl.add("reach", vmc.LinearSpring(tip - [0.25, 0.0, 0.55], 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 a point, avoid an obstacle, shape the whole arm.
- 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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| virtualmodelcontrol-0.2.0.tar.gz | 390.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| virtualmodelcontrol-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 493.1 kB
Release files / virtualmodelcontrol-0.2.0.tar.gz
| Download URL | virtualmodelcontrol-0.2.0.tar.gz |
|---|---|
| Size | 390.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c05c8ca5ed0823117931613c47333689cb4fceb4b408cae4f32be8128e9c40d
|
|
BLAKE2b-256 checksum How to use checksums |
36c59978aa4cafe5985ccad029e2bed47817e262520430bc62b79569a2228a9a
|
| 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 4, 2026.
Transparency logRelease files / virtualmodelcontrol-0.2.0-py3-none-any.whl
| Download URL | virtualmodelcontrol-0.2.0-py3-none-any.whl |
|---|---|
| Size | 102.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e2885e1b5f844893750716f4d4ba598eb2efec52ecb4fa3705ba117db44e854
|
|
BLAKE2b-256 checksum How to use checksums |
8a51ac6c94e37bf5089a6b68ce3a5ff825d6f9b5555bf9651dc2a4d0896f9c6b
|
| 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 4, 2026.
Transparency logSecurity for virtualmodelcontrol 0.2.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.
Attestation for virtualmodelcontrol-0.2.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 4, 2026.
Transparency logA 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.