mechanicsdsl-ros2
Compile MechanicsDSL physical systems directly to complete ROS2 packages.
Overview
mechanicsdsl-ros2 provides a dedicated ROS2 integration layer for MechanicsDSL. Physical systems defined in DSL notation compile to complete, buildable ROS2 packages — no manual C++ required for the physics layer.
Package: mechanicsdsl_pendulum
The first generated package, currently including:
Nodes
| Node | System | Rate | Topics |
|---|---|---|---|
pendulum_node |
Simple pendulum | 250 Hz | /mechanicsdsl/pendulum/state, /mechanicsdsl/pendulum/energy |
double_pendulum_node |
Double pendulum | 200 Hz | /double_pendulum/state |
Messages
| Message | Fields |
|---|---|
PendulumState |
header, theta, omega, energy, energy_drift, sim_time |
SystemState |
header, q[], q_dot[], q_ddot[], lambda[], energy, energy_drift, conserved_quantities[], sim_time |
Launch Files
ros2 launch mechanicsdsl_pendulum pendulum.launch.py
ros2 launch mechanicsdsl_pendulum pendulum.launch.py l_m:=0.5 theta0_rad:=0.8
ros2 launch mechanicsdsl_pendulum double_pendulum.launch.py theta1_0:=0.3 theta2_0:=0.2
Repository Structure
mechanicsdsl-ros2/
├── mechanicsdsl_pendulum/
│ ├── package.xml, CMakeLists.txt
│ ├── msg/ PendulumState.msg, SystemState.msg
│ ├── src/ pendulum_node.cpp, double_pendulum_node.cpp
│ ├── include/mechanicsdsl_pendulum/ pendulum_dynamics.hpp
│ ├── launch/ pendulum.launch.py, double_pendulum.launch.py
│ ├── config/ pendulum_params.yaml
│ └── test/ test_pendulum_eom.cpp, test_pendulum_integration.py
├── docker/ Dockerfile (ROS2 Jazzy + MechanicsDSL)
├── scripts/ build.sh, monitor.sh
└── docs/ getting_started.md, architecture.md, adding_systems.md
Quick Start
# Clone into ROS2 workspace
mkdir -p ~/ros2_ws/src && cd ~/ros2_ws/src
git clone https://github.com/MechanicsDSL/mechanicsdsl-ros2.git
# Build
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build --packages-select mechanicsdsl_pendulum
source install/setup.bash
# Run
ros2 launch mechanicsdsl_pendulum pendulum.launch.py
Docker:
docker build -t mechanicsdsl-ros2:jazzy docker/
docker run --rm -it mechanicsdsl-ros2:jazzy
Monitoring
ros2 topic echo /mechanicsdsl/pendulum/state
ros2 topic hz /mechanicsdsl/pendulum/state # should be ~250 Hz
# Reset
ros2 topic pub --once /pendulum/reset std_msgs/msg/Bool "data: true"
Testing
colcon test --packages-select mechanicsdsl_pendulum
colcon test-result --verbose
GTests cover EOM correctness, energy conservation, equilibrium stability, and small-angle period accuracy.
Architecture
See docs/architecture.md for the full node/message/layer diagram.
Adding New Systems
Contributing
See CONTRIBUTING.md.
License
MIT License — see LICENSE.
Metadata
Release files for mechanicsdsl-ros2 0.1.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 | |
|---|---|---|---|
| mechanicsdsl_ros2-0.1.0.tar.gz | 18.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mechanicsdsl_ros2-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.2 kB
Release files / mechanicsdsl_ros2-0.1.0.tar.gz
| Download URL | mechanicsdsl_ros2-0.1.0.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97815dd84323334f28b3f53dc3165897a4b70a8e590811f205a7e10da7b12db9
|
|
BLAKE2b-256 checksum How to use checksums |
3d73f07e886e4512fb67300fb15818451f3e6213d5df3267debdf9b632a43313
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 17, 2026.
Transparency logRelease files / mechanicsdsl_ros2-0.1.0-py3-none-any.whl
| Download URL | mechanicsdsl_ros2-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
29ed543dbd7cb8d971072c0d92605f9778ffab62a564b341619f506853d0d162
|
|
BLAKE2b-256 checksum How to use checksums |
75e83c19ab1b0e41967ae9eee2daa8bdf3c24ae35d365cdc0b2a6aff6236049c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 17, 2026.
Transparency log