Skip to main content

moro

PyPI version License

moro is a Python library for symbolic modeling, analysis, 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) rotation matrices, SE(3) homogeneous transformations, Euler angles, and axis-angle representations.
  • Forward kinematics: Compute symbolic end-effector and intermediate-frame transformations.
  • Differential kinematics: Compute geometric Jacobians for the end-effector and other points.
  • Inverse kinematics: Solve numerical Cartesian position IK using Levenberg-Marquardt, Newton-Raphson, or CCD.
  • IK trajectories: Solve ordered sequences of Cartesian position targets using warm-started inverse kinematics.
  • Dynamics: Derive symbolic equations of motion and the standard M(q) qdd + C(q, qd) qd + G(q) = tau model.
  • Visualization: Plot and animate robot configurations using Matplotlib or an interactive Three.js backend.

Installation

Install the latest stable release from PyPI:

pip install moro

To install the current development version from the develop branch:

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

moro requires Python 3.9 or newer.

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 also be visualized:

from moro.visualization import RobotVisualizer

viz = RobotVisualizer(robot)
viz.plot(values)

For interactive visualization in a notebook:

viz.plot(values, backend="threejs")

Inverse Kinematics

A Cartesian position target can be solved numerically with:

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,
    },
)

if solution.converged:
    print(solution.q)
else:
    print(solution.message)

Current inverse-kinematics support is focused on Cartesian position. Full-pose IK with orientation constraints is not yet included.

Dynamics

Dynamic models can be built by assigning masses, centers of mass, inertia tensors, and gravity to an existing Robot model.

For example:

import sympy as sp

from moro.abc import m1, m2, lc1, lc2, g

I1, I2 = sp.symbols("I1 I2", positive=True)

robot.masses = [m1, m2]
robot.cm_positions = [
    (-lc1, 0, 0),
    (-lc2, 0, 0),
]
robot.inertia_tensors = [
    sp.diag(0, 0, I1),
    sp.diag(0, 0, I2),
]
robot.gravity = (0, -g, 0)

M = robot.inertia_matrix()
C = robot.coriolis_matrix()
G = robot.gravity_vector()

model = robot.dynamic_model_matrix_form()

The current dynamics API derives symbolic equations of motion and supports inverse-dynamics-style evaluation. Forward dynamics integration is not currently included.

Documentation

The complete documentation is available at:

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

It includes:

  • Getting Started guides;
  • a practical User Guide;
  • complete worked examples;
  • API Reference;
  • mathematical Theory notes;
  • contributor documentation and naming conventions.

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.

Download files

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

Source Distribution

moro-0.4.0.tar.gz (77.8 kB view details)

Uploaded Source

Built Distribution

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

moro-0.4.0-py3-none-any.whl (62.1 kB view details)

Uploaded Python 3

File details

Details for the file moro-0.4.0.tar.gz.

File metadata

  • Download URL: moro-0.4.0.tar.gz
  • Upload date:
  • Size: 77.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.7

File hashes

Hashes for moro-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7797ced2d2266d8178ea12cf805cb3eff6b890e871c2eaa450a0b2882431cfe8
MD5 fbe072904b36d1b0a71448f9ef92c437
BLAKE2b-256 fd7a11c52483447bf352cdd64444e3f2c453d601b36985a9aff5b0697e0dd0f6

See more details on using hashes here.

File details

Details for the file moro-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: moro-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 62.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.7

File hashes

Hashes for moro-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bbff170ae3b2bbb747922d7eda80f92bf67666689898844f7917146926223c8
MD5 e669315237115e761b8533bbb7031df9
BLAKE2b-256 9dc454c0d285d867dc6358b726e92efa5cb744c03f6e80cc62b85e2d4171016e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 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