Cargo UAV Autonomy and Flight AI — Ch.03: Flight Control Software [EN]

2026-11-19来源 dev.toEnglish
Cargo UAV Autonomy and Flight AI — Ch.03: Flight Control Software [EN]

STATERA Library · Series 08 · Volume 23 · Chapter 03 · EN
Source: https://github.com/Statera-Library/08_Vol_23_Cargo_UAV_Autonomy_and_Flight_AI/blob/main/Chapter_03_Flight_Control_Software/Chapter_03_Flight_Control_Software_EN.md

Volume 23. Cargo UAV Autonomy and Flight AI

Chapter 03. Flight Control Software

03.01. FCS Architecture Attitude Altitude Position Loop

The flight control system of a cargo UAV is organized as a hierarchy of closed-loop controllers that progressively transform mission-level motion commands into actuator-level control actions. At the core of this hierarchy are the position, altitude, and attitude loops, each operating at a different dynamic timescale. This layered architecture allows the aircraft to maintain stable flight while simultaneously following commanded trajectories and compensating for disturbances.

The position loop forms the outer portion of the flight control hierarchy and regulates the aircraft's horizontal location relative to a commanded reference. Position estimates derived from navigation sensors are compared with desired coordinates, producing position errors that are converted into velocity or acceleration commands. Because translational motion develops more slowly than rotational motion, this loop normally operates at a lower bandwidth than the inner attitude controller.

A velocity control stage is commonly placed between position regulation and attitude control. The controller compares desired horizontal velocity with estimated aircraft velocity and calculates the acceleration required to reduce the error. These acceleration commands are subsequently transformed into desired roll and pitch orientations. The result is a cascaded structure in which horizontal translation is achieved indirectly by controlling the orientation of the vehicle's thrust vector.

Altitude control follows a similar hierarchical principle but operates along the vertical axis. The commanded altitude is compared with the estimated altitude to generate a vertical position error, which is converted into a vertical velocity reference. A vertical-speed controller then determines the thrust adjustment required to climb, descend, or maintain altitude. Separating altitude and vertical-speed regulation improves transient behavior and prevents abrupt thrust changes caused by large altitude errors.

The attitude loop is the fastest major feedback layer and directly stabilizes roll, pitch, and yaw orientation. Desired attitude commands arriving from the outer control loops are compared with estimated orientation, and the resulting errors generate angular-rate references. An inner angular-rate controller then calculates the torque commands necessary to achieve those rates. This cascaded attitude-rate architecture provides rapid disturbance rejection while maintaining predictable aircraft response.

Reliable state information is essential because every feedback loop depends on estimates of the aircraft's actual motion. The flight control software therefore receives attitude, angular velocity, position, velocity, and altitude estimates from the navigation and estimation subsystem. The surrounding chapter structure explicitly separates attitude estimation using EKF, IMU, and GNSS fusion from controller design, establishing estimation and control as closely coupled but independently engineered functions. Volume_23_Cargo_UAV_Autonomy_an...

For a multirotor cargo UAV, the controller outputs cannot be sent directly to individual motors. Desired total thrust and body-axis moments must first pass through a control-allocation or mixing stage that distributes commands across the available propulsion units. The architecture therefore connects attitude, altitude, and position regulation to a multirotor mixing matrix and motor-allocation function, which is treated as a dedicated flight-control function in the volume structure. Volume_23_Cargo_UAV_Autonomy_an...

The different loops must be designed with clear bandwidth separation. Angular-rate regulation is generally the fastest layer, followed by attitude regulation, velocity control, and finally position control. This ordering prevents a slower outer loop from demanding motion that the inner dynamics cannot track. Each outer controller effectively assumes that the controller beneath it can execute its command sufficiently faster than the rate at which the outer reference changes.

Cargo UAVs introduce an additional challenge because aircraft dynamics can vary substantially with payload mass, center-of-gravity location, fuel or battery state, and cargo release. A controller tuned for an unloaded vehicle may therefore respond differently at maximum payload. The FCS architecture should expose vehicle-state and payload-related parameters so that gains, limits, feedforward terms, or control allocation can adapt without compromising the deterministic behavior of the stabilization loops.

Payload changes are especially important for altitude control because the thrust required for hover depends strongly on total vehicle mass. An inaccurate hover-thrust estimate forces the feedback controller to continuously compensate for a systematic error. Feedforward based on estimated mass can provide the nominal thrust requirement, while feedback corrects residual deviations. The chapter structure consequently treats cargo-weight load-change adaptive control as a distinct extension of the basic FCS architecture. Volume_23_Cargo_UAV_Autonomy_an...

