TL;DR
Researchers from ETH Zurich have developed OCS2, a highly efficient algorithm for controlling "switched systems"—complex machines like legged robots that flip between different physical states. By replacing traditional, slow boundary-value solvers with a Sequential Linear Quadratic (SLQ) approach, they achieved up to a 20x speedup, enabling real-time optimal control for high-dimensional systems like a galloping quadruped.
What Problem Does This Paper Address?
Many real-world systems are "switched": they consist of several different continuous behaviors (modes) triggered by discrete events. Think of a car shifting gears or a quadruped robot where the dynamics change depending on which feet are touching the ground.
To control these systems optimally, you have to solve three sub-problems:
- What is the best sequence of modes? (e.g., Walk $\rightarrow$ Trot $\rightarrow$ Stand)
- When exactly should the system switch between these modes?
- What are the best continuous control inputs (like motor torques) for each mode?
The authors focus on cases where the sequence is already known (e.g., a specific gait), but the timing and the control inputs must be optimized simultaneously. Existing methods usually rely on solving "two-point boundary value problems" (BVPs), which are notoriously slow and struggle to scale as the system becomes more complex (higher dimensions).
Methods
The authors introduce the Optimal Control for Switched Systems (OCS2) algorithm. It uses a two-stage optimization strategy:
- The Inner Loop (SLQ): For a fixed set of switching times, the algorithm uses Sequential Linear Quadratic (SLQ) control to find the best continuous inputs. SLQ works by linearizing the nonlinear system and quadratizing the cost function around a nominal trajectory, then solving the resulting Riccati equations. This has a linear time complexity relative to the time horizon, making it much faster than standard discretization methods.
- The Outer Loop (Gradient Descent): The algorithm then updates the switching times. The "secret sauce" here is that the authors derived a way to calculate the gradient of the cost function with respect to switching times directly from the SLQ solution. This means they get the information needed to update the timing almost "for free" without extra heavy computation.
- Warm Starting: To speed up convergence, they use a "solution bag" to store previous successful control policies, allowing the robot to start from a good guess when switching times change.
Datasets
As a control theory paper, the evaluation is based on three numerical benchmarks rather than static datasets:
- Example 1: A 2D nonlinear switched system with three modes.
- Example 2: A 4D version of the first example to test scalability.
- Example 3 (The "Real World" Test): A 12-dimensional model of a quadruped robot's Center of Mass (CoM) during a trotting gait.
Key Insights and Ideas
- Linear Complexity is King: By choosing SLQ over BVP, the authors moved from a method that scales poorly with complexity to one that scales linearly. This is the difference between an algorithm that takes minutes to run and one that can run in near real-time.
- Sensitivity for Free: The realization that the LQ approximation already contains the necessary information to calculate switching time sensitivity is a major mathematical shortcut. It avoids the need to solve complex auxiliary differential equations.
- Emergent Behavior: In the quadruped example, the optimizer was allowed to reduce the duration of certain phases to zero. Effectively, the algorithm "decided" that a 6-step trot was more efficient than the 8-step trot it was initially given, showing that timing optimization can simplify the required motion.
Key Results
- Speed: In the 2D example, OCS2 was 7.5 times faster than the BVP baseline. In the 4D example, it was 19.5 times faster.
- Scalability: For the 12D quadruped model, the traditional BVP method failed to terminate, while OCS2 successfully optimized the gait in just 31 seconds.
- Precision: Despite the speed, OCS2 converged to the same optimal cost as the baseline methods in the simpler examples, proving that efficiency didn't come at the cost of accuracy.
Limitations and Future Work
- Fixed Sequences: The algorithm requires the order of modes to be predefined. It cannot currently decide on its own to switch from a "trot" to a "gallop" if that sequence wasn't provided.
- Unconstrained Systems: The current formulation handles unconstrained nonlinear systems. Adding hard constraints (like staying within motor torque limits or avoiding obstacles) while maintaining this level of speed is a logical next step.
- Real-Time Hardware: While the results are promising for real-time use, the paper demonstrates the algorithm in simulation. Future work would involve deploying this directly onto a physical robot's onboard controller.
Summary updated