Skip to main content

moro

PyPI version License

moro is a Python library for symbolic modeling, analysis, numerical simulation, and visualization of serial robot manipulators.

It is designed primarily for robotics education and for workflows where inspecting the underlying kinematic and dynamic expressions is as important as evaluating them numerically.

Features

  • Robot modeling: Define serial manipulators with revolute and prismatic joints using Denavit-Hartenberg parameters.
  • Transformations: Work with SO(3) rotations, SE(3) homogeneous transformations, Euler/Tait-Bryan angles, axis-angle, quaternions, and rotation vectors.
  • Forward kinematics: Compute symbolic end-effector and intermediate-frame transformations.
  • Differential kinematics: Evaluate task Jacobians, Cartesian velocities, velocity IK, singular values, numerical rank, condition number, and manipulability.
  • Inverse kinematics: Solve numerical Cartesian position IK and full-pose IK with Jacobian-based methods; position-only CCD remains available.
  • Trajectory generation: Generate point-to-point and multi-waypoint linear, cubic, and quintic joint/Cartesian-position trajectories, plus synchronized trapezoidal joint profiles.
  • Dynamics: Derive symbolic equations of motion, evaluate inverse/forward dynamics and sampled trajectory efforts numerically, and integrate motion with solve_ivp.
  • Workspace sampling: Explore approximate reachable Cartesian workspaces with seeded random, Sobol, Latin-hypercube, or grid joint-space samplers and Cartesian plane sections.
  • Visualization: Plot and animate robot configurations with Three.js by default; visualize workspaces and sections in Three.js with optional grids, or select Matplotlib explicitly.

Installation

Install the latest stable release from PyPI:

pip install moro

To install the current code directly from GitHub:

pip install git+https://github.com/JorgeDeLosSantos/moro.git@master

The develop branch contains ongoing work and may include unreleased API changes.

Moro requires Python 3.11 or newer.

Its main runtime dependencies are SymPy, NumPy, Matplotlib, SciPy, and IPython (for Three.js HTML output).

Quick Start

The following example creates a symbolic planar 2R manipulator and evaluates its forward kinematics and Jacobian at one configuration:

from moro import Robot
from moro.abc import q1, q2, l1, l2

robot = Robot(
    (l1, 0, 0, q1, "r"),
    (l2, 0, 0, q2, "r"),
)

T = robot.T
J = robot.J

values = {
    l1: 1.0,
    l2: 1.0,
    q1: 0.5,
    q2: 0.8,
}

T_num = T.subs(values).evalf()
J_num = J.subs(values).evalf()

The same symbolic model can be visualized:

from moro.visualization import RobotVisualizer

viz = RobotVisualizer(robot)
viz.plot(values)  # interactive Three.js viewer (Jupyter / Colab)

Three.js is the default for plotting and animating configurations. When you need a Matplotlib figure or animation, select it explicitly:

fig, ax = viz.plot(values, backend="matplotlib")

With the default VisualizationStyle(), Three.js displays revolute cylinders and prismatic boxes when the robot's joint metadata is available; Matplotlib retains simple spherical markers. The interactive HTML viewer loads Three.js resources in the browser, so it needs access to its CDN.

Inverse Kinematics

Position IK:

from moro.inverse_kinematics import solve_position_ik

solution = solve_position_ik(
    robot,
    [1.5, 0.5, 0.0],
    q0=[0.1, 0.1],
    parameters={l1: 1.0, l2: 1.0},
)

For full-pose IK, solve_pose_ik() accepts a numerical homogeneous transform as its target, with an initial joint estimate. See the full-pose IK example for a complete worked problem.

Trajectories

Generate a smooth joint-space trajectory with:

import numpy as np
from moro.trajectory import joint_trajectory

traj = joint_trajectory(
    [0.0, 0.0],
    [0.8, -0.4],
    np.linspace(0.0, 2.0, 101),
    method="quintic",
)

The result uses time-major arrays such as traj.q.shape == (N, dof) and can be animated with physical timestamps using viz.animate(traj.q, times=traj.t) in Three.js. For multi-waypoint motion and synchronized trapezoidal profiles, use joint_waypoint_trajectory() and joint_trapezoidal_trajectory(), respectively.

Dynamics and Simulation

