Capacity metrics

This package implements polytope and ellipsoid based physical ability metrics for robotic manipulators and human musculoskeletal models.

All the metrics at a glance

Metric

Robot (pycapacity.robot)

Human (pycapacity.human)

Algorithm

Velocity ellipsoid

robot.velocity_ellipsoid

human.velocity_ellipsoid

SVD

Acceleration ellipsoid

robot.acceleration_ellipsoid

human.acceleration_ellipsoid

SVD

Force ellipsoid

robot.force_ellipsoid

human.force_ellipsoid

SVD

Velocity polytope

robot.velocity_polytope

human.velocity_polytope

HPSM (robot), ICHM (human)

Acceleration polytope

robot.acceleration_polytope

human.acceleration_polytope

HPSM (or ICHM for the human)

Force polytope

robot.force_polytope

human.force_polytope

VEPOLI2 (robot), ICHM (human)

Force polytope sum

robot.force_polytope_sum

VEPOLI2 + convex hull

Force polytope intersection

robot.force_polytope_intersection

VEPOLI2

Reachable space (convex approximation)

robot.reachable_space_approximation

ICHM

Reachable space (non-convex)

robot.reachable_space_nonlinear (robot.reachable_space_cube_sampling, robot.reachable_space_ray_steering)

sampling + convex hull or alpha shape

Joint torque polytope

human.joint_torques_polytope

HPSM

Muscle forces for given joint torques

human.torque_to_muscle_force

LP or QP

Every polytope function returns a Polytope (see Working with polytopes) and every ellipsoid function an Ellipsoid. The algorithms are described in Polytope evaluation algorithms. The formulas of each metric are given below.

Robotic manipulator capacity metrics

Capacity metrics of a robotic manipulator

For the robotic manipulators the package integrates several velocity, force and acceleration capacity calculation functions based on ellipsoids:

  • Velocity (manipulability) ellipsoid

    \[E_{v} = \{\dot{x} ~| \dot{x} = J\dot{q},~ ||W^{-1}\dot{q}||\leq1 \}, \qquad W = diag(\dot{q}_{max})\]
  • Acceleration (dynamic manipulability) ellipsoid

    \[E_{a} = \{\ddot{x} ~| \ddot{x} = JM^{-1}\tau,~ ||W^{-1}\tau||\leq1 \}, \qquad W = diag(\tau_{max})\]
  • Force ellipsoid

    \[E_{f} = \{{f} ~| J^{T}f = \tau,~ ||W^{-1}\tau||\leq1 \}, \qquad W = diag(\tau_{max})\]

And polytopes:

  • Velocity polytope

    \[P_{v} = \{\dot{x} ~| \dot{x} = J\dot{q},~ \dot{q}_{min}\leq\dot{q}\leq\dot{q}_{max} \}\]
  • Acceleration polytope

    \[P_{a} = \{\ddot{x} ~| \ddot{x} = JM^{-1}\tau,~ \tau_{min}\leq\tau\leq\tau_{max} \}\]
  • Force polytope

    \[P_{f} = \{f ~| J^{T}f = \tau,~ \tau_{min}\leq\tau\leq\tau_{max} \}\]
  • Force polytopes Minkowski sum and intersection

    \[P_{\cap} = \mathcal{P}_{f1} \cap \mathcal{P}_{f1} \qquad P_{\oplus} = \mathcal{P}_{f1} \oplus \mathcal{P}_{f1}\]

Where \(J\) is the robot jacobian matrix, \(f\) is the vector of cartesian forces, \(\dot{x}\) and \(\ddot{x}\) are vectors of cartesian velocities and accelerations, \(\dot{q}\) is the vector of the joint velocities and \(\tau\) is the vector of joint torques.

  • Reachable space approximation of in the desired horizon of interest \(\Delta t_{h}\) using the convex polytope formulation:

    \[P_x = \{\Delta x~ |~ \Delta{x} = JM^{-1}\tau \Delta t_{h}^2/2,\]
    \[{\tau}_{min} \leq \tau \leq {\tau}_{max},\]
    \[\dot{q}_{min} \leq M^{-1}\tau \Delta t_{h} \leq \dot{q}_{max},\]
    \[{q}_{min} \leq M^{-1}\tau \Delta t_{h}^2/2 \leq {q}_{max} \}\]
    Based on the paper:
    by Skuric, Antun, Vincent Padois, and David Daney.
    In: Human-Friendly Robotics 2022: HFR: 15th International Workshop on Human-Friendly Robotics. Cham: Springer International Publishing, 2023.

    See the full formulaiton in the api docs.

  • Reachable space non-linear approximation in the desired horizon of interest \(\Delta t_{h}\):

    \[C_x = \{ x~ |~ x = f_{fk}(q_0 + \dot{q}\Delta t),\]
    \[\dot{q}_{min} \leq \dot{q} \leq \dot{q}_{max},\quad {q}_{min} \leq q_0 + \dot{q}\Delta t \leq {q}_{max} \}\]
    See an example of how its used in the tutorials.

Human musculoskeletal models capacity metrics

Capacity metrics of a human musculoskeletal model

For the robotic manipulators the package integrates velocity, force and acceleration capacity calculation functions based on ellipsoids:

  • Velocity (manipulability) ellipsoid

    \[E_v = \{\dot{x}~ |~ J\dot{q} = \dot{x},~ L\dot{q} = \dot{l} \quad ||W^{-1}\dot{l}|| \leq 1\}, \qquad W = diag(\dot{l}_{max})\]
  • Acceleration (dynamic manipulability) ellipsoid

    \[E_{a} = \{\ddot{x}~ |~ \ddot{x} = JM^{-1}NF, \quad ||W^{-1}F|| \leq 1\}, \qquad W = diag(F_{max})\]
  • Force ellipsoid

    \[E_{f} = \{f~ |~ NF = J^Tf,\quad ||W^{-1}F|| \leq 1\}, \qquad W = diag(F_{max})\]

And polytopes:

  • Velocity polytope

    \[P_{v} = \{\dot{x} ~| \dot{l} = L\dot{q},~ \dot{x} = J\dot{q},~ \dot{l}_{min}\leq\dot{l}\leq\dot{l}_{max} \}\]
  • Acceleration polytope

    \[P_{a} = \{\ddot{x} ~| \ddot{x} = JM^{-1}NF,~ F_{min}\leq F\leq F_{max} \}\]
  • Force polytope

    \[P_{f} = \{f ~| J^Tf = NF,~ F_{min}\leq F\leq F_{max} \}\]

Where \(J\) is the model’s jacobian matrix, \(L\) is the muscle length jacobian matrix, \(N= -L^T\) is the moment arm matrix, \(f\) is the vector of cartesian forces, \(\dot{x}\) and \(\ddot{x}\) are vectors of cartesian velocities and accelerations, \(\dot{q}\) is the vector of the joint velocities, \(\tau\) is the vector of joint torques, \(\dot{l}\) is the vector of the muscle stretching velocities and \(F\) is the vector of muscular forces.

Algorithms and performance

The algorithms used for each metric, with their execution times, are described in Polytope evaluation algorithms; the optional C++ implementation, which makes them 6 to 50 times faster, in C++ acceleration.

Compatible libraries

The package is compatible with the following libraries:

Library

Example

OpenSim

Tutorial

pyomeca biorbd

Tutorial

pinocchio

Tutorial

Robotics toolbox

Tutorial

Robot Operating System (ROS)

Tutorial

MuJoCo

Tutorial