External disturbances must also be considered throughout the cascaded loops. Wind can create position drift, velocity error, attitude perturbations, and additional propulsion demand simultaneously. Fast attitude regulation rejects short-duration rotational disturbances, while velocity and position controllers compensate for accumulated translational displacement. Disturbance estimation can further improve performance by providing feedforward compensation instead of requiring every disturbance to appear first as feedback error.

Command limiting is essential between control layers. Position errors should not produce unlimited velocity commands, velocity errors should not demand physically impossible tilt angles, and altitude errors should not generate excessive climb rates or thrust. Rate, acceleration, attitude, thrust, and actuator limits should therefore be enforced at defined interfaces. Anti-windup mechanisms are also required where integral control is used so that saturation does not produce excessive stored controller error.

The FCS must remain coordinated with the flight-mode manager. Manual, semi-automatic, and fully autonomous operation may generate references from different sources, but they should converge through controlled interfaces before reaching safety-critical stabilization functions. Mode transitions require reference synchronization, state initialization, and bumpless transfer so that changing command authority does not suddenly introduce attitude, altitude, velocity, or position discontinuities.

A practical software implementation separates estimation, reference generation, control-law computation, allocation, actuator output, monitoring, and safety supervision while maintaining deterministic timing between them. High-rate attitude and angular-rate functions require predictable execution latency, whereas position and mission-related commands can operate more slowly. This separation also supports independent verification of critical components and simplifies SIL and HIL testing later in the development process.

Fault handling must be integrated without making nominal control logic unnecessarily complex. Invalid navigation estimates, excessive attitude errors, actuator saturation, propulsion degradation, timing overruns, or inconsistent sensor states should be detected by monitoring functions and converted into predefined control responses. Depending on severity, the system may constrain the flight envelope, switch estimation sources, reduce mission authority, initiate return-to-home behavior, or transition toward an emergency landing strategy.

For heavy cargo aircraft, redundancy further affects the architecture because multiple flight-control computers, sensor channels, communication paths, or propulsion controllers may participate in the same control chain. The control-law interfaces should therefore use clearly defined timestamps, validity information, synchronization rules, and command ownership. This complements the volume's broader redundant-computing architecture and later safety functions rather than embedding redundancy policy directly inside every individual controller.

The resulting FCS can be understood as a deterministic conversion chain from desired aircraft motion to physical force and moment generation. Position error produces translational commands, altitude error produces vertical-motion commands, and these outer-loop objectives become attitude and thrust references. Fast attitude and rate loops stabilize the vehicle, while control allocation converts the requested forces and moments into propulsion commands that the aircraft can physically execute.

This hierarchical architecture provides the foundation for the remainder of the flight-control chapter. Attitude estimation supplies the state, PID or LQR methods implement attitude regulation, vertical controllers govern altitude, outer loops regulate position and velocity, and motor allocation converts control effort into actuator commands. Adaptive payload control, wind rejection, flight-mode management, and SIL/HIL verification then extend the same foundation toward a robust cargo-UAV flight-control system.

03.02. Attitude Estimation EKF IMU GNSS Fusion [w/Code]

Attitude estimation provides the flight control system with a continuous representation of the aircraft's orientation and rotational motion. For a cargo UAV, this estimate must remain stable during hover, aggressive maneuvering, payload-induced disturbances, and changing environmental conditions. The estimator combines high-rate inertial measurements with lower-rate navigation observations so that the controller receives an accurate state without relying on any single sensor source.

The inertial measurement unit, or IMU, forms the high-frequency foundation of the attitude estimator. Three-axis gyroscopes measure angular velocity, while accelerometers measure specific force along the aircraft body axes. Gyroscope measurements can be integrated to propagate orientation rapidly between external observations, making them well suited to the fast dynamics required by attitude control. However, even small gyro biases accumulate over time and eventually produce significant orientation drift.

Accelerometers provide an additional reference because the gravity vector can be observed when non-gravitational acceleration is sufficiently limited. The estimator can compare the measured acceleration direction with the expected gravity direction to correct roll and pitch drift. During aggressive maneuvering, strong wind response, or cargo motion, however, accelerometer measurements contain substantial translational acceleration. The estimator must therefore distinguish useful gravity information from vehicle dynamics rather than treating every acceleration sample as a direct attitude reference.