After assigning masses, centers of mass, inertia tensors, and gravity, the symbolic manipulator equation is obtained with:

model = robot.dynamic_model()

dynamic_model() returns the matrix-form equation

M(q) qdd + C(q, qd) qd + G(q) = tau

The former per-joint Euler-Lagrange behavior is available as:

equations = robot.euler_lagrange_equations()

Numerical dynamics and simulation live in moro.dynamics. For example, we can define a planar 2R manipulator with numerical physical properties, evaluate its required torques, and simulate a constant input:

import sympy as sp
from moro.dynamics import (
    inverse_dynamics, forward_dynamics,
    inverse_dynamics_trajectory, simulate,
)

dynamic_robot = Robot(
    (1.0, 0, 0, q1, "r"),
    (0.8, 0, 0, q2, "r"),
)
dynamic_robot.masses = [1.2, 0.8]
dynamic_robot.cm_positions = [(-0.5, 0, 0), (-0.4, 0, 0)]
dynamic_robot.inertia_tensors = [
    sp.diag(0, 0, 0.08),
    sp.diag(0, 0, 0.04),
]
dynamic_robot.gravity = (0, -9.81, 0)

q = [0.2, -0.1]
qd = [0.0, 0.0]
qdd = [0.5, -0.2]

forces = inverse_dynamics(dynamic_robot, q, qd, qdd)
acceleration = forward_dynamics(dynamic_robot, q, qd, forces)
effort_history = inverse_dynamics_trajectory(dynamic_robot, traj)

solution = simulate(
    dynamic_robot, (0.0, 2.0), q,
    qd0=qd, tau=forces,
)

For a more detailed treatment, see the numerical dynamics example.

Workspace Sampling

from moro.workspace import sample_workspace, section_workspace
from moro.visualization import plot_workspace, plot_workspace_section

workspace = sample_workspace(
    robot, samples=1024, method="sobol", seed=42,
    joint_limits=[(-3.14, 3.14), (-3.14, 3.14)],
    parameters={l1: 1.0, l2: 1.0},
)
viewer = plot_workspace(workspace)  # Three.js
# Matplotlib instead: fig, ax = plot_workspace(workspace, backend="matplotlib")

section = section_workspace(workspace, plane="xy", level=0.0, thickness=0.05)
section_viewer = plot_workspace_section(section, show_grid=True)

Workspace sampling operates in joint coordinates, not uniformly in Cartesian space. The result stores both workspace.configurations and their corresponding Cartesian workspace.points. Sections select points near a plane; they do not reconstruct exact workspace boundaries.

Documentation

The complete documentation is available at:

https://jorgedelossantos.github.io/moro/

It includes Getting Started guides, User Guide, worked examples, API Reference, mathematical Theory notes, and contributor documentation.

Roadmap

Want to know what may come next? See the Moro Roadmap Wiki.

Bug Reports and Contributions

If you encounter a bug, have a question, or want to request a feature, please open an issue in the GitHub Issue Tracker.

Contributions are welcome. See the contributor documentation included in the project documentation for the recommended development workflow.

Metadata

Release files for moro 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moro 0.7.1
File Size Uploaded Provenance Actions
moro-0.7.1.tar.gz 200.8 kB With provenance Details for moro-0.7.1.tar.gz

Built distribution (wheel)

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

Total release size: 320.5 kB

Release files / moro-0.7.1.tar.gz

Download URL moro-0.7.1.tar.gz
Size 200.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f7a665de5407a0ac9b2f6df16630714057aa75f8a582e23caf1a610025fe6618
BLAKE2b-256 checksum
How to use checksums
54af063314c4cbb2594684f5f4457c9466a1707c7e9ad645ebd5b07887a8e9bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Release files / moro-0.7.1-py3-none-any.whl

Download URL moro-0.7.1-py3-none-any.whl
Size 119.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5a957fe0d48e7ca6c8df64242b39bc765faaa72fa6ceb3fbcd3e9552e637a1a
BLAKE2b-256 checksum
How to use checksums
8a9037ecb7d6c3b53d43909e5e8e2f31bdfa6aa987d2732dcc19d5e4cf74791c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Security for moro 0.7.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for moro-0.7.1.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 Nov 14, 2026.

Transparency log

A 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.

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