iLQR#

namespace saltro
namespace optimizer

Enums

enum class ILQRStatus#

Values:

enumerator Converged#
enumerator MaxIterations#
enumerator RegularizationExceeded#

Functions

bool iLQR(const PlannerSettings &settings, const Satellite &satellite, Eigen::Ref<Eigen::MatrixXd> X, Eigen::Ref<Eigen::MatrixXd> U, const Eigen::Ref<const Eigen::MatrixXd> &R, const Eigen::Ref<const Eigen::MatrixXd> &V, const Eigen::Ref<const Eigen::MatrixXd> &B, const Eigen::Ref<const Eigen::MatrixXd> &S, const Eigen::Ref<const Eigen::MatrixXd> &rho, const Eigen::Ref<const Eigen::VectorXd> &jtime, const Eigen::Ref<const Eigen::MatrixXd> &boresight, const Eigen::Ref<const Eigen::MatrixXd> &attitude_target, int pass_idx, const std::vector<Eigen::VectorXd> &lambda_aug, const std::vector<Eigen::VectorXd> &mu_aug, ILQRStatus &status, double &J)#

Iterative Linear Quadratic Regulator (iLQR) trajectory optimization.

Performs trajectory refinement using the iterative LQR algorithm. Takes an initial trajectory (X, U) and iteratively improves it by solving local linear quadratic approximations of the optimal control problem.

The algorithm alternates between:

  1. Backward pass: Compute optimal feedback gains K and feedforward terms d

  2. Forward pass: Rollout new trajectory using gains with line search

Convergence is determined by gradient norm, cost improvement, or stagnation. The algorithm respects settings for maximum iterations, convergence tolerances, and regularization strategies.

Note

Algorithm modifies X, U, and J in-place

Note

Convergence is currently determined by settings.ilqr.cost_tol

Parameters:
  • settingsPlannerSettings containing algorithm parameters and cost weights

  • satelliteSatellite model with dynamics and cost functions

  • X – State trajectory (N × state_dim). Modified in-place with optimized trajectory.

  • U – Control trajectory (N-1 × control_dim). Modified in-place with optimized controls.

  • R – Position trajectory in ECI frame (3 × N), meters

  • V – Velocity trajectory in ECI frame (3 × N), m/s

  • B – Magnetic field trajectory in ECI frame (3 × N), Tesla

  • S – Sun direction trajectory in ECI frame (3 × N), unit vectors

  • rho – Atmospheric density trajectory (1 × N), kg/m³

  • jtime – Mission time vector in Julian centuries (N × 1)

  • boresight – Boresight constraint trajectory (3 × N)

  • attitude_target – Attitude goal trajectory (4 × N): quaternions or [NaN, x, y, z] for ECI vector

  • J – Output: total trajectory cost for the optimized trajectory

Returns:

true only when convergence is reached, false when the solve terminates without convergence

bool iLQR(const PlannerSettings &settings, const Satellite &satellite, Eigen::Ref<Eigen::MatrixXd> X, Eigen::Ref<Eigen::MatrixXd> U, const Eigen::Ref<const Eigen::MatrixXd> &R, const Eigen::Ref<const Eigen::MatrixXd> &V, const Eigen::Ref<const Eigen::MatrixXd> &B, const Eigen::Ref<const Eigen::MatrixXd> &S, const Eigen::Ref<const Eigen::MatrixXd> &rho, const Eigen::Ref<const Eigen::VectorXd> &jtime, const Eigen::Ref<const Eigen::MatrixXd> &boresight, const Eigen::Ref<const Eigen::MatrixXd> &attitude_target, double &J)#