Core
The moro.core module provides the main Robot class used to
represent and analyze serial robot manipulators.
Numython R&D, (c) 2026 Moro is a Python library for kinematic and dynamic modeling of serial robots. This library has been designed, mainly, for academic and research purposes, using SymPy as base library.
- class moro.core.Robot(*args)[source]
Bases:
objectDefine a robot-serial-arm given the Denavit-Hartenberg parameters and the joint type, as tuples (or lists). Each tuple must have the form:
(a_i, alpha_i, d_i, theta_i)
Or including the joint type:
(a_i, alpha_i, d_i, theta_i, joint_type)
All parameters are int or floats, or a symbolic variable of SymPy. Numeric angles must be passed in radians. If joint_type is not passed, the joint is assumed to be revolute.
Examples
>>> rr = Robot((l1,0,0,q1), (l2,0,0,q2))
or
>>> rr2 = Robot((l1,0,0,q1,"r"), (l2,0,0,q2,"r"))
- I_cm(i)[source]
Return the inertia tensor of i-th link w.r.t. {i}’ frame (located in the center of mass of link [i] and aligned with the {i}-Frame).
- Parameters:
- i: int
Link number.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Inertia tensor of the [i]-link w.r.t. {i}’-Frame.
- I_cm0(i)[source]
Return the inertia tensor of [i-th] link w.r.t. a frame located in the center of mass of link [i] and aligned with the base frame.
- Parameters:
- i: int
Link number.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Inertia tensor of the [i]-link w.r.t. {0}-Frame.
- property J
Get the geometric jacobian matrix of the end-effector.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Get the geometric jacobian matrix of the end-effector.
- J_cm_i(i)[source]
Compute the jacobian matrix of the center of mass of the i-th link.
- Parameters:
- iint
Link number.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Jacobian matrix of i-th CoM.
- J_point(point, i)[source]
Compute the jacobian matrix of a specific point in the manipulator.
- Parameters:
- pointlist
Coordinates of the point w.r.t. {i}-Frame.
- iint
Link number in which the point is located.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Jacobian matrix of the point.
- Jv_cm_i(i)[source]
Return the linear velocity Jacobian matrix of the center of mass of the i-th link.
- Parameters:
- iint
Link number.
- Jw_cm_i(i)[source]
Return the angular velocity Jacobian matrix of the center of mass of the i-th link.
- Parameters:
- iint
Link number.
- R_i0(i)[source]
Get the rotation matrix of {i}-Frame w.r.t. {0}-Frame.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Returns \(R_i^0\)
- property T
Get the homogeneous transformation matrix of {n}-Frame (end-effector) w.r.t. {0}-Frame.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
\(T_n^0\)
- T_i0(i)[source]
Get the homogeneous transformation matrix of {i}-Frame w.r.t. {0}-Frame.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Returns \(T_i^0\)
- T_ij(i, j)[source]
Get the homogeneous transformation matrix of {i}-Frame w.r.t. {j}-Frame.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Returns \(T_i^j\)
- property Ts
- christoffel_symbols(i, j, k, M)[source]
Return the Christoffel symbol of the first kind:
\[c_{{i,j,k}} = \frac{1}{2} \left( \frac{{\partial M_{{i,j}}}}{{\partial q_k}} + \frac{{\partial M_{{i,k}}}}{{\partial q_j}} - \frac{{\partial M_{{j,k}}}}{{\partial q_i}} \right)\]
- property cm_positions
Get the positions of the center of mass for each link. The position of the center of mass of the i-th link is defined as a list or tuple of three elements that correspond to the x, y, z coordinates of the center of mass w.r.t. {i}-Frame.
- Returns:
- list
A list of lists (or tuples) or a tuple of tuples (or lists) containing each center of mass position w.r.t. its reference frame.
- coriolis_matrix()[source]
Return the Coriolis matrix C(q,q’). The Coriolis matrix is computed using the Christoffel symbols of the first kind:
\[C_{{i,j}} = \sum_{{k=1}}^n c_{{i,j,k}} \dot{{q}}_k\]
- property dh_parameters
- property dh_table
Return the DH parameter table as a SymPy TableForm.
- property dof
Get the degrees of freedom of the robot.
- Returns:
- int
Degrees of freedom of the robot
- dynamic_model()[source]
Returns the dynamic model of the robot using the Euler-Lagrange formulation. The returned value is a list of equations, one for each joint, of the form:
\[\frac{d}{dt} \left( \frac{\partial L}{\partial \dot{{q}}_i} \right) - \frac{\partial L}{\partial q_i} = \tau_i\]where \(\mathcal{L}\) is the Lagrangian of the system, defined as \(\mathcal{L} = \mathcal{K} - \mathcal{P}\), where \(\mathcal{K}\) is the kinetic energy and \(\mathcal{P}\) is the potential energy.
- dynamic_model_matrix_form()[source]
Return the dynamic model of the robot in matrix form:
\[M(q) \ddot{{q}} + C(q,\dot{{q}}) \dot{{q}} + G(q) = \tau\]where \(M(q)\) is the inertia matrix, \(C(q,q')\) is the Coriolis matrix, \(G(q)\) is the gravity torque vector, and \(\tau\) is the vector of joint torques.
- property gravity
Get the gravity acceleration defined in the base frame.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Gravity vector defined in the base frame.
- gravity_vector()[source]
Compute the gravity torque vector G(q). The gravity torque vector is computed as the gradient of the potential energy of the system:
\[G(q) = \nabla U(q) = \left[ \frac{{\partial U}}{{\partial q_1}}, \frac{{\partial U}}{{\partial q_2}}, ..., \frac{{\partial U}}{{\partial q_n}} \right]^T\]- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Gravity torque vector G(q)
- inertia_matrix()[source]
Return the inertia matrix M(q) of the robot. The inertia matrix is computed as:
\[M(q) = \sum_{{i=1}}^n m_i J_{v_i}^T J_{v_i} + J_{w_i}^T R_i I_i R_i^T J_{w_i}\]where \(m_i\) is the mass of the i-th link, \(J_{v_i}\) is the linear velocity Jacobian matrix of the center of mass of the i-th link, \(J_{w_i}\) is the angular velocity Jacobian matrix of the center of mass of the i-th link, \(R_i\) is the rotation matrix of the i-th link w.r.t. the base frame, and \(I_i\) is the inertia tensor of the i-th link w.r.t. a frame located in its center of mass and aligned with the {i}-Frame.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Inertia matrix M(q)
- property inertia_tensors
Get the inertia tensors of the links as a list like: [I1, I2, …, In], where I1, I2, …, In, are 3x3 sympy matrices that correspond to the inertia tensor of each link w.r.t. a frame located in its center of mass and aligned with the {i}-Frame.
- Returns:
- list
A list of 3x3 sympy matrices that correspond to the inertia tensor of each link w.r.t. a frame located in its center of mass and aligned with the {i}-Frame.
- property joint_limits
Get the joint limits of the robot. The joint limits are returned as a list of tuples, where each tuple contains the lower and upper limits for the corresponding joint. For revolute joints, the default limits are (-pi, pi) radians, and for prismatic joints, the default limits are (0, 1000) units. If you want to set custom joint limits, you can use the joint_limits setter.
- joint_type(i)[source]
Return the type of the i-th joint. “r” for revolute, “p” for prismatic.
- Parameters:
- iint
Joint number.
- property joint_types
- lagrangian()[source]
Returns the Lagrangian of the system, defined as \(\mathcal{L} = \mathcal{K} - \mathcal{P}\), where \(\mathcal{K}\) is the kinetic energy and \(\mathcal{P}\) is the potential energy.
- link_kinetic_energy(i)[source]
Returns the kinetic energy of i-th link.
\[K_i = \frac{1}{2} m_i \mathbf{v}_{G_i}^T \mathbf{v}_{G_i} + \frac{1}{2} \boldsymbol{\omega}_i^T I_i \boldsymbol{\omega}_i\]- Parameters:
- i: int
Link number.
- link_potential_energy(i)[source]
Returns the potential energy of the [i-th] link.
\[P_i = - m_i \mathbf{g}^T \mathbf{r}_{G_i} \]- Parameters:
- i: int
Link number.
- Returns:
- property masses
Get the masses of the links as a list like: [m1, m2, …, mn], where m1, m2, …, mn, are numeric or symbolic values.
- Returns:
- list
A list of numerical or symbolic values that correspond to link masses.
- model_summary()[source]
Return a readable summary of the robot’s modeling state.
For each dynamic quantity it reports whether it is explicitly defined, assumed by default (auto-generated symbolic placeholder), or not set. Assumed values correspond to documented modeling assumptions (e.g. diagonal inertia tensors implying zero products of inertia) that should be overridden when they do not hold.
- Returns:
- str
A multi-line summary.
- potential_energy()[source]
Returns the total potential energy of the robot:
\[P(q) = \sum_{{i=1}}^n P_i = - \sum_{{i=1}}^n m_i \mathbf{g}^T \mathbf{r}_{G_i}\]
- q_dot(i)[source]
Return the time derivative of the i-th joint variable.
- Parameters:
- iint
Joint number.
- property qis_range
- property qs
- r_cm(i)[source]
Return the position of the center of mass of the i-th link w.r.t. the base frame.
- Parameters:
- i: int
Link number
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
A column vector
- r_o(i)[source]
Get the position (of the origin of coordinates) of the {i}-Frame w.r.t. {0}-Frame
- Parameters:
- i: int
{i}-th Frame
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
The position of {i}-Frame as a 3-component vector.
- v_cm(i)[source]
Return the velocity of the center of mass of the i-th link w.r.t. the base frame.
- Parameters:
- i: int
Link number
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
A column vector
- w(i)[source]
Compute the angular velocity of the [i]-link w.r.t. base {0}-Frame. The angular velocity of the [i]-link w.r.t. base {0}-Frame can be computed as the sum of the relative angular velocities of each link w.r.t. its previous link, described in the base frame:
\[\boldsymbol{\omega}_i = \sum_{{k=1}}^i \boldsymbol{\omega}_{{k-1,k}}\]- Parameters:
- i: int
Link number.
- Returns:
- sympy.matrices.dense.MutableDenseMatrix
Angular velocity of the [i]-link w.r.t. {0}-Frame.
- w_rel0(i)[source]
Return the angular velocity of the [i]-link w.r.t. [i-1]-link, described in {0}-Frame.
Since we are using Denavit-Hartenberg frames, then:
\[\omega_{{i-i,i}} = \dot{{q}}_i \mathbf{z}_{i-1}\]If the i-th joint is revolute, or:
\[\omega_{{i-i,i}} = \mathbf{0}\]If the i-th joint is a prismatic.
- Parameters:
- iint
Link number.