|
| Reference | build_reference (NavState nav, Measurement meas, Command cmd, ControllerConfig cfg, int horizon_N, Optional[EngineWrapper] engine_wrapper=None, Optional[float] F_ref_prev=None, Optional[float] dt=None) |
| np.ndarray | _compute_thrust_command (Command cmd, int horizon_N, float dt) |
| np.ndarray | _compute_altitude_command (NavState nav, float altitude_goal, int horizon_N, float dt, ControllerConfig cfg) |
| Tuple[float, float] | _estimate_thrust_bounds (np.ndarray state, Measurement meas, ControllerConfig cfg, Optional[EngineWrapper] engine_wrapper, Optional[EngineEstimate] eng_est_current) |
| float | _project_thrust (float F_des, float F_min, float F_max, float F_prev, float dt, ControllerConfig cfg) |
| np.ndarray | _measurement_to_state (Measurement meas) |
Reference generation for robust DDP controller.
Supports two modes:
- A) Thrust command: user provides F_des(t) or piecewise schedule
- B) Altitude command: compute desired thrust from PD guidance
Computes feasible reference projection with bounds and slew rate limiting.
| np.ndarray engine.control.robust_ddp.reference._compute_altitude_command |
( |
NavState | nav, |
|
|
float | altitude_goal, |
|
|
int | horizon_N, |
|
|
float | dt, |
|
|
ControllerConfig | cfg ) |
|
protected |
Compute desired thrust from PD guidance for altitude command.
Uses: a_cmd = kp*(h_goal - h) + kd*(vz_goal - vz)
F_des = m*(a_cmd + g) / cos(theta)
Parameters:
-----------
nav : NavState
Current navigation state
altitude_goal : float
Target altitude [m]
horizon_N : int
Horizon length
dt : float
Time step [s]
cfg : ControllerConfig
Controller configuration (for PD gains if available)
Returns:
--------
F_des : np.ndarray, shape (horizon_N,)
Desired thrust sequence [N]
Definition at line 223 of file reference.py.
Referenced by build_reference().
Estimate feasible thrust bounds [F_min, F_max].
Parameters:
-----------
state : np.ndarray
Current state vector
meas : Measurement
Current measurements
cfg : ControllerConfig
Controller configuration
engine_wrapper : EngineWrapper, optional
Engine wrapper for performance estimation
eng_est_current : EngineEstimate, optional
Current engine estimate
Returns:
--------
F_min : float
Minimum feasible thrust [N]
F_max : float
Maximum feasible thrust [N]
Definition at line 297 of file reference.py.
References max, and min.
Referenced by build_reference().
| float engine.control.robust_ddp.reference._project_thrust |
( |
float | F_des, |
|
|
float | F_min, |
|
|
float | F_max, |
|
|
float | F_prev, |
|
|
float | dt, |
|
|
ControllerConfig | cfg ) |
|
protected |
Project desired thrust to feasible reference with slew rate limiting.
Uses sequential clipping:
1. Clamp to bounds: F = clip(F_des, [F_min, F_max])
2. Limit slew rate: F = clip(F, [F_prev - dF_max*dt, F_prev + dF_max*dt])
Parameters:
-----------
F_des : float
Desired thrust [N]
F_min : float
Minimum feasible thrust [N]
F_max : float
Maximum feasible thrust [N]
F_prev : float
Previous reference thrust [N]
dt : float
Time step [s]
cfg : ControllerConfig
Controller configuration
Returns:
--------
F_ref : float
Projected reference thrust [N]
Definition at line 374 of file reference.py.
Referenced by build_reference().
Build reference trajectory for DDP controller.
Parameters:
-----------
nav : NavState
Current navigation state (altitude, velocity, tilt, mass)
meas : Measurement
Current sensor measurements (pressures)
cmd : Command
Control command (thrust desired or altitude goal)
cfg : ControllerConfig
Controller configuration
horizon_N : int
Prediction horizon length
engine_wrapper : EngineWrapper, optional
Engine wrapper for estimating feasible thrust bounds
F_ref_prev : float, optional
Previous reference thrust (for slew rate limiting)
dt : float, optional
Time step [s] (defaults to cfg.dt)
Returns:
--------
ref : Reference
Reference trajectory with F_ref, MR_ref, bounds, and feasibility
Definition at line 35 of file reference.py.
References _compute_altitude_command(), _compute_thrust_command(), _estimate_thrust_bounds(), _measurement_to_state(), and _project_thrust().