Embedded deployment tools and examples for MechanicsDSL — Arduino, Raspberry Pi, and ARM
Project description
mechanicsdsl-embedded
Deploy MechanicsDSL simulations to Arduino, Raspberry Pi, and ARM edge devices.
Overview
mechanicsdsl-embedded provides deployment infrastructure and examples for running MechanicsDSL-generated simulations on embedded and edge platforms. Write your physical system once in DSL notation; generate optimized, dependency-free C++ or no_std Rust ready to flash or deploy.
All examples originate from MechanicsDSL DSL specifications — the originating spec is included as a comment in every generated source file.
Examples
Arduino
| Example | System | Rate | Hardware |
|---|---|---|---|
arduino_pendulum/ |
Simple pendulum + MPU6050 IMU | 250 Hz | Arduino Uno |
arduino_double_pendulum/ |
Double pendulum (chaotic) | 200 Hz | Arduino Mega 2560 |
Raspberry Pi
| Example | System | Rate | Features |
|---|---|---|---|
raspberry_pi_pendulum/ |
Simple pendulum | 250 Hz | pigpio, POSIX RT scheduling, NEON, GPIO energy alert |
raspberry_pi_double_pendulum/ |
Double pendulum | 200 Hz | pigpio, POSIX RT scheduling, GPIO energy alert |
Repository Structure
mechanicsdsl-embedded/
├── examples/
│ ├── arduino_pendulum/ .ino + README
│ ├── arduino_double_pendulum/ .ino + README
│ ├── raspberry_pi_pendulum/ .cpp + README
│ └── raspberry_pi_double_pendulum/ .cpp + README
├── cmake/
│ └── arm-toolchain.cmake ARM cross-compilation toolchain
├── docker/
│ ├── Dockerfile ARM cross-compilation environment
│ └── docker-compose.yml
├── scripts/
│ ├── cross_compile_arm.sh One-command ARM build via Docker
│ └── monitor_serial.py Real-time serial CSV plotter
├── docs/
│ ├── getting_started.md
│ └── hardware_guide.md Wiring, platform support, performance notes
└── tests/
└── test_eom.py Physics correctness via SciPy reference
Quick Start
Arduino
- Open
examples/arduino_pendulum/pendulum_realtime.inoin Arduino IDE - Select board and port → Upload
- Open Serial Monitor at 115200 baud
Raspberry Pi
sudo apt-get install pigpio libpigpio-dev cmake g++
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo ./pendulum_rpi
ARM Cross-Compilation (from x86 host)
./scripts/cross_compile_arm.sh
scp build_arm/pendulum_rpi pi@<ip>:~/
ssh pi@<ip> "sudo ~/pendulum_rpi"
Real-Time Serial Monitor
pip install pyserial matplotlib numpy
python scripts/monitor_serial.py --port /dev/ttyUSB0
Testing (no hardware required)
pip install pytest numpy scipy
pytest tests/ -v
Physics correctness is validated against SciPy reference integrations — period accuracy, energy conservation, equilibrium stability.
Code Generation
All examples can be regenerated from DSL specifications:
pip install mechanicsdsl-core[embedded]
mechanicsdsl generate pendulum.msl --target arduino
mechanicsdsl generate pendulum.msl --target raspberry_pi
Contributing
See CONTRIBUTING.md. Hardware validation on new platforms especially welcome.
License
MIT License — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mechanicsdsl_embedded-0.1.0.tar.gz.
File metadata
- Download URL: mechanicsdsl_embedded-0.1.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4a7c55f55db8bc3228fc0112397d295b9a58d39c940319af85b36351cf815f6
|
|
| MD5 |
16dbe97b6ffebe5321d91d870fe75a82
|
|
| BLAKE2b-256 |
de0b6ff0a1099344e19255e745d9b4e65b4eba80853cba7f42b594205fb40e74
|
Provenance
The following attestation bundles were made for mechanicsdsl_embedded-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on MechanicsDSL/mechanicsdsl-embedded
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mechanicsdsl_embedded-0.1.0.tar.gz -
Subject digest:
c4a7c55f55db8bc3228fc0112397d295b9a58d39c940319af85b36351cf815f6 - Sigstore transparency entry: 1118483255
- Sigstore integration time:
-
Permalink:
MechanicsDSL/mechanicsdsl-embedded@a164f562ca7f207d0f1e45abe3adbd9a928b525a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MechanicsDSL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a164f562ca7f207d0f1e45abe3adbd9a928b525a -
Trigger Event:
push
-
Statement type:
File details
Details for the file mechanicsdsl_embedded-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mechanicsdsl_embedded-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bf044044b727d41e7546921ee2226409baa5f4760ea7721dde7daa723f20d2f
|
|
| MD5 |
854649e1ceb7affbe0a2e8b4da15e102
|
|
| BLAKE2b-256 |
ec9961c79c316f210ac190c027c28742f4f06042fa584eed16ff65db5e4fa464
|
Provenance
The following attestation bundles were made for mechanicsdsl_embedded-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on MechanicsDSL/mechanicsdsl-embedded
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mechanicsdsl_embedded-0.1.0-py3-none-any.whl -
Subject digest:
1bf044044b727d41e7546921ee2226409baa5f4760ea7721dde7daa723f20d2f - Sigstore transparency entry: 1118483413
- Sigstore integration time:
-
Permalink:
MechanicsDSL/mechanicsdsl-embedded@a164f562ca7f207d0f1e45abe3adbd9a928b525a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MechanicsDSL
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@a164f562ca7f207d0f1e45abe3adbd9a928b525a -
Trigger Event:
push
-
Statement type: