Bayesian Optimization with Safety Constraints: Safe and Automatic Parameter Tuning in Robotics

Felix Berkenkamp, Andreas Krause, Angela P. Schoellig

Automated robot tuning has traditionally focused on "performance-at-all-costs," often neglecting the physical risks inherent in exploring unknown parameter spaces. This paper introduces a framework that prioritizes safety throughout the learning process, enabling robots to optimize themselves without risking catastrophic failure.

The Challenge of Safety-Blind Optimization

In robotics, "tuning" involves finding the optimal parameters—such as controller gains or time constants—to achieve desired behavior. While Bayesian Optimization (BO) is a popular tool for automating this process, standard BO algorithms are typically "safety-blind." They may suggest parameter configurations that lead to instability, collisions, or structural damage simply to gather information about potential performance improvements.

While previous iterations like SafeOpt ensured that performance did not drop below a baseline, they failed to account for the fact that performance and safety are often decoupled in real-world systems. For instance, a high-gain controller might provide excellent tracking (high performance) but cause motor vibrations that exceed physical safety limits. There is a critical need for an optimization framework that can handle multiple, independent safety constraints.

The SafeOpt-MC Framework

The authors propose SafeOpt-MC (Multiple Constraints), a generalized Bayesian optimization algorithm designed to satisfy multiple independent safety requirements while searching for the optimal configuration.

The closed-loop interaction between the SafeOpt-MC algorithm and the physical system evaluation.

The core of SafeOpt-MC relies on several integrated components:

  • Gaussian Processes (GPs): The algorithm builds probabilistic models for both the unknown performance function $f(a)$ and each safety constraint $g_i(a)$. GPs provide a mean estimate and a measure of uncertainty (confidence intervals), which are crucial for assessing risk.
  • The Safe Set ($S_n$): Starting from a known safe point, the algorithm identifies a region in the parameter space where it is statistically confident that all safety constraints are met.
  • Expanders and Maximizers: SafeOpt-MC selects the next parameter set by identifying points within the safe set that are either likely to be the global optimum (Maximizers) or likely to reduce uncertainty at the boundaries of the safe set (Expanders), allowing the safe zone to grow.
  • Contextual Optimization: By incorporating "context" variables (e.g., a robot's target speed), the algorithm can transfer knowledge across tasks. This allows a robot to learn safely at low speeds and predict safe parameters for higher, more challenging speeds.

Experimental Validation: Quadrotor Tuning

The researchers evaluated SafeOpt-MC using a Parrot AR.Drone 2.0 quadrotor. Unlike static datasets, the data was generated in real-time through noisy trajectories and recorded safety violations in a motion-capture lab.

Linear and Nonlinear Control

In linear PD controller tuning, the algorithm successfully found optimal gains within 30 iterations without violating safety thresholds. More importantly, in a nonlinear control task, the researchers compared SafeOpt-MC against a performance-only optimizer. The performance-only approach eventually selected parameters that caused a serious crash. In contrast, SafeOpt-MC identified the "crash zone" as unsafe and successfully found the best parameters within the safe region.

Safe Speed Scaling

Using contextual BO, the quadrotor safely increased its circular flight speed from 1.0 m/s to 1.8 m/s. The algorithm correctly predicted that the safe parameter region shrinks as speed increases due to actuator saturation, adjusting its exploration accordingly to maintain stability.

Key Insights and Limitations

A primary insight of this work is the necessity of decoupling safety from performance. By treating safety constraints as independent functions, robots can respect physical limits like battery voltage or structural integrity while still pursuing high performance. However, the paper notes the "Safe Reachable" limitation: the robot can only find the optimum within the part of the parameter space that is safely reachable from its starting point.

Future Directions

SafeOpt-MC currently faces the "curse of dimensionality," making it most effective for problems with fewer than 10 parameters. Future work will explore high-dimensional Bayesian optimization and non-stationary kernels to handle more complex and unpredictable robotic environments. Additionally, the safety guarantees depend on the accuracy of the user's prior assumptions (e.g., the Lipschitz constant); if these assumptions are incorrect, the safety guarantees may not hold.

Summary updated

BibTeX
@article{berkenkamp2023bayesian,
  author = {Felix Berkenkamp and Andreas Krause and Angela P. Schoellig},
  title = {{Bayesian Optimization with Safety Constraints: Safe and Automatic Parameter Tuning in Robotics}},
  journal = {Machine Learning},
  year = {2023},
  doi = {10.1007/s10994-021-06019-1},
}
Figure