GNSS measurements complement the IMU by providing globally referenced position and velocity observations. GNSS does not normally measure roll and pitch directly, but velocity information can constrain the navigation solution and indirectly improve attitude estimation through the coupled vehicle-state model. Systems equipped with multiple GNSS antennas may additionally derive heading from carrier-phase measurements, providing an absolute yaw reference that does not depend solely on magnetic sensing.

An Extended Kalman Filter, or EKF, provides a practical framework for combining these heterogeneous measurements. The EKF maintains a state vector describing quantities such as orientation, velocity, position, gyroscope bias, and accelerometer bias. Because UAV motion and attitude kinematics are nonlinear, the filter propagates the nonlinear state model while locally linearizing the system for covariance prediction and measurement updates. This allows uncertainty to be explicitly represented throughout the estimation process.

The prediction stage normally executes at the IMU sampling rate. Gyroscope measurements propagate aircraft orientation, while accelerometer measurements are transformed from the body coordinate frame into the navigation frame and used to propagate velocity and position. Bias estimates are incorporated into this process so that corrected inertial measurements drive the state equations. The covariance matrix is propagated simultaneously to represent how uncertainty increases between external measurement updates.

When a GNSS observation becomes available, the EKF performs a measurement update rather than replacing the inertial state directly. Predicted position or velocity is compared with the corresponding GNSS observation to calculate an innovation, or measurement residual. The Kalman gain determines how strongly this innovation should modify the current state according to the relative uncertainty assigned to the prediction and measurement. This probabilistic weighting is central to robust multi-sensor fusion.

Orientation can be represented internally using quaternions because they avoid the singularities associated with Euler-angle representations near certain orientations. Roll, pitch, and yaw remain useful for monitoring, command interfaces, and flight-control interpretation, but quaternion-based propagation provides a more robust mathematical representation for three-dimensional rotation. Careful quaternion normalization and coordinate-frame conventions are essential because small implementation inconsistencies can create large control errors.

Sensor bias estimation is particularly important for long-duration cargo missions. Gyroscope bias directly produces attitude drift, while accelerometer bias creates velocity and position errors after integration. Including these biases as EKF states allows the filter to estimate them gradually from measurement innovations. Bias dynamics are commonly modeled as slowly varying stochastic processes so that the estimator can track thermal changes, aging effects, and other gradual sensor variations during operation.

Timing accuracy is as important as measurement accuracy. IMU and GNSS observations arrive at different frequencies and may experience different transport, processing, and communication delays. Each observation should therefore be associated with a reliable measurement timestamp. If delayed GNSS data are fused as though they represented the current aircraft state, the EKF can introduce artificial innovations and degraded attitude estimates, particularly during high-speed or high-angular-rate maneuvers.

Coordinate-frame management must also remain consistent throughout the estimator. IMU measurements originate in the sensor frame and may require transformation into the aircraft body frame before being used. Navigation states are represented in a defined local or geographic reference frame, while GNSS measurements originate from an Earth-referenced coordinate system. Explicit transformations, axis conventions, rotation directions, and unit definitions prevent frame mismatches from propagating into the flight controller.

Measurement quality should be evaluated before every EKF correction. GNSS accuracy may degrade because of satellite geometry, multipath, interference, obstruction, or atmospheric effects, while IMU measurements may become saturated or temporarily corrupted. Innovation tests can compare measurement residuals against their predicted uncertainty and reject observations that are statistically inconsistent. This prevents a single abnormal measurement from immediately destabilizing the navigation and attitude solution.

GNSS loss must not cause immediate loss of attitude stabilization because the IMU continues to provide high-rate rotational information. During a GNSS outage, the EKF can continue inertial propagation while recognizing that position and velocity uncertainty will increase over time. Attitude may remain sufficiently accurate for stabilization for a longer interval, depending on available aiding sources and sensor quality, but navigation drift eventually requires additional observations or a transition to an appropriate degraded operating mode.

For heavy cargo UAVs, vibration management becomes especially significant because large propulsion systems can introduce structural vibration into inertial measurements. Rotor harmonics, motor imbalance, flexible structures, and payload coupling may contaminate accelerometer and gyroscope signals. Mechanical isolation, sensor placement, digital filtering, and estimator tuning must therefore be coordinated. Excessive filtering should also be avoided because additional phase delay can reduce the usefulness of the state estimate for fast feedback control.

