Skip to main content

pyonics

A Python library for simulating and controlling pneumatic artificial muscles using Klamp't robotics library.

Quick Start

Install:

pip install pyonics

Create a controller:

import klampt
from pyonics import ExoController, MuscleEmulator

# Load configuration
config = {
    "has_robworld": True,
    "world_path": "data/world.xml",
    "core": "data/robot.rob",
    "attachments": "data/muscles.csv",
    "timestep": 0.01,
    "address": "127.0.0.1",
    "port": 5005
}

pcm = ExoController(config)

Create a dataframe of muscles that looks like the following:

name;link_a;link_b;transform_a;transform_b;label_a;label_b;turns;r_0;l_0;weave_length;max_pressure

right_inferior_latissimus;9;4;0,0,0;0,-1,0;superior;inferior;20;1;2;2;80000
import pandas as pd
from klampt.sim.simulation import SimpleSimulator

sim = SimpleSimulator(pcm.world)

muscleinfo_df = pd.read_csv(config['attachments'], sep=";")

for _, row in muscleinfo_df.iterrows():
    row = muscleinfo_df.iloc[x] 
    muscle = MuscleEmulator(row, pcm, sim)
    sim.addEmulator(pcm.robot, muscle)

Start simulation:

import asyncio

async def startup():
    await pcm.setup_osc_server()
    await pcm.server.enable_osc_logging()
    
    running = True
    while running:
        sim.simulate(0.01)
        await asyncio.sleep(0.01)
        
asyncio.run(startup())

Features

  • Pneumatic muscle emulation
  • Pressure-driven actuation
  • Klamp't simulator integration
  • OSC network control

Requirements

  • Python 3.x
  • Klamp't installed
  • python-osc
  • differint

Configuration Format

has_robworld: Boolean. Currently must be true.

world_path: Filepath to the world, in XML format.

core: Filepath to the robot, in .rob format.

attachments: Filepath to the muscle attachment CSV.

timestep: Control rate for the robot.

address: IP address. Currently only tested locally.

port: Networking port to receive on.

Muscle Attachment DataFrame Format

name: A name for the muscle.

link_a: The index of the first robot link to attach to.

link_b: The index of the second robot link to attach to.

transform_a: The local transform on link A to attach to.

transform_b: The local transform on link B to attach to.

label_a: For convenience. Functionality not yet implemented.

label_b: For convenience. Functionality not yet implemented.

turns: Number of turns in the weave.

r_0: Resting radius of the muscle.

l_0: Resting length of the muscle.

weave_length: Length of the weave surrounding the muscle.

pressure: Pressure of the muscle. Updated with muscle commands.

Acknowledgments

Thanks to Dr. Paul Savala, my research advisor, for support in developing this library.

Metadata

Release files for pyonics 2.1.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 pyonics 2.1.0
File Size Uploaded
pyonics-2.1.0.tar.gz 96.5 kB Details

Built distribution (wheel)

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

Total release size: 116.7 kB

Release files / pyonics-2.1.0.tar.gz

Download URL pyonics-2.1.0.tar.gz
Size 96.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7e07d2fdea0cc73c2f82ef3759af136761120a5c4bee8d5c82fb4d978560536e
BLAKE2b-256 checksum
How to use checksums
3657a353c67f478221a6ad645eb99020ed87c622e806a67133d45c8a8dc000bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

Release files / pyonics-2.1.0-py3-none-any.whl

Download URL pyonics-2.1.0-py3-none-any.whl
Size 20.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17671eba7f742104783c5fe266ad4db80c76dff1e904ec8d16229660d206818d
BLAKE2b-256 checksum
How to use checksums
36b70138d7ce3f40b37626d3d6be034cc1f30dfaa6c4c1b891311ab18cfcc405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.1.9

2 release files

0.1.6

2 release files

0.0.1

2 release files

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