backwardpass#

namespace saltro
namespace optimizer

Functions

bool backwardPass(const Satellite &satellite, const Eigen::Ref<const Eigen::MatrixXd> &X, const Eigen::Ref<const 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::MatrixXd> &boresight, const Eigen::Ref<const Eigen::MatrixXd> &attitude_target, const PlannerSettings &settings, double reg, std::vector<Eigen::MatrixXd> &K, std::vector<Eigen::VectorXd> &d, Eigen::Ref<Eigen::Vector2d> deltaV, const std::vector<Eigen::VectorXd> &lambda_aug, const std::vector<Eigen::VectorXd> &mu_aug)#

Backward pass for iLQR.

Computes optimal feedback gains K and feedforward terms d by solving Riccati-like equations from the final time backwards to the initial time. Initializes the value function at terminal time using terminal cost derivatives.

For each timestep k, performs a regularization loop: increases the regularization parameter rho until Q_uu + rho*I becomes positive definite, then solves for gains and updates the value function.

Parameters:
  • satelliteSatellite model with dynamics and cost/constraint functions

  • X – State trajectory (N x state_dim)

  • U – Control trajectory (N-1 x control_dim)

  • R – Position trajectory (3 x N)

  • V – Velocity trajectory (3 x N)

  • B – Magnetic field trajectory (3 x N)

  • S – Sun direction trajectory (3 x N)

  • rho – Density trajectory (1 x N)

  • boresight – Boresight vector trajectory (3 x N)

  • attitude_target – Goal orientation (quaternion or ECI vector format)

  • settings – Planner settings (contains cost, regularization config)

  • reg – Regularization parameter added to Q_uu diagonal for numerical stability

  • K – Output feedback gains (std::vector where K[k] is nu × nxr for each timestep)

  • d – Output feedforward terms (std::vector where d[k] is nu × 1 for each timestep)

  • deltaV – Output expected cost change coefficients (2x1) deltaV(0) = first-order term (accumulated across all timesteps) deltaV(1) = second-order term (accumulated across all timesteps)

Returns:

true if backward pass succeeded (regularization converged), false if numerical failure

inline bool backwardPass(const Satellite &satellite, const Eigen::Ref<const Eigen::MatrixXd> &X, const Eigen::Ref<const 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::MatrixXd> &boresight, const Eigen::Ref<const Eigen::MatrixXd> &attitude_target, const PlannerSettings &settings, double reg, std::vector<Eigen::MatrixXd> &K, std::vector<Eigen::VectorXd> &d, Eigen::Ref<Eigen::Vector2d> deltaV)#