Payload motion can create another estimation challenge. A suspended or partially flexible load can generate oscillatory accelerations and rotational disturbances that do not correspond directly to rigid-body aircraft attitude. The estimator should remain focused on the vehicle state required by the flight controller while avoiding excessive correction from transient load-induced accelerations. Appropriate process noise, measurement covariance, innovation gating, and vehicle modeling help maintain stable estimates under these conditions.

Estimator outputs should include more than nominal attitude values. The flight-control software benefits from angular rates, navigation states, bias estimates, covariance or confidence information, sensor-validity status, innovation statistics, and estimator-health indicators. These outputs allow control and safety functions to distinguish a physically unusual aircraft state from an unreliable state estimate and to select appropriate fallback behavior when estimation quality deteriorates.

The estimator should also support initialization and reinitialization as explicit operating phases. Before flight, the system must establish valid orientation, sensor biases, navigation references, and covariance values. Initialization while stationary is comparatively straightforward, whereas recovery after an in-flight estimator reset requires careful handling of current motion and available measurements. Flight-control authority should only transition to functions that depend on the estimator after the required state-validity criteria have been satisfied.

Verification requires evaluating both nominal accuracy and failure behavior. Recorded sensor data, software-in-the-loop simulation, hardware-in-the-loop testing, injected bias, GNSS dropout, delayed measurements, vibration, and abnormal innovations can be used to assess estimator robustness. The surrounding flight-control structure places EKF-based IMU/GNSS attitude estimation immediately before attitude, altitude, and position controller development, emphasizing its role as the state foundation for the complete control hierarchy. Volume_23_Cargo_UAV_Autonomy_an...

A well-designed EKF-based fusion architecture therefore creates a bridge between noisy physical sensors and deterministic flight-control functions. High-rate IMU propagation provides responsiveness, GNSS observations constrain accumulated inertial drift, and probabilistic fusion determines how each source influences the state according to its uncertainty. The resulting attitude and navigation estimate becomes the common state reference from which stable cargo-UAV flight control, autonomous navigation, safety monitoring, and fault management can operate.

03.03. Attitude Controller Design PID LQR [w/Code]

Attitude control is the core stabilization function that converts commanded aircraft orientation into the body moments required to control roll, pitch, and yaw. In a cargo UAV, the controller must provide rapid and predictable response while accommodating large variations in mass, inertia, propulsion loading, and environmental disturbance. The flight-control structure therefore places attitude-controller design directly after state estimation and before altitude, position, and motor-allocation functions. Volume_23_Cargo_UAV_Autonomy_an...

A practical attitude-control architecture is usually implemented as a cascaded system. The outer attitude loop compares commanded orientation with the estimated aircraft attitude and generates desired angular rates. The inner rate loop compares these references with measured or estimated body rates and calculates roll, pitch, and yaw moment commands. Separating orientation regulation from angular-rate stabilization allows the inner loop to reject disturbances much faster than the outer loop changes aircraft orientation.

The attitude error must be represented carefully because aircraft orientation is inherently three-dimensional. Euler-angle errors can provide intuitive roll, pitch, and yaw quantities for moderate operating envelopes, while quaternion-based or rotation-based errors provide more consistent behavior for larger rotations. Regardless of representation, the controller must use coordinate conventions that exactly match the estimator, vehicle model, and control-allocation subsystem to prevent incorrect moment commands.

PID control provides a widely applicable baseline for attitude and rate regulation. The proportional term generates corrective action according to the current error, the integral term compensates for persistent bias or steady disturbance, and the derivative term introduces damping based on error variation. In UAV implementations, derivative behavior is often obtained from measured angular rate rather than directly differentiating noisy attitude errors, improving robustness against sensor noise.

Proportional gain strongly influences responsiveness. A low value produces slow attitude convergence, whereas excessive proportional gain can create oscillation or excite structural and propulsion dynamics. Integral gain removes persistent errors caused by aerodynamic asymmetry, center-of-gravity offset, propulsion mismatch, or sustained wind disturbance. However, excessive integral action can generate slow oscillations and large accumulated commands when actuators become saturated.

Derivative or rate feedback provides damping and is particularly important for fast rotational dynamics. Because gyroscope measurements contain vibration and high-frequency noise, rate signals may require filtering before they are used by the controller. Filter bandwidth must be selected carefully: insufficient filtering allows noise to reach actuator commands, while excessive filtering introduces phase delay and can reduce stability margins in the high-bandwidth inner control loop.

Anti-windup logic is essential whenever integral control operates near physical actuator limits. During aggressive maneuvers, heavy payload operation, strong winds, or propulsion degradation, requested moments may exceed available authority. If the integral state continues accumulating while the actuator is saturated, substantial overshoot can occur when control authority returns. Integral clamping, conditional integration, or back-calculation can constrain this behavior.

PID controllers can be tuned independently for roll, pitch, and yaw when axis coupling is limited, but heavy cargo UAVs may exhibit significant cross-axis interaction. Large structures, asymmetric payload placement, changing inertia, and propulsion configuration can cause a moment around one axis to influence motion around another. Gain scheduling or model-based compensation can therefore supplement conventional PID control when fixed independent gains no longer provide adequate performance across the complete flight envelope.

Linear Quadratic Regulator, or LQR, control provides a model-based alternative for coupled attitude dynamics. The aircraft dynamics are linearized around an operating condition and represented through state-space equations. LQR determines a feedback gain matrix by minimizing a quadratic cost function that penalizes state deviation and control effort. The resulting controller can coordinate multiple states and control channels simultaneously rather than treating each rotational axis as completely independent.

LQR behavior is shaped primarily through state-weighting and control-weighting matrices. Increasing the penalty on attitude or angular-rate error generally produces stronger corrective action, while increasing the penalty on control effort reduces actuator demand. These matrices therefore express the desired compromise among tracking accuracy, damping, actuator usage, and robustness. Their selection still requires engineering judgment even though the feedback gain itself is calculated mathematically.

The usefulness of LQR depends on the accuracy of the underlying model and the validity of the selected operating point. A controller derived for one payload mass, center-of-gravity position, airspeed, or propulsion condition may become less effective when the vehicle configuration changes substantially. Multiple linear models, gain scheduling, parameter adaptation, or robust design techniques can extend model-based control across a wider cargo-UAV operating envelope.

PID and LQR should not necessarily be viewed as mutually exclusive approaches. A flight-control architecture may use PID-based inner-rate control because of its simplicity, transparency, and mature tuning methodology while applying model-based techniques to selected coupled dynamics. Conversely, LQR can provide the principal state-feedback law while integral augmentation compensates for steady disturbances. Controller selection should follow vehicle dynamics, certification objectives, computational constraints, and verification requirements.

Feedforward control can improve either approach by commanding part of the required response before significant feedback error develops. Desired angular acceleration, estimated inertia, thrust state, or known aerodynamic effects can be used to calculate nominal moment demand. Feedback then corrects modeling errors and external disturbances. This division reduces the amount of corrective action demanded from the feedback controller and can improve tracking during rapid commanded maneuvers.

Control commands must pass through explicit limit management before reaching the allocation layer. Maximum angular rates, attitude angles, moments, and command slew rates should reflect structural limits, propulsion capability, payload constraints, and the approved flight envelope. When saturation occurs, the controller should preserve the most safety-critical stabilization objectives rather than allowing incompatible commands from multiple axes to compete without priority.

Cargo mass and center-of-gravity variation directly affect attitude-control authority because they modify rotational inertia and the relationship between actuator force and body acceleration. A heavily loaded vehicle may respond more slowly to the same commanded moment, while an asymmetric load can introduce trim requirements and axis coupling. The broader flight-control structure therefore extends basic attitude control with dedicated cargo-weight adaptive control and disturbance-rejection functions. Volume_23_Cargo_UAV_Autonomy_an...

Wind gusts and propulsion disturbances provide important tests of controller robustness. The inner rate loop should rapidly suppress unexpected rotational motion, while the attitude loop restores the commanded orientation after the transient disturbance. Performance can be evaluated using rise time, settling time, overshoot, steady-state error, disturbance-rejection time, control effort, and stability margins rather than relying on a single tracking-error metric.

Controller execution must also satisfy deterministic real-time requirements. The attitude and rate loops operate at higher frequencies than altitude and position control, so sampling period, computation time, sensor latency, and actuator-command delay directly affect achievable bandwidth. Timing jitter or delayed state estimates effectively introduce additional phase lag, meaning a controller that is stable in an ideal simulation may perform poorly when implemented on actual flight-control hardware.

Fault conditions require deliberate degradation behavior. If an actuator loses effectiveness, a motor reaches saturation, state-estimation quality deteriorates, or available control authority becomes insufficient, the controller should expose this condition to higher-level safety logic. Remaining authority may be redistributed through control allocation, attitude limits may be reduced, or the aircraft may transition into a contingency mode rather than continuing to demand an unattainable nominal response.

Verification should begin with mathematical analysis and simulation before progressing toward software-in-the-loop and hardware-in-the-loop testing. Parameter sweeps can examine payload mass, inertia, center-of-gravity shift, sensor noise, actuator delay, wind disturbance, and propulsion degradation. Step commands and disturbance injections reveal transient characteristics, while frequency-domain analysis can evaluate gain and phase margins for critical control loops.

Flight testing should expand the operating envelope progressively rather than immediately exercising maximum commands. Initial hover and low-rate maneuvers can confirm axis signs, gain behavior, actuator authority, and estimator-controller consistency. Subsequent tests can introduce larger attitude commands, payload variations, wind disturbances, and aggressive transitions while monitoring stability margins, saturation events, tracking error, structural response, and controller timing.

The final attitude-control design is therefore more than a choice between PID and LQR. It is an integrated stabilization function connecting state estimation, rotational dynamics, command shaping, actuator limits, payload variation, disturbance rejection, real-time execution, and control allocation. When these elements are engineered together, the attitude controller provides the stable inner foundation required by altitude control, position control, autonomous navigation, and safety-critical cargo-UAV operation.

03.04. Altitude and Vertical Speed Controller [w/Code]

Altitude control regulates the vertical position of a cargo UAV while the vertical-speed controller governs the rate at which the aircraft climbs or descends. These functions form a cascaded control structure between higher-level trajectory commands and the propulsion system. Within the flight-control architecture, altitude and vertical-speed regulation follows attitude control and precedes position and velocity control, establishing a coordinated hierarchy for three-dimensional flight.

The outer altitude loop compares the commanded altitude with the estimated altitude and converts the resulting height error into a desired vertical-speed command. Rather than attempting to control thrust directly from altitude error, this intermediate reference allows vertical motion to be shaped gradually. Maximum climb and descent rates can be imposed at this stage so that large altitude errors do not produce commands outside the aircraft's safe operating envelope.

The inner vertical-speed loop compares the commanded climb or descent rate with the estimated vertical velocity. The resulting error is converted into a vertical acceleration or collective-thrust correction. Because this loop operates faster than the altitude loop, it can reject short-term vertical disturbances while the slower outer loop maintains long-term altitude accuracy. This bandwidth separation is fundamental to predictable cascaded-control behavior.

Vertical state estimation is therefore closely coupled with controller performance. Altitude information may originate from GNSS, barometric pressure sensors, radar or laser altimeters, and fused navigation estimates, while vertical velocity can be derived from inertial and navigation measurements. The controller should consume a consistent fused state rather than independently switching between raw sensors, because discontinuities in altitude or velocity estimates can immediately create unwanted thrust commands.

A basic altitude controller can use proportional or proportional-integral feedback to transform altitude error into vertical-speed demand. Proportional action determines how aggressively the aircraft closes the altitude difference, while integral action can eliminate persistent offsets. The command should normally pass through climb-rate, descent-rate, acceleration, and jerk constraints to produce smooth motion compatible with cargo stability, passenger-free structural limits, and propulsion capability.

The vertical-speed controller commonly applies proportional-integral-derivative or equivalent feedback around vertical velocity. Proportional action responds to instantaneous speed error, integral action compensates for persistent thrust mismatch, and acceleration-related damping can improve transient behavior. For cargo UAVs, the controller must avoid excessive vertical oscillation because repeated acceleration can increase structural loads, disturb suspended cargo, and reduce propulsion efficiency.

Hover-thrust estimation is especially important because gravity produces a continuous force that must be balanced before feedback corrections are considered. If the nominal thrust required to support the vehicle is known, it can be applied as a feedforward term and the feedback controller only needs to correct deviations. Without this compensation, the integral controller may be forced to generate most of the steady hover command, producing slower convergence and greater sensitivity to saturation.

Cargo mass directly changes the required hover thrust. A vehicle carrying a heavy payload requires substantially greater collective propulsion than the same aircraft operating unloaded. The flight-control software should therefore update the nominal thrust model when reliable payload or vehicle-mass information is available. This relationship connects altitude regulation with the chapter's dedicated load-change adaptive-control function for changing cargo weight. Volume_23_Cargo_UAV_Autonomy_an...

Center-of-gravity variation can also affect vertical control indirectly. Although altitude regulation primarily determines collective thrust, an offset center of gravity may require differential actuator forces to maintain attitude. Some propulsion capacity is consequently consumed by attitude stabilization rather than pure vertical force generation. The altitude controller and control-allocation subsystem must respect the remaining thrust authority instead of assuming that maximum theoretical propulsion is always available for climbing.

Vehicle attitude changes the relationship between total thrust and vertical force. During level hover, most collective thrust acts against gravity, whereas during significant roll or pitch angles part of the thrust vector produces horizontal acceleration. Vertical control may therefore require tilt compensation so that commanded collective thrust accounts for the reduced vertical component. Such compensation must remain bounded because aggressive tilt combined with high altitude demand can otherwise drive propulsion into saturation.

Thrust saturation represents one of the most important nonlinear constraints in vertical control. Maximum thrust limits climbing capability, while minimum usable thrust and vehicle dynamics constrain rapid descent. When commanded acceleration exceeds available propulsion authority, integral terms should not continue accumulating error indefinitely. Anti-windup logic, command limiting, and saturation feedback allow the controller to recover smoothly after normal control authority becomes available again.

Descent behavior requires particular attention because multirotor aerodynamics may become unfavorable at high downward velocity. The controller should therefore apply validated descent-rate and acceleration limits rather than treating upward and downward motion as perfectly symmetric. Heavy cargo further changes safe descent characteristics because increased mass alters momentum, required recovery thrust, and the vertical distance necessary to arrest a descent before landing or obstacle clearance is compromised.

Wind disturbances create vertical as well as horizontal control errors. Updrafts and downdrafts can change climb rate even when collective thrust remains constant, while turbulent airflow around large structures may generate rapidly varying vertical forces. The inner vertical-speed loop should suppress these disturbances without reacting excessively to measurement noise. Disturbance estimates or acceleration feedforward can further improve response when reliable information is available.

Command shaping becomes especially important for cargo missions. Sudden changes from hover to maximum climb can produce large acceleration and jerk, causing cargo movement and structural loading even when the aircraft remains controllable. Vertical commands can therefore be passed through rate and acceleration limiters or trajectory generators. Smooth references reduce mechanical stress and improve tracking because the controller is not repeatedly asked to reproduce physically unrealistic step changes.

Takeoff introduces a special vertical-control transition because the vehicle moves from ground support to aerodynamic support. Before liftoff, increasing thrust may not produce corresponding vertical acceleration because the landing gear still carries part of the weight. The controller should avoid interpreting this condition as an ordinary altitude-tracking failure. Controlled thrust ramping, liftoff detection, estimator validity, and transition logic are needed before normal airborne altitude regulation assumes full authority.

Landing presents the opposite transition. The altitude controller must progressively reduce height while maintaining an appropriate descent profile, but near the surface the control objective shifts toward touchdown management. Radar or laser altitude measurements may become more important than global altitude references. Touchdown detection should prevent the controller from increasing thrust merely because the commanded altitude can no longer be reached after the landing gear has established ground contact.

Altitude-reference management must also distinguish among absolute altitude, altitude above ground level, and altitude relative to a mission reference. GNSS-derived height, barometric altitude, terrain-relative altitude, and local navigation-frame height do not represent identical quantities. The flight-control interface must define which reference is being controlled and ensure that reference transitions do not introduce sudden altitude errors or unintended climb and descent commands.

The controller should monitor its own operating condition through variables such as altitude error, vertical-speed error, commanded acceleration, thrust demand, saturation state, integral state, and available thrust margin. These values support flight monitoring and fault detection. Persistent altitude error combined with maximum thrust, for example, can indicate excessive payload, propulsion degradation, strong downdraft, or an incorrect vehicle-mass estimate rather than poor controller tuning alone.

Failure handling should preserve basic vertical stability whenever possible. Degraded altitude sensors, GNSS loss, propulsion faults, or unreliable vertical-velocity estimates may require switching to alternative state sources or restricting autonomous functions. The controller should expose validity and authority information to the flight-mode and safety systems so that they can select hover, controlled descent, return-to-home, or emergency-landing behavior according to the remaining capability.

Verification should evaluate the complete vertical-control chain rather than only nominal altitude tracking. Simulation and SIL/HIL testing can introduce payload variation, thrust-model error, sensor noise, delayed measurements, wind disturbances, actuator saturation, and propulsion degradation. Step and ramp altitude commands reveal transient response, while long hover tests expose steady-state drift, integral behavior, thermal effects, and sensitivity to changes in vehicle mass.

