validate_trajOpt#

Input validation for trajectory optimization problem setup.

namespace saltro
namespace validation

Functions

bool validatetrajOpt(const PlannerSettings &settings, const Satellite &satellite, const Eigen::Ref<const Eigen::VectorXd> &x0, const Eigen::Vector3d &r0, const Eigen::Vector3d &v0, const Eigen::Ref<const Eigen::VectorXd> &jtime, const Eigen::Ref<const Eigen::MatrixXd> &q_goal, const Eigen::Ref<const Eigen::MatrixXd> &boresight, int state_dim, int input_dim, int N, std::string &error_msg)#

Validate all inputs to the trajectory optimization problem.

Performs comprehensive validation of all trajectory optimization inputs before invoking the optimizer. Checks include:

Planner Settings:

  • Cost weights are non-negative and finite

  • Constraint tolerances are positive

  • Regularization parameters satisfy min ≤ init ≤ max

  • Line search parameters are in valid ranges (0 < β₁ < β₂ < 1)

  • Timestep dt > 0 and horizon length N > 1

Satellite Configuration:

  • Inertia tensor is symmetric positive definite

  • Actuator counts match configuration (nMTQ, nRW ≥ 0)

  • Actuator limits are positive finite values

Initial State:

  • Quaternion is normalized: ‖q‖ = 1

  • Angular velocity is finite and within rate limits

  • Wheel momenta are within saturation limits

Reference Trajectories:

  • q_goal has shape (4 × N) with normalized quaternions

  • boresight has shape (3 × N) with unit vectors

  • jtime has length N with monotonically increasing values

  • Orbital state (r0, v0) is physically feasible for LEO

Dimension Consistency:

  • state_dim = 7 + nRW

  • input_dim = 3·nMTQ + nRW + 3 (magic torque)

  • All trajectory dimensions match horizon length N

Parameters:
  • settings – Planner configuration to validate

  • satelliteSatellite model to validate

  • x0 – Initial attitude state vector (7+nRW × 1)

  • r0 – Initial position in ECI frame (3 × 1), meters

  • v0 – Initial velocity in ECI frame (3 × 1), m/s

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

  • q_goal – Goal quaternion trajectory (4 × N)

  • boresight – Boresight constraint trajectory (3 × N)

  • state_dim – Expected state dimension (7 + nRW)

  • input_dim – Expected control dimension

  • N – Expected horizon length

  • error_msg – Output: detailed error message describing first validation failure

Returns:

true if all validation checks pass, false otherwise

bool validateTrajOptResampledContext(const Eigen::Ref<const Eigen::Matrix<double, 1, Eigen::Dynamic>> &jtime_resampled, const Eigen::Ref<const Eigen::Matrix<double, 4, Eigen::Dynamic>> &q_goal_resampled, const Eigen::Ref<const Eigen::Matrix<double, 3, Eigen::Dynamic>> &boresight_resampled, int N_resampled, int X_col_capacity, int U_col_capacity, std::string &error_msg)#

Validate derived trajectory context after resampling in trajOpt.

This check is intended to be called explicitly inside trajOpt after time/goal resampling and before warm-start/optimization. It validates that the derived horizon and trajectory capacities are internally consistent.

Parameters:
  • jtime_resampled – Resampled mission time buffer (1 × capacity)

  • q_goal_resampled – Resampled target attitude buffer (4 × capacity)

  • boresight_resampled – Resampled boresight buffer (3 × capacity)

  • N_resampled – Active resampled horizon length

  • X_col_capacity – Available state trajectory column capacity

  • U_col_capacity – Available control trajectory column capacity

  • error_msg – Output: detailed error message describing first failure

Returns:

true if resampled context is valid, false otherwise