Skip to main content

ROS2 integration and package scaffolding for MechanicsDSL — compile physical systems to complete ROS2 packages

Project description

MechanicsDSL Logo

mechanicsdsl-ros2

Compile MechanicsDSL physical systems directly to complete ROS2 packages.

Active ROS2 MIT License Core Package


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

See docs/adding_systems.md.

Contributing

See CONTRIBUTING.md.

License

MIT License — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mechanicsdsl_ros2-0.1.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mechanicsdsl_ros2-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file mechanicsdsl_ros2-0.1.0.tar.gz.

File metadata

  • Download URL: mechanicsdsl_ros2-0.1.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mechanicsdsl_ros2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 97815dd84323334f28b3f53dc3165897a4b70a8e590811f205a7e10da7b12db9
MD5 419017d787e219842a7e943f18beed36
BLAKE2b-256 3d73f07e886e4512fb67300fb15818451f3e6213d5df3267debdf9b632a43313

See more details on using hashes here.

Provenance

The following attestation bundles were made for mechanicsdsl_ros2-0.1.0.tar.gz:

Publisher: publish-pypi.yml on MechanicsDSL/mechanicsdsl-ros2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mechanicsdsl_ros2-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mechanicsdsl_ros2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29ed543dbd7cb8d971072c0d92605f9778ffab62a564b341619f506853d0d162
MD5 b64268bb83b466a0b0aa919450e58fb0
BLAKE2b-256 75e83c19ab1b0e41967ae9eee2daa8bdf3c24ae35d365cdc0b2a6aff6236049c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mechanicsdsl_ros2-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on MechanicsDSL/mechanicsdsl-ros2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page