The altitude and vertical-speed controller ultimately acts as the vertical-motion bridge between mission-level trajectory objectives and physical propulsion. The altitude loop determines how vertical position error should become climb or descent motion, the vertical-speed loop converts that motion into acceleration and thrust demand, and feedforward compensation balances predictable forces such as gravity. Together with attitude stabilization and later position control, this structure provides the controlled three-dimensional motion required for reliable cargo-UAV operations.

03.05. Position and Velocity Controller Outer Loop [w/Code]

The position and velocity controller forms the outer translational layer of the cargo UAV flight-control hierarchy. Its purpose is to convert desired horizontal position or trajectory references into motion commands that the faster attitude controller can execute. Within the chapter structure, this function follows attitude and altitude control and precedes motor allocation, adaptive payload control, wind rejection, and flight-mode management, defining its role as the outer-loop bridge between navigation and stabilization.

The position loop compares the commanded horizontal position with the estimated vehicle position in a defined navigation frame. The resulting position error represents how far the aircraft is displaced from its target in each horizontal direction. Rather than converting this error directly into motor commands, the controller generates a desired velocity reference. This separation allows position convergence to be shaped independently from the fast rotational dynamics of the aircraft.

The velocity loop operates inside the position loop and compares the desired velocity with the estimated horizontal velocity. Velocity error is transformed into a commanded acceleration or equivalent horizontal force demand. The controller therefore creates a sequence from position error to velocity reference, from velocity error to acceleration demand, and finally from acceleration demand to the attitude and thrust commands required to move the vehicle.

For a multirotor aircraft, horizontal acceleration is generated primarily by tilting the total thrust vector. A forward acceleration command requires an appropriate pitch attitude, while lateral acceleration requires roll. The outer-loop controller must therefore translate desired acceleration expressed in the navigation frame into a desired thrust-vector orientation. The attitude controller then tracks this orientation using the faster roll, pitch, and angular-rate stabilization loops.

This architecture depends on clear bandwidth separation. The attitude and angular-rate loops must respond significantly faster than the velocity loop, while the position loop should normally be slower than velocity regulation. If the position controller is tuned too aggressively, it can command velocity or acceleration changes faster than the inner loops can reproduce them. The result may be overshoot, oscillation, actuator saturation, or poor trajectory tracking.

Position feedback normally originates from the navigation estimator rather than directly from a single sensor. GNSS may provide globally referenced position and velocity, while inertial measurements support high-rate propagation between GNSS updates. Other navigation sources can contribute when available. The outer controller should receive a continuous, time-consistent state estimate because sudden position jumps or velocity discontinuities can generate large and unnecessary acceleration commands.

A proportional position controller provides a simple relationship between position error and desired velocity. Larger displacement produces a larger velocity command, while the commanded speed decreases naturally as the aircraft approaches its target. Practical implementations limit this reference according to mission speed, flight envelope, obstacle environment, and vehicle capability. Additional shaping can prevent abrupt changes when waypoints or trajectory segments are switched.

The velocity controller can use proportional-integral or PID-like feedback to generate acceleration demand. Proportional action responds immediately to velocity error, while integral action compensates for persistent effects such as wind, propulsion asymmetry, or small modeling errors. Derivative or acceleration-related feedback may provide additional damping, but noisy velocity estimates require careful filtering so that high-frequency measurement noise is not converted into rapidly varying attitude commands.

Acceleration commands must be constrained before they are passed to the attitude-control layer. Excessive horizontal acceleration requires large tilt angles and consumes thrust that would otherwise support vehicle weight. Maximum acceleration, tilt angle, velocity, and command slew rate should therefore be coordinated. These limits become especially important for heavy cargo UAVs because structural loading, payload motion, propulsion margin, and stopping distance can impose tighter constraints than those of smaller vehicles.

The coupling between horizontal and vertical control cannot be ignored. When the aircraft tilts to accelerate horizontally, only part of its total thrust remains available to oppose gravity. The altitude controller may request additional collective thrust to preserve height, but propulsion capability is finite. The flight-control architecture must therefore coordinate horizontal acceleration demands with vertical thrust margin so that aggressive position tracking does not unintentionally produce altitude loss.

Cargo mass strongly influences translational response. A heavier aircraft requires greater force to achieve the same acceleration, while payload-dependent inertia and propulsion loading can change transient behavior. If the controller assumes an in...

原文:https://www.a8q9.cn/en/article/cargo-uav-autonomy-and-flight-ai-ch-03-flight-control-software-en-f77e4d.html

相关文章