Get Mass Matrix
SUMMARY
Get Mass Matrix returns the 6×6 joint-space mass matrix (also called the inertia matrix) of the robot at the current configuration. The matrix is returned as a 36-element flat list in row-major order.
The mass matrix is the core ingredient in model-based control laws such as computed-torque control and impedance control.
SUPPORTED ROBOTS
This skill is currently supported on Universal Robots only. Calling this method on other robot brands will raise a NotImplementedError.
The Skill
matrix = robot.get_mass_matrix()The Code
Example: Read the Joint-Space Mass Matrix
Connect to the robot, read the current mass matrix, and log it.
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots
robot_ip = "192.168.1.2" # replace with your robot's IP
robot = universal_robots.UniversalRobotsUR10E()
# Connect
robot.connect(ip=robot_ip)
matrix = robot.get_mass_matrix()
logger.info(f"Mass matrix (6x6 flat): {matrix}")
# Disconnect
robot.disconnect()The Explanation of the Code
get_mass_matrix queries the robot controller for the joint-space inertia matrix M(q) at the current joint configuration. The result is a 36-element flat list representing the 6×6 symmetric positive-definite matrix in row-major order (element [i*6 + j] corresponds to row i, column j). The optional q parameter allows evaluation at a specific joint configuration rather than the current one. Setting include_rotors_inertia=True adds motor rotor inertia contributions to the diagonal entries.
How to Tune the Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
q | list[float] | [] | 6-element joint configuration [q1…q6] [deg]. Empty list uses the current robot configuration. |
include_rotors_inertia | bool | False | If True, includes motor rotor inertia in the diagonal entries. |
Return Value
| Type | Description |
|---|---|
list[float] | 36-element flat list representing the 6×6 joint-space mass matrix [kg·m²], in row-major order. |
Where to Use the Skill
- Model-based control — Feed M(q) into computed-torque or model predictive controllers
- Dynamic simulation — Use the mass matrix for physics-accurate joint-space simulations
- Impedance control — Required for joint-space impedance laws
When Not to Use the Skill
Do not use Get Mass Matrix when:
- Only Coriolis and centrifugal effects are needed — use Get Coriolis and Centrifugal Torques instead
- Only the Jacobian is needed — use Get Jacobian instead

