Skip to content

Commit 0b40586

Browse files
Thomas StastnyJaeyoung-Lim
authored andcommitted
organze npfg member variables in header, rename min ground speed command -> desired
1 parent 4dce637 commit 0b40586

File tree

2 files changed

+46
-17
lines changed

2 files changed

+46
-17
lines changed

src/lib/npfg/npfg.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,13 @@ float NPFG::minGroundSpeed(const float normalized_track_error, const float feas)
301301
}
302302

303303
// minimum ground speed demand from minimum forward ground speed user setting
304-
float min_gsp_cmd = 0.0f;
304+
float min_gsp_desired = 0.0f;
305305

306306
if (en_min_ground_speed_ && en_wind_excess_regulation_) {
307-
min_gsp_cmd = min_gsp_cmd_;
307+
min_gsp_desired = min_gsp_desired_;
308308
}
309309

310-
return math::max(min_gsp_track_keeping_, min_gsp_cmd);
310+
return math::max(min_gsp_track_keeping_, min_gsp_desired);
311311
} // minGroundSpeed
312312

313313
Vector2f NPFG::refAirVelocity(const Vector2f &wind_vel, const Vector2f &bearing_vec,

src/lib/npfg/npfg.hpp

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class NPFG
102102
/*
103103
* Set the minimum allowed forward ground speed [m/s].
104104
*/
105-
void setMinGroundSpeed(float min_gsp) { min_gsp_cmd_ = math::max(min_gsp, 0.0f); }
105+
void setMinGroundSpeed(float min_gsp) { min_gsp_desired_ = math::max(min_gsp, 0.0f); }
106106

107107
/*
108108
* Set the maximum value of the minimum forward ground speed command for track
@@ -338,52 +338,81 @@ class NPFG
338338
static constexpr float MIN_RADIUS = 0.5f; // minimum effective radius (avoid singularities) [m]
339339
static constexpr float PERIOD_SAFETY_FACTOR = 4.0f; // multiplier for period lower bound [s]
340340

341+
/*
342+
* tuning
343+
*/
344+
341345
float period_{20.0f}; // nominal (desired) period -- user defined [s]
342346
float damping_{0.7071f}; // nominal (desired) damping ratio -- user defined
343347
float p_gain_{0.4442}; // proportional gain (computed from period_ and damping_) [rad/s]
344348
float time_const_{14.142f}; // time constant (computed from period_ and damping_) [s]
345349
float adapted_period_{20.0f}; // auto-adapted period (if stability bounds enabled) [s]
346350

351+
/*
352+
* user defined guidance settings
353+
*/
354+
355+
// guidance options
347356
bool en_period_lb_{true}; // enables automatic lower bound constraints on controller period
348357
bool en_period_ub_{true}; // enables automatic upper bound constraints on controller period (remains disabled if lower bound is disabled)
349358
bool ramp_in_adapted_period_{true}; // linearly ramps in upper bounded period adaptations from the nominal user setting according to track proximity
350-
351359
bool en_min_ground_speed_{true}; // the airspeed reference is incremented to sustain a user defined minimum forward ground speed
352360
bool en_track_keeping_{false}; // the airspeed reference is incremented to return to the track and sustain zero ground velocity until excess wind subsides
353361
bool en_wind_excess_regulation_{true}; // the airspeed reference is incremented to regulate the excess wind, but not overcome it ...
354362
// ^disabling this parameter disables all other excess wind handling options, using only the nominal airspeed for reference
355-
float min_gsp_cmd_{0.0f}; // user defined miminum forward ground speed [m/s]
356-
float min_gsp_track_keeping_{0.0f}; // minimum forward ground speed demand from track keeping logic [m/s]
363+
364+
// guidance settings
365+
float airspeed_nom_{15.0f}; // nominal (desired) airspeed reference (generally equivalent to cruise optimized airspeed) [m/s]
366+
float airspeed_max_{20.0f}; // maximum airspeed reference - the maximum achievable/allowed airspeed reference [m/s]
367+
float roll_time_const_{0.5f}; // autopilot roll response time constant [s]
368+
float min_gsp_desired_{0.0f}; // user defined miminum desired forward ground speed [m/s]
357369
float min_gsp_track_keeping_max_{5.0f}; // maximum, minimum forward ground speed demand from track keeping logic [m/s]
358-
float min_ground_speed_ref_{0.0f}; // resultant minimum forward ground speed reference considering all active guidance logic [m/s]
370+
371+
// guidance parameters
372+
float airspeed_buffer_{1.5f}; // size of the region above the feasibility boundary (into feasible space) where a continuous transition from feasible to infeasible is imposed [m/s]
359373
float inv_nte_fraction_{0.5f}; // inverse normalized track error fraction ...
360374
// ^determines at what fraction of the normalized track error the maximum track keeping forward ground speed demand is reached
375+
376+
/*
377+
* internal guidance states
378+
*/
379+
380+
// speeds
381+
float min_gsp_track_keeping_{0.0f}; // minimum forward ground speed demand from track keeping logic [m/s]
382+
float min_ground_speed_ref_{0.0f}; // resultant minimum forward ground speed reference considering all active guidance logic [m/s]
383+
384+
//bearing feasibility
361385
float feas_{1.0f}; // continous representation of bearing feasibility in [0,1] (0=infeasible, 1=feasible)
362386
float feas_on_track_{1.0f}; // continuous bearing feasibility "on track"
363-
float airspeed_buffer_{1.5f}; // size of the region above the feasibility boundary (into feasible space) where a continuous transition from feasible to infeasible is imposed [m/s]
364387

365-
float track_error_bound_{135.0f}; // the current ground speed dependent track error bound [m]
388+
// track proximity
389+
float track_error_bound_{212.13f}; // the current ground speed dependent track error bound [m]
366390
float track_proximity_{0.0f}; // value in [0,1] indicating proximity to track, 0 = at track error boundary or beyond, 1 = on track
367391

368-
float airspeed_nom_{15.0f}; // nominal (desired) airspeed reference (generally equivalent to cruise optimized airspeed) [m/s]
369-
float airspeed_max_{20.0f}; // maximum airspeed reference - the maximum achievable/allowed airspeed reference [m/s]
370-
float roll_time_const_{0.5f}; // autopilot roll response time constant [s]
371-
392+
// path following states
393+
matrix::Vector2f unit_path_tangent_{matrix::Vector2f{1.0f, 0.0f}}; // unit path tangent vector
394+
float signed_track_error_{0.0f}; // signed track error [m]
372395
matrix::Vector2f bearing_vec_{matrix::Vector2f{1.0f, 0.0f}}; // bearing unit vector
396+
397+
/*
398+
* guidance outputs
399+
*/
373400
float airspeed_ref_{15.0f}; // airspeed reference [m/s]
374401
matrix::Vector2f air_vel_ref_{matrix::Vector2f{15.0f, 0.0f}}; // air velocity reference vector [m/s]
375402
float lateral_accel_{0.0f}; // lateral acceleration reference [m/s^2]
376403
float lateral_accel_ff_{0.0f}; // lateral acceleration demand to maintain path curvature [m/s^2]
377404

378-
/* ECL_L1_Pos_Controller functionality */
405+
/*
406+
* ECL_L1_Pos_Controller functionality
407+
*/
408+
379409
float dt_{0}; // control loop time [s]
380410
float roll_lim_rad_{math::radians(30.0f)}; // maximum roll angle [rad]
381411
float roll_setpoint_{0.0f}; // current roll angle setpoint [rad]
382412
float roll_slew_rate_{0.0f}; // roll angle setpoint slew rate limit [rad/s]
383413
bool circle_mode_{false}; // true if following circle
384414
bool path_type_loiter_{false}; // true if the guidance law is tracking a loiter circle
385-
matrix::Vector2f unit_path_tangent_{matrix::Vector2f{1.0f, 0.0f}}; // unit path tangent vector
386-
float signed_track_error_{0.0f}; // signed track error [m]
415+
387416

388417
/*
389418
* Computes the lateral acceleration and airspeed references necessary to track

0 commit comments

Comments
 (0)