OpTaS: An Optimization-based Task Specification Library for Trajectory Optimization and Model Predictive Control

Christopher E. Mower, João Moura, Nazanin Zamani Behabadi, Sethu Vijayakumar, Tom Vercauteren, Christos Bergeles

Abstract

This paper presents OpTaS, a task specification Python library for Trajectory Optimization (TO) and Model Predictive Control (MPC) in robotics. Both TO and MPC are increasingly receiving interest in optimal control and in particular handling dynamic environments. While a flurry of software libraries exists to handle such problems, they either provide interfaces that are limited to a specific problem formulation (e.g. TracIK, CHOMP), or are large and statically specify the problem in configuration files (e.g. EXOTica, eTaSL). OpTaS, on the other hand, allows a user to specify custom nonlinear constrained problem formulations in a single Python script allowing the controller parameters to be modified during execution. The library provides interface to several open source and commercial solvers (e.g. IPOPT, SNOPT, KNITRO, SciPy) to facilitate integration with established workflows in robotics. Further benefits of OpTaS are highlighted through a thorough comparison with common libraries. An additional key advantage of OpTaS is the ability to define optimal control tasks in the joint space, task space, or indeed simultaneously. The code for OpTaS is easily installed via pip, and the source code with examples can be found at https://github.com/cmower/optas.

Introduction

In modern robotics, tasks such as surgical assistance or collaborative assembly require robots to navigate unstructured and dynamic environments. To operate effectively, motion planners must balance multiple competing objectives: avoiding obstacles, adhering to joint limits, and coordinating multiple manipulators, all while ensuring smooth and efficient trajectories.

Existing software tools for these tasks generally fall into two categories. Specialized solvers, such as TracIK, offer high speed but are restricted to specific problem formulations like Inverse Kinematics (IK), lacking the flexibility for custom nonlinear constraints. Conversely, heavyweight frameworks like EXOTica or eTaSL provide significant power but often rely on static configuration files (XML/YAML) and require complex analytical gradients. This overhead complicates rapid prototyping and slows execution in dynamic settings. OpTaS bridges this gap by providing a scriptable, flexible, and mathematically robust "middle ground" for robotic optimization.

Methodology

OpTaS is built upon three primary technical pillars designed to streamline the development of TO and MPC applications:

1. CasADi Integration and Automatic Differentiation

OpTaS leverages CasADi, a symbolic framework that provides Automatic Differentiation (AD). This allows users to define tasks—such as obstacle avoidance or target tracking—symbolically. OpTaS then automatically generates the exact Jacobians and Hessians required by solvers. This approach is significantly more accurate and computationally efficient than the finite difference approximations used by older libraries.

2. Optimization Builder

The library features a high-level Python API that enables users to define decision variables, parameters, and cost functions within a single script. A critical feature is its support for parameterization, which allows users to update environment variables (e.g., obstacle positions or goal targets) during execution. This capability is essential for real-time MPC applications where the robot must respond to feedback loops.

3. Robot Modeling

OpTaS can ingest standard URDF files to automatically generate kinematic models, including Forward Kinematics and Jacobians to any derivative order. It natively supports multi-robot configurations within a single optimization problem, simplifying the control of complex robotic cells.

Key Insights

Dimensionality Flexibility

Traditional solvers often require users to define a full 6D pose (position and orientation) for every task. OpTaS allows for "dimension neglect," where users optimize only the relevant dimensions (e.g., 2D pushing). Research indicates that by focusing only on necessary dimensions, robots can achieve a larger effective workspace and more efficient solutions.

The AD Advantage

The integration of Automatic Differentiation provides a significant performance boost over frameworks that rely on numerical estimation. When implementing complex costs, such as robot manipulability, OpTaS maintains high execution speeds because it does not need to approximate gradients through slow, iterative sampling.

Experimental Results

The library was evaluated using a simulated Kuka LWR robot and benchmarked against TracIK and EXOTica.

  • Computational Efficiency: In a figure-eight tracking experiment, OpTaS achieved a solver duration of 2.608 ± 0.239ms, outperforming EXOTica’s 3.694 ± 0.300ms.
  • Complex Cost Handling: When maximizing robot manipulability—a task requiring complex gradient calculations—OpTaS was nearly 3x faster than EXOTica (2.65ms vs 7.64ms). This disparity highlights the efficiency of OpTaS’s gradient handling.
  • Generality vs. Specialization: While the specialized solver TracIK was faster (0.049ms), it is limited to specific IK problems. OpTaS provides a general-purpose alternative that can solve nearly any constrained nonlinear problem with competitive performance.

Conclusion and Future Work

OpTaS provides a powerful, user-friendly interface for roboticists to implement complex optimization tasks. While it is subject to the standard limitations of gradient-based optimization—such as potential convergence to local optima in highly non-convex spaces—its flexibility and speed make it a valuable tool for the research community.

Future development aims to expand the library's built-in constraint library and deepen integration with robotics middleware beyond ROS and PyBullet. The project remains open-source and community-driven to support the evolving needs of the robotics field.

Summary updated

Abstract

This paper presents OpTaS, a task specification Python library for Trajectory Optimization (TO) and Model Predictive Control (MPC) in robotics. Both TO and MPC are increasingly receiving interest in optimal control and in particular handling dynamic environments. While a flurry of software libraries exists to handle such problems, they either provide interfaces that are limited to a specific problem formulation (e.g. TracIK, CHOMP), or are large and statically specify the problem in configuration files (e.g. EXOTica, eTaSL). OpTaS, on the other hand, allows a user to specify custom nonlinear constrained problem formulations in a single Python script allowing the controller parameters to be modified during execution. The library provides interface to several open source and commercial solvers (e.g. IPOPT, SNOPT, KNITRO, SciPy) to facilitate integration with established workflows in robotics. Further benefits of OpTaS are highlighted through a thorough comparison with common libraries. An additional key advantage of OpTaS is the ability to define optimal control tasks in the joint space, task space, or indeed simultaneously. The code for OpTaS is easily installed via pip, and the source code with examples can be found at https://github.com/cmower/optas.
BibTeX
@inproceedings{mower2023optas,
  author = {Christopher E. Mower and João Moura and Nazanin Zamani Behabadi and Sethu Vijayakumar and Tom Vercauteren and Christos Bergeles},
  title = {{OpTaS: An Optimization-based Task Specification Library for Trajectory Optimization and Model Predictive Control}},
  booktitle = {IEEE International Conference on Robotics and Automation},
  year = {2023},
  url = {https://openreview.net/forum?id=nJg0zixReJ},
}
Figure