10 std::cout <<
"=== Robust DDP Controller Test ===" << std::endl;
24 config.injector_dp_frac = 0.1;
41 config.altitude_target = -1.0;
45 std::cerr <<
"Failed to initialize controller" << std::endl;
54 meas.
P_u_ox = 1305.0 * 6894.76;
57 meas.
timestamp = std::chrono::steady_clock::now();
72 std::cout << std::fixed << std::setprecision(2);
74 <<
"\nTick | duty_F | duty_O | F_est [N] | MR_est | P_ch [MPa] | safe_filt | cutoff\n";
75 std::cout << std::string(90,
'-') <<
"\n";
77 for (
int i = 0; i < 10; ++i) {
78 auto [act, diag] = controller.
step(meas,
nav, cmd);
80 std::cout << std::setw(4) << i <<
" | " << std::setw(6) << act.duty_F <<
" | "
81 << std::setw(6) << act.duty_O <<
" | " << std::setw(10) << diag.F_estimated
82 <<
" | " << std::setw(6) << diag.MR_estimated <<
" | " << std::setw(10)
83 << diag.P_ch / 1e6 <<
" | " << (diag.safety_filtered ?
" YES " :
" no ")
84 <<
" | " << (diag.cutoff_active ?
"YES" :
" no") <<
"\n";
97 std::cout <<
"\n--- Cutoff test (altitude_target = 100 m) ---\n";
99 config.altitude_target = 100.0;
100 config.cutoff_delta = 20.0;
105 auto [act_cut, diag_cut] = controller.
step(meas,
nav, cmd);
106 std::cout <<
" h=80, vz=25 → cutoff=" << (diag_cut.cutoff_active ?
"YES" :
"NO") <<
"\n";
110 auto [act_nocut, diag_nocut] = controller.
step(meas,
nav, cmd);
111 std::cout <<
" h=10, vz=5 → cutoff=" << (diag_nocut.cutoff_active ?
"YES" :
"NO") <<
"\n";
113 std::cout <<
"\n✅ Robust DDP Controller test completed successfully\n";