Abstract
PYROBOCOP is a lightweight Python-based package for control and optimization of robotic systems described by nonlinear Differential Algebraic Equations (DAEs). In particular, the package can handle systems with contacts that are described by complementarity constraints and provides a general framework for specifying obstacle avoidance constraints. The package performs direct transcription of the DAEs into a set of nonlinear equations by performing orthogonal collocation on finite elements. The resulting optimization problem belongs to the class of Mathematical Programs with Complementarity Constraints (MPCCs). MPCCs fail to satisfy commonly assumed constraint qualifications and require special handling of the complementarity constraints in order for NonLinear Program (NLP) solvers to solve them effectively. PYROBOCOP provides automatic reformulation of the complementarity constraints that enables NLP solvers to perform optimization of robotic systems. The package is interfaced with ADOLC for obtaining sparse derivatives by automatic differentiation and IPOPT for performing optimization. We demonstrate the effectiveness of our approach in terms of speed and flexibility through several numerical examples, including comparisons with other open-source optimization packages like CasADi and Pyomo.
Introduction
Most robotic tasks—such as picking up tools or pushing objects—are "contact-rich." Mathematically, these interactions involve complementarity constraints: if a robot's finger isn't touching an object, the force is zero; if it is touching, the distance is zero. This "either-or" logic creates mathematical discontinuities that typically break standard gradient-based optimization solvers. Furthermore, calculating smooth distances for collision avoidance between complex 3D shapes often results in non-differentiable "jumps" in the math. PYROBOCOP addresses these challenges by bridging the gap between high-level Python scripting and high-performance C++ optimization, providing a unified framework for handling both physical contact and collision avoidance.
Methodology
PYROBOCOP employs direct transcription to convert continuous robot motion into a discrete set of nonlinear equations using orthogonal collocation on finite elements. The core of the package is its ability to automatically transform Mathematical Programs with Complementarity Constraints (MPCCs) into a "relaxed" form that standard solvers like IPOPT can handle robustly.
A standout feature is the package's approach to differentiable collision avoidance. Instead of simple distance checks, obstacles are modeled as polytopes. The system uses the first-order stationary conditions of the distance problem to create a differentiable formulation. This allows the solver to "see" the gradient of the obstacle and steer the robot away smoothly.
Results and Evaluation
The package was evaluated using several simulated robotic benchmarks, including planar pushing, car parking, and a complex belt drive unit assembly task. In head-to-head tests against industry standards like CasADi and Pyomo, PYROBOCOP achieved comparable solution times and costs.
Key advantages noted include:
- Ease of Use: Users can specify complex contact and obstacle constraints with minimal code, as the package handles difficult mathematical reformulations internally.
- Robustness: The system successfully solved the "Belt Drive" assembly task, which involves hybrid dynamics and deformable objects—scenarios where many other solvers fail to converge.
- Flexibility: It can optimize trajectories even when robot dynamics are learned from data (e.g., Gaussian Processes), provided derivatives are available.
Conclusion and Future Work
PYROBOCOP provides a powerful tool for optimizing contact-rich robotic tasks. While it currently finds local optima and benefits from a "warm start" in complex scenarios, it offers a unique, unified mathematical framework for interaction. Future work will focus on improving infeasibility detection and extending the framework to support real-time Model Predictive Control (MPC) through integration with physics engines like MuJoCo.
Summary updated