DEV Community

Richard Minsoo Go
Richard Minsoo Go

Posted on

Autonomous Driving Software — Ch.08: Control Integration [EN]

STATERA Library · Series 08 · Volume 12 · Chapter 08 · EN
Source: https://github.com/Statera-Library/08_Vol_12_Autonomous_Driving_Software/blob/main/Chapter_08_Control_Integration/Chapter_08_Control_Integration_EN.md

Volume 12. Autonomous Driving Software

Chapter 08. Control Integration

08.01. AV Control Architecture Longitudinal Lateral Decoupled

Autonomous vehicle control architecture converts a planned trajectory into physical actuator commands that make the vehicle follow the desired path, speed, and motion profile. Within the autonomous driving software stack, control forms the final closed-loop stage between trajectory generation and vehicle actuation. It continuously compares planned motion with measured vehicle states and corrects deviations through steering, propulsion, and braking commands.

A widely used architectural approach separates vehicle motion control into longitudinal and lateral control channels. Longitudinal control governs motion along the vehicle's forward direction, primarily regulating velocity, acceleration, deceleration, stopping, and following distance. Lateral control governs motion perpendicular to the forward direction, primarily regulating steering angle, heading, curvature, and cross-track position relative to the planned trajectory.

This separation reflects the physical structure of conventional ground vehicles. Throttle or motor torque and braking forces primarily influence longitudinal dynamics, while steering primarily determines lateral motion and yaw behavior. By assigning these behaviors to independent controllers, developers can design, tune, test, and diagnose each control loop separately while maintaining a clearly defined interface between trajectory planning and low-level vehicle actuation.

The control pipeline typically receives a time-parameterized reference trajectory containing position, heading, curvature, velocity, and acceleration targets. Vehicle-state estimation supplies the corresponding measured or estimated states, including current position, orientation, velocity, yaw rate, steering state, and sometimes wheel speeds and acceleration. The controller calculates tracking errors and transforms them into commands that are sent toward the drive-by-wire or actuator-control layer.

Longitudinal control commonly operates on velocity and acceleration errors. A reference velocity from the trajectory is compared with the measured vehicle velocity, while feedforward terms may use the desired acceleration directly. Feedback algorithms such as PID compensate for disturbances and modeling errors, while more advanced controllers can incorporate vehicle dynamics, actuator constraints, road slope, payload variation, wheel slip, and predicted future states when generating propulsion or braking commands.

Lateral control attempts to minimize geometric and dynamic deviation from the reference path. Important variables include lateral position error, heading error, path curvature, steering angle, yaw rate, and vehicle speed. Simple systems may employ geometric controllers, while higher-performance systems often combine feedforward steering derived from reference curvature with feedback control based on measured tracking errors. MPC can explicitly optimize future lateral behavior under steering and stability constraints.

Although the two channels are described as decoupled, they are not physically independent. Vehicle speed strongly affects lateral dynamics because identical steering inputs produce different yaw responses at different velocities. Likewise, strong steering maneuvers may require longitudinal speed reduction to maintain stability, tire-force margins, and tracking accuracy. The architecture therefore separates controller responsibilities while preserving selected information exchange between the longitudinal and lateral control processes.

A practical implementation often uses trajectory velocity as an important coupling variable. The longitudinal controller attempts to track the requested speed profile, while the lateral controller uses current and predicted speed when calculating steering commands. The planner can reduce reference velocity before high-curvature segments, allowing lateral control to remain within feasible steering, acceleration, and tire-force limits without requiring the two controllers to become one monolithic algorithm.

Control performance depends strongly on timing. Localization, trajectory generation, state estimation, controller execution, communication, and actuator response all introduce latency. A controller operating on delayed vehicle states may generate commands appropriate for a past condition rather than the current one. Production architectures therefore require timestamped data, deterministic execution where necessary, latency monitoring, state prediction, and explicit treatment of command and actuator delays.

Different control loops may also operate at different frequencies. Vehicle-state estimation and low-level control can execute much faster than behavior planning or trajectory generation because actuator regulation requires rapid feedback. The controller normally tracks the latest valid trajectory between planning updates and continuously evaluates whether that trajectory remains usable. Missing, stale, discontinuous, or invalid references must be detected rather than blindly converted into actuator commands.

The actuator interface provides another important architectural boundary. High-level control algorithms should preferably generate normalized or physically meaningful targets such as desired acceleration, steering angle, steering rate, wheel torque, or braking demand rather than directly depending on hardware-specific messages. A vehicle interface or hardware abstraction layer then translates these targets into CAN, Ethernet, or drive-by-wire commands appropriate for the specific vehicle platform.

This abstraction is especially valuable for autonomous mobile robots and multi-platform autonomy software. Different platforms may use Ackermann steering, differential drive, four-wheel steering, independent wheel motors, or other configurations, yet much of the upstream autonomy stack can remain unchanged. Platform-specific conversion, actuator calibration, saturation limits, and communication protocols can be isolated near the hardware interface instead of propagating through the planning and control software.

Longitudinal and lateral commands must pass through constraint handling before reaching actuators. Steering angle and steering rate are bounded by mechanical limits, while propulsion and braking commands are restricted by motor capability, battery condition, tire-road interaction, payload, and safety requirements. Acceleration, deceleration, jerk, and lateral acceleration constraints also protect passengers, cargo, mechanical components, and tracking stability from unnecessarily aggressive control actions.

Command arbitration becomes necessary when several software components can request vehicle motion. Normal trajectory tracking, emergency braking, remote operation, manual takeover, traction control, and safety supervision may all influence actuation. The architecture must define deterministic priorities so that safety-related interventions can override nominal controller outputs. Arbitration should occur through explicit interfaces rather than through uncontrolled modification of commands inside unrelated software modules.

Failure handling is therefore part of control integration rather than an external feature. Invalid localization, excessive tracking error, actuator communication loss, stale trajectories, controller timeout, or inconsistent vehicle feedback can make normal closed-loop control unreliable. Supervisory logic monitors these conditions and can transition the vehicle toward controlled deceleration, emergency stopping, degraded operation, or another predefined safe behavior according to the system-level safety strategy.

Outdoor AMRs introduce additional challenges because their operating conditions vary more dramatically than those of vehicles restricted to smooth paved roads. Loose gravel, wet surfaces, slopes, curbs, uneven terrain, payload changes, and wheel slip can alter both longitudinal and lateral responses. A nominally decoupled architecture remains useful, but estimated terrain properties, traction conditions, payload state, and stability constraints may need to influence controller parameters and feasible command limits.

At low speed, AMRs can often tolerate simpler vehicle models, but precision requirements around docking, narrow passages, infrastructure, or pedestrians may make centimeter-scale tracking errors important. At higher speed, dynamic effects become increasingly significant and purely geometric assumptions become less reliable. Controller design should therefore reflect the operating envelope rather than assuming that a single control formulation provides equivalent performance across all speeds and terrain conditions.

Trajectory generation and control must share consistent definitions of coordinate frames, curvature, velocity sign, acceleration, timestamps, and vehicle reference points. A mathematically correct controller can fail when the planner and controller interpret these quantities differently. Interface contracts should specify units, coordinate conventions, valid ranges, update rates, time bases, and failure semantics so that integration behavior remains predictable across software modules and vehicle platforms.

The chapter structure places this architecture before detailed lateral PID/MPC control, longitudinal speed and acceleration control, feedforward control, drive-by-wire integration, latency compensation, traction management, emergency override logic, HIL testing, and outdoor AMR tuning. This progression treats decoupled control architecture as the integration framework within which those specialized mechanisms operate.

Ultimately, longitudinal-lateral decoupling is an architectural decomposition rather than a claim that vehicle dynamics are fully separable. Its value lies in modularity, understandable interfaces, independent tuning, fault isolation, and reusable software components. Robust autonomous driving systems preserve these advantages while explicitly managing the physical coupling created by speed, curvature, tire forces, terrain, actuator limits, latency, and safety interventions.

A mature control architecture therefore combines separate longitudinal and lateral feedback loops with shared state estimation, trajectory information, constraint management, actuator abstraction, command arbitration, and safety supervision. The resulting closed-loop system connects planning intent to physical vehicle behavior while providing clear boundaries for verification, calibration, hardware adaptation, and future controller upgrades across autonomous vehicles and outdoor AMR platforms.

08.02. PID and MPC Based Lateral Control [w/Code]

Lateral control is responsible for steering an autonomous vehicle so that its position and orientation remain aligned with a reference path or trajectory. The controller continuously evaluates lateral displacement, heading difference, curvature, steering state, and vehicle motion, then generates steering commands that reduce tracking error. PID and Model Predictive Control represent two important approaches for implementing this closed-loop lateral-control function.

The lateral-control process begins with a reference trajectory supplied by the trajectory-generation module. Each trajectory point may contain position, heading, curvature, velocity, and time information. Vehicle-state estimation provides the corresponding current pose, velocity, yaw rate, and steering state. These two information streams are compared in a consistent coordinate frame to determine how far the vehicle has deviated from the desired geometric and dynamic motion.

Lateral error is commonly defined as the perpendicular distance between a selected vehicle reference point and the desired path. Heading error represents the angular difference between the vehicle orientation and the tangent direction of the reference path. These errors describe complementary aspects of path deviation. A vehicle may be close to the path but incorrectly oriented, or correctly oriented while displaced laterally, so effective control normally considers both quantities.

A Proportional-Integral-Derivative controller provides a relatively simple feedback mechanism for correcting lateral tracking errors. The proportional term responds directly to the current error, producing stronger correction as deviation increases. The integral term accumulates persistent error and can compensate for systematic bias. The derivative term reacts to the rate of error change and can improve damping by suppressing excessive oscillation or rapidly developing deviation.

Applying PID to lateral control requires careful definition of the controlled error. A controller may operate primarily on lateral error, heading error, or a weighted combination of both. In practical implementations, steering commands can also include a feedforward component calculated from reference-path curvature. Feedforward anticipates the steering required for the upcoming road geometry, while PID feedback corrects residual errors caused by disturbances, uncertainty, and imperfect vehicle modeling.

PID performance depends heavily on gain tuning. Excessive proportional gain can cause oscillatory steering, while insufficient gain produces slow correction and large tracking errors. Strong integral action may remove steady-state bias but can create integral windup when steering reaches physical limits. Excessive derivative action can amplify measurement noise. Anti-windup, derivative filtering, steering-rate limitation, and gain scheduling are therefore important additions to production implementations.

Vehicle speed is especially important because lateral dynamics vary considerably across the operating range. PID gains that provide smooth tracking at low speed may produce oscillation or instability at higher speed, while conservative high-speed gains may respond too slowly during precise low-speed maneuvering. Gain scheduling can select or interpolate controller parameters according to velocity, curvature, payload, surface condition, or other operating variables.

Model Predictive Control approaches lateral tracking as a constrained optimization problem. Instead of reacting only to current tracking errors, MPC uses a mathematical vehicle model to predict future states across a finite prediction horizon. It then determines a sequence of steering actions that minimizes a cost function while respecting defined constraints. Only the first optimized command is applied, and the optimization is repeated when new state information becomes available.

The prediction model may range from a simple kinematic bicycle model to a more detailed dynamic model that includes lateral velocity, yaw dynamics, tire behavior, and steering actuator characteristics. Kinematic models are computationally efficient and often suitable for low-speed operation. Dynamic models become increasingly useful as speed rises and inertial and tire-force effects become significant, although they require more parameters and greater computational effort.

An MPC cost function typically penalizes predicted lateral error, heading error, steering effort, and rapid steering changes. Additional terms can discourage yaw-rate deviation, excessive lateral acceleration, or other undesirable behavior. The relative weights determine how aggressively the controller prioritizes path accuracy, smoothness, stability, and actuator usage. Controller tuning therefore becomes an optimization-design problem rather than the direct adjustment of a small set of feedback gains.

One major advantage of MPC is its ability to incorporate constraints explicitly. Steering angle, steering rate, lateral acceleration, yaw response, and other physical or safety-related quantities can be bounded during optimization. This allows the controller to search for feasible steering actions rather than calculating an unconstrained command and clipping it afterward. Constraint-aware prediction becomes particularly valuable near tight curves or at elevated vehicle speeds.

MPC also provides a natural mechanism for using future trajectory information. Because the reference path across the prediction horizon is known, the controller can anticipate upcoming curvature instead of waiting for a tracking error to develop. This predictive capability can reduce phase lag and improve smoothness through transitions between straight and curved segments. Accurate trajectory timing and sufficiently reliable vehicle-state prediction are important for realizing this benefit.

The advantages of prediction come with computational requirements. The optimization problem must be solved repeatedly within the control cycle, and execution time must remain bounded enough for real-time operation. Prediction-horizon length, model complexity, optimization method, constraint count, and processor capability influence latency. A theoretically superior controller may perform poorly if its steering command arrives too late for the vehicle state on which the optimization was based.

PID and MPC therefore represent different engineering trade-offs rather than universally superior and inferior solutions. PID offers simplicity, low computational cost, straightforward implementation, and relatively easy debugging. MPC offers explicit prediction, multivariable optimization, and systematic constraint handling. Platform characteristics, speed range, tracking requirements, processor resources, actuator dynamics, and safety requirements determine which approach is more appropriate for a particular autonomous vehicle or AMR.

Hybrid implementations can combine useful properties of both methods. Curvature-based feedforward may provide the nominal steering demand, while PID supplies rapid feedback correction. MPC may operate as the primary trajectory-tracking controller while a simpler fallback controller remains available if optimization fails or exceeds its execution deadline. Such architectural separation can improve robustness while preserving advanced control capability during normal operation.

Steering actuator dynamics must be included in practical controller integration. The requested steering angle is not achieved instantaneously because mechanical, electrical, hydraulic, communication, and software delays may exist between command generation and wheel response. Steering rate limits and actuator lag can produce significant tracking error if ignored. Controller models, feedforward terms, or predictive compensation can account for these effects before commands reach the drive-by-wire interface.

State quality is equally important. Localization noise directly affects lateral-error estimation, while orientation uncertainty influences heading error. Delayed velocity or yaw-rate measurements can distort dynamic feedback and prediction. Filtering can reduce noise but also introduces additional delay, creating a trade-off between signal smoothness and responsiveness. Timestamp consistency and synchronized state estimation are therefore fundamental requirements for reliable lateral control.

Outdoor AMRs add terrain-related disturbances that are less prominent in ideal road environments. Uneven surfaces, cross slopes, loose gravel, wet pavement, wheel slip, payload variation, and tire deformation can change the relationship between steering command and actual vehicle motion. PID gain scheduling or MPC model adaptation can compensate for part of this variability, while traction and stability information can further constrain steering behavior under reduced-friction conditions.

Low-speed precision and higher-speed stability create different control priorities. During docking or narrow-path operation, centimeter-level lateral accuracy and smooth steering may dominate the objective. At higher speed, yaw stability, steering-rate limits, lateral acceleration, and prediction accuracy become increasingly important. A production controller may therefore modify gains, model parameters, optimization weights, constraints, or even control modes as the operating condition changes.

Safety supervision remains outside the nominal optimization or feedback calculation but must have authority over its output. Excessive lateral error, implausible steering commands, localization failure, stale trajectory data, actuator faults, or controller timeout should be detected independently. The supervisory layer can restrict steering commands, request speed reduction, switch controllers, or initiate a minimal-risk maneuver when normal path tracking can no longer be trusted.

Validation should evaluate more than average path-tracking accuracy. Maximum lateral error, heading error, steering smoothness, steering-rate utilization, oscillation, settling behavior, lateral acceleration, computation time, and robustness against disturbances are relevant measures. Testing should span straight paths, curves, curvature transitions, speed changes, localization noise, actuator delays, surface variations, and other conditions representative of the intended operational design domain.

PID and MPC based lateral control ultimately serve the same system objective: converting a planned geometric trajectory into stable, feasible, and timely steering behavior. PID achieves this primarily through error-driven feedback, while MPC combines prediction, optimization, and explicit constraints. Their successful deployment depends not only on controller mathematics but also on accurate state estimation, trajectory consistency, actuator modeling, deterministic timing, safety supervision, and systematic vehicle-level tuning.

08.03. Longitudinal Speed and Acceleration Control [w/Code]

Longitudinal control governs the forward motion of an autonomous vehicle by regulating speed, acceleration, deceleration, and stopping behavior along the planned trajectory. It converts the velocity and acceleration targets generated by trajectory planning into propulsion and braking commands. The controller operates continuously as a closed loop, comparing desired motion with measured vehicle states and correcting deviations caused by disturbances, actuator dynamics, road conditions, and modeling uncertainty.

The primary reference for longitudinal control is usually a time-parameterized speed profile associated with the planned trajectory. Each trajectory point can specify desired velocity, acceleration, position, and time, allowing the controller to understand not only how fast the vehicle should move but also how that speed should evolve. Vehicle-state estimation supplies current velocity, acceleration, wheel speed, and other measurements required to calculate tracking errors.

Speed error is defined as the difference between reference velocity and measured vehicle velocity. A positive error generally indicates that additional propulsion is required, while a negative error indicates that propulsion should be reduced or braking may be necessary. Acceleration error provides another dynamic measure by comparing desired and actual acceleration. Using both variables enables the controller to regulate steady-state speed while responding effectively to transient changes in the trajectory.

A basic longitudinal controller can use proportional-integral-derivative feedback. The proportional term reacts to current speed error, the integral term compensates for persistent bias such as rolling resistance or small calibration errors, and the derivative term provides damping against rapid changes. In practical vehicle systems, PID output is normally combined with feedforward control, actuator limits, filtering, and mode-dependent logic rather than being sent directly to propulsion hardware.

Acceleration feedforward improves responsiveness by using the acceleration requested by the trajectory planner before a significant speed error develops. If the trajectory requests acceleration, the feedforward path can immediately generate an estimated propulsion demand. During planned deceleration, it can similarly anticipate braking requirements. Feedback then compensates for errors caused by uncertain mass, road gradient, aerodynamic drag, rolling resistance, motor characteristics, and other disturbances.

The relationship between requested acceleration and actuator command is highly platform dependent. Electric vehicles may regulate motor torque directly, while other platforms may expose throttle percentage, wheel torque, acceleration demand, or normalized propulsion commands. Braking can similarly be represented by brake pressure, regenerative torque, deceleration demand, or normalized brake commands. A vehicle interface should isolate these hardware-specific details from the high-level longitudinal controller.

Longitudinal control must coordinate propulsion and braking so that contradictory commands are avoided. A command-arbitration or pedal-mapping layer can determine whether positive acceleration should activate propulsion, whether negative acceleration can be satisfied by regenerative braking, and when mechanical braking must be added. Transition regions require careful calibration because abrupt switching between propulsion and braking can produce jerk, oscillation, reduced comfort, and unstable low-speed behavior.

Acceleration and jerk constraints are fundamental to longitudinal-control quality. Even when a vehicle can physically generate strong acceleration or braking, unrestricted commands may create uncomfortable motion, payload movement, wheel slip, mechanical stress, or unstable interaction with lateral control. Limiting acceleration and the rate of acceleration change allows speed transitions to remain smooth while respecting the motion profile assumed by trajectory generation.

Stopping behavior requires particular attention because conventional speed feedback becomes difficult near zero velocity. Sensor quantization, drivetrain dead zones, brake hysteresis, static friction, and small localization errors can cause oscillation or creeping around the stopping point. Practical controllers therefore introduce dedicated stopping logic that transitions from normal speed tracking to controlled deceleration, final-stop control, brake hold, and standstill confirmation.

Precise stopping is especially important for autonomous mobile robots operating near docking stations, loading points, inspection locations, gates, or infrastructure. The controller may combine velocity regulation with remaining-distance information so that deceleration is adjusted according to both speed and distance to the target. This prevents a vehicle from tracking a nominal velocity profile correctly while still overshooting the intended physical stopping position.

Road gradient produces a major disturbance in longitudinal motion. On an uphill segment, additional propulsion is required to maintain the same acceleration, whereas downhill operation may require reduced propulsion or active braking. If slope information is available from maps, localization, IMU measurements, or terrain estimation, gravitational effects can be incorporated into feedforward control. Feedback remains responsible for correcting residual model and measurement errors.

Vehicle mass and payload also influence longitudinal response. The same motor torque produces different acceleration when vehicle mass changes, which is particularly relevant for logistics AMRs carrying variable payloads. Fixed controller gains or feedforward maps calibrated for an unloaded vehicle may perform poorly under maximum load. Gain scheduling, mass estimation, adaptive parameters, or model-based control can maintain more consistent performance across changing payload conditions.

Wheel slip introduces another limitation because commanded torque does not always translate directly into longitudinal acceleration. Loose gravel, wet pavement, snow, mud, steep slopes, or uneven terrain can reduce available tire-road friction. Wheel-speed measurements, inertial acceleration, and vehicle velocity estimates can reveal abnormal slip. The longitudinal controller can then reduce propulsion or braking demand in coordination with traction-control and stability functions.

Longitudinal and lateral control are architecturally separated but remain physically coupled. High speed increases the lateral acceleration required to follow a curved path, while strong longitudinal acceleration or braking consumes part of the available tire-force capacity. The trajectory planner can therefore reduce reference speed before high-curvature regions, while control supervision can further restrict acceleration when steering demand, stability limits, or estimated surface friction indicate reduced margins.

Control latency directly affects speed-tracking performance. State estimation, trajectory communication, controller execution, vehicle-network transmission, motor control, and braking hardware all contribute delay between a physical state change and the resulting actuator response. If this delay becomes significant, feedback based only on current measured error may respond too late. State prediction, command prediction, actuator models, and latency compensation can improve performance under such conditions.

The longitudinal controller may operate through several control modes rather than a single continuous algorithm. Normal speed tracking, acceleration tracking, approach-to-stop, standstill hold, emergency braking, degraded operation, and manual or remote override can require different logic. Explicit mode management prevents conflicting behaviors and defines clear transition conditions, command priorities, controller initialization, and recovery behavior across the complete operating sequence.

Safety supervision must independently monitor longitudinal commands and vehicle responses. Excessive acceleration, unexpected vehicle motion, brake failure, actuator communication loss, stale trajectory data, controller timeout, or large speed-tracking error can indicate that nominal control is no longer reliable. Safety logic can limit propulsion, request controlled deceleration, apply emergency braking, or transition the system toward a predefined minimal-risk condition.

Outdoor AMRs create particularly demanding longitudinal-control conditions because speed can range from centimeter-per-second precision motion to substantially faster outdoor travel. Terrain slope, payload, tire deformation, surface friction, battery voltage, motor temperature, and environmental conditions may change during operation. Controller parameters and actuator mappings should therefore be validated across the full operating envelope rather than optimized only for a nominal flat-surface condition.

Electric AMRs also benefit from considering energy efficiency during longitudinal control. Aggressive acceleration increases peak power demand and may reduce operating range, while properly coordinated regenerative braking can recover part of the kinetic energy during deceleration. Energy-aware trajectory planning and longitudinal control can balance travel time, smoothness, battery consumption, motor thermal limits, and regenerative capability without compromising required safety behavior.

Validation should measure more than average speed-tracking error. Relevant metrics include maximum velocity error, acceleration error, stopping-distance error, overshoot, settling time, jerk, command smoothness, propulsion-to-brake transition behavior, computation latency, and robustness against payload or slope changes. Tests should include acceleration, constant-speed travel, gradual and emergency deceleration, stop-and-go operation, slopes, low-friction surfaces, and actuator-delay conditions.

Hardware-in-the-loop testing can evaluate longitudinal-control software before extensive vehicle deployment. A simulated vehicle model can respond to real controller commands while reproducing drivetrain dynamics, brake delays, slopes, payload variation, wheel slip, sensor noise, and communication faults. This enables repeatable examination of normal and abnormal conditions and provides a controlled environment for tuning command limits, transitions, safety monitors, and fault-handling behavior.

Longitudinal speed and acceleration control ultimately connects the motion requested by trajectory generation with the propulsion and braking capabilities of the physical vehicle. Reliable performance requires more than minimizing instantaneous speed error. It requires coordinated feedback and feedforward control, smooth actuator arbitration, accurate state information, latency management, stopping logic, constraint enforcement, traction awareness, safety supervision, and systematic tuning across the complete operational design domain.

08.04. Vehicle Model Based Feedforward Control [w/Code]

Vehicle model based feedforward control improves trajectory tracking by predicting the actuator command required to produce a desired vehicle motion before a tracking error develops. Unlike feedback control, which reacts to differences between reference and measured states, feedforward uses a mathematical representation of vehicle behavior together with trajectory information. The predicted command provides a nominal control action, while feedback compensates for modeling errors and external disturbances.

The fundamental idea is to invert an approximate vehicle model. If the desired curvature, velocity, acceleration, or yaw response is known from the planned trajectory, the controller estimates the steering, propulsion, or braking input that should generate that motion. This approach reduces the burden placed on feedback control because the controller does not need to wait for significant position, heading, speed, or acceleration errors before producing an appropriate actuator response.

For lateral control, reference-path curvature provides a direct source of feedforward information. A geometric vehicle model can convert desired curvature into a nominal steering angle according to wheelbase and steering geometry. For a simple bicycle representation, this relationship captures the steering required for ideal path following under low-speed conditions. Feedback control then corrects residual lateral and heading errors caused by disturbances and imperfect modeling.

At higher speeds, a purely geometric relationship may become insufficient because lateral tire forces, yaw dynamics, vehicle mass distribution, and velocity influence steering response. A dynamic bicycle model can extend feedforward calculation by representing sideslip, yaw rate, cornering stiffness, axle geometry, and inertial properties. The resulting steering command can anticipate speed-dependent understeer or other dynamic effects rather than relying entirely on feedback correction after deviation occurs.

Longitudinal feedforward follows a similar principle. The desired acceleration from the trajectory can be transformed into the propulsion or braking force required to produce that acceleration. A basic model begins with vehicle mass and Newtonian force balance, while more complete formulations include rolling resistance, aerodynamic drag, road gradient, drivetrain efficiency, and rotating components. The estimated force is then converted into motor torque, throttle, or braking demand.

Road slope is particularly important for model-based longitudinal control. A vehicle climbing a gradient requires additional force to counteract gravity, while a descending vehicle may require less propulsion or active braking. When reliable slope information is available from maps, localization, IMU measurements, or terrain estimation, gravitational compensation can be included directly in the feedforward term before speed error appears.

Aerodynamic drag and rolling resistance become increasingly relevant as operating speed and vehicle size increase. Aerodynamic force generally grows strongly with velocity, while rolling resistance depends on vehicle weight, tires, and surface conditions. Incorporating these effects into the model improves the relationship between desired acceleration and requested propulsion. For low-speed AMRs, aerodynamic effects may be minor, whereas rolling resistance and terrain properties can remain significant.

Vehicle mass is another critical parameter because the same propulsion force produces different acceleration under different loading conditions. Logistics and industrial AMRs may experience large payload variations between missions. A feedforward model calibrated for an unloaded platform can therefore underestimate the required torque when heavily loaded. Payload information, online mass estimation, or adaptive model parameters can improve consistency across the operational range.

Feedforward and feedback control should normally operate together rather than as competing alternatives. Feedforward generates the command predicted from the desired motion and vehicle model, while feedback calculates an additional correction from observed tracking errors. The final actuator request can combine both contributions before constraint handling and command arbitration. This architecture provides fast anticipatory response while retaining robustness against uncertainty.

The relative importance of the two components depends on model quality. When the vehicle model accurately represents current operating conditions, feedforward can supply most of the nominal command and feedback corrections remain relatively small. When model parameters are inaccurate because of payload changes, tire behavior, terrain, temperature, wear, or actuator variation, feedback becomes increasingly important. Robust design therefore assumes that the model will always contain some uncertainty.

Model complexity should be selected according to the operating domain rather than maximized without purpose. A simple kinematic model can provide effective steering feedforward for low-speed operation with limited computation and calibration effort. Higher-speed vehicles may benefit from dynamic models, while off-road platforms may require additional representations of slip and terrain interaction. Increasing complexity is useful only when the additional states and parameters can be estimated with sufficient reliability.

Actuator models can also be incorporated into feedforward control. Steering mechanisms, motors, brakes, and drive-by-wire systems may exhibit gain, delay, dead zones, saturation, hysteresis, or rate limits. If these characteristics are known, the controller can compensate for predictable actuator behavior when generating commands. This prevents the vehicle model from assuming that requested steering angle, torque, or braking force is reproduced instantaneously and exactly.

Latency compensation is closely related to model-based feedforward control. By the time a command reaches an actuator, the vehicle may have moved beyond the state used for its calculation. A predictive model can estimate the vehicle state at the expected actuation time and calculate the command for that future condition. Such compensation becomes increasingly important as vehicle speed, network delay, actuator lag, or control-system distribution increases.

Model parameters are commonly obtained from design data, CAD information, component specifications, system identification, or vehicle testing. Wheelbase and mass may be measured directly, while cornering stiffness, actuator time constants, rolling resistance, or drivetrain efficiency often require experimental estimation. Parameter identification should cover representative operating conditions because values obtained from a single test condition may not remain accurate across the entire operational design domain.

Adaptive feedforward control can update selected model parameters as the vehicle operates. Observed relationships between commands and measured responses can reveal changes in effective mass, actuator gain, rolling resistance, or steering characteristics. Slowly varying parameters may be estimated online and incorporated into subsequent feedforward calculations. Adaptation should remain bounded and supervised so that sensor faults or unusual disturbances do not produce unsafe model updates.

For outdoor AMRs, terrain-dependent modeling can significantly improve feedforward performance. Pavement, gravel, grass, compacted soil, slopes, and uneven surfaces can produce different resistance and slip characteristics. Terrain classification or traversability estimation may therefore provide context for selecting model parameters. The controller can adjust propulsion compensation, steering prediction, acceleration limits, or expected actuator response according to the estimated surface condition.

Feedforward control must respect the same physical and safety constraints as feedback control. A mathematically predicted steering or torque command may exceed actuator capability or stability limits. Steering angle, steering rate, motor torque, braking force, acceleration, jerk, lateral acceleration, and traction limits should therefore be applied to the combined control request. Safety supervision must retain authority to restrict or override model-generated commands.

Failure detection is particularly important because an incorrect model can produce plausible but systematically wrong commands. Persistent disagreement between predicted and measured vehicle response can indicate parameter drift, payload mismatch, actuator degradation, unexpected terrain, or sensor problems. Monitoring model residuals provides a useful diagnostic signal and can trigger parameter adaptation, increased feedback authority, degraded operation, or fallback control.

Simulation provides an efficient environment for developing model-based feedforward algorithms. Vehicle parameters and environmental conditions can be changed systematically while measuring tracking error, control effort, sensitivity, and robustness. Parameter sweeps can reveal where a simplified model remains adequate and where additional dynamics become necessary. Simulation can also introduce slope, payload, actuator delay, friction changes, and modeling errors in a repeatable manner.

Hardware-in-the-loop testing extends this process by executing the real control software against a real-time vehicle model and representative communication interfaces. Steering and longitudinal feedforward calculations can be evaluated with simulated actuator dynamics, sensor delays, CAN communication, payload variation, and terrain disturbances. This allows timing, interface behavior, saturation handling, and safety logic to be verified before extensive physical-vehicle testing.

Vehicle testing remains necessary because real systems contain effects that are difficult to model completely. Tire deformation, mechanical compliance, drivetrain backlash, changing friction, component temperature, surface irregularity, and structural vibration can influence control response. Logged trajectory, state, actuator, and timing data can be compared with model predictions to identify systematic residuals and refine parameters or model structure.

Validation should compare feedforward-plus-feedback control against feedback-only operation across representative scenarios. Useful measures include lateral and longitudinal tracking error, phase lag, steering effort, propulsion and braking smoothness, overshoot, settling behavior, actuator saturation, computation time, and sensitivity to parameter uncertainty. The objective is not merely to improve nominal accuracy but to demonstrate predictable behavior across realistic operating variations.

Vehicle model based feedforward control ultimately provides a predictive bridge between planned motion and physical actuation. By converting desired curvature, velocity, and acceleration into nominal steering, propulsion, and braking commands, it reduces dependence on reactive error correction. Combined with robust feedback, parameter adaptation, actuator modeling, constraint enforcement, latency compensation, and safety supervision, it enables smoother and more accurate trajectory tracking across autonomous vehicles and outdoor AMRs.

08.05. Drive by Wire Interface CAN ROS2 Bridge [w/Code]

A drive-by-wire interface provides the software boundary between autonomous vehicle control algorithms and the physical systems responsible for steering, propulsion, and braking. Instead of allowing high-level autonomy modules to directly manipulate vehicle hardware, the interface converts standardized control requests into platform-specific actuator commands. In an autonomous driving architecture, this boundary is particularly important because trajectory tracking, safety supervision, and vehicle hardware operate at different abstraction levels.

The control layer typically produces commands such as desired steering angle, steering rate, acceleration, wheel torque, propulsion demand, or braking demand. These commands must be transferred reliably to the vehicle controller through an appropriate communication interface. CAN is widely used for vehicle control because it provides deterministic message arbitration, compact frames, error detection, and established automotive communication mechanisms. The drive-by-wire interface translates high-level commands into the message identifiers, signals, scaling factors, and timing requirements defined by the target vehicle.

ROS2 provides a different communication abstraction for robotics software. Controllers and autonomy modules can exchange typed messages through ROS2 topics, services, or actions without directly depending on the underlying vehicle network. A ROS2-to-CAN bridge can therefore connect the robotics software layer to the vehicle\'s CAN interface. The bridge receives ROS2 control messages, validates and converts their values, constructs the appropriate CAN frames, and transmits them to the vehicle controller while returning relevant vehicle-state information to ROS2.

The bridge should be treated as an explicit architectural component rather than as simple message conversion code. It is responsible for maintaining a well-defined contract between the ROS2 domain and the vehicle network domain. This contract should specify message names, data types, units, coordinate conventions, valid ranges, timestamps, update rates, timeout behavior, and failure semantics. Clear separation of these responsibilities makes the system easier to test, replace, port to another platform, and diagnose when integration problems occur.

Command conversion requires careful attention to units and numerical scaling. A ROS2 controller may express steering in radians, acceleration in meters per second squared, or wheel speed in radians per second, while a CAN signal may use an integer representation with a specified offset, resolution, and physical range. Incorrect scaling can produce commands that appear syntactically valid but result in physically incorrect vehicle behavior. Conversion functions should therefore be explicit, bounded, version-controlled, and independently testable.

CAN communication introduces its own timing and reliability considerations. Each control signal may have a required transmission period, message priority, timeout interval, and counter or checksum mechanism. The bridge must ensure that required messages are transmitted at the expected rate and that stale commands are not repeatedly propagated to the vehicle. Communication errors, missing acknowledgments where applicable, invalid frames, bus-off conditions, and unexpected message timing should be detected and reported to higher-level supervision.

A robust architecture separates command generation from command transmission. The longitudinal and lateral controllers determine what the vehicle should do, while the drive-by-wire interface determines how that request is represented on the target vehicle network. This separation prevents vehicle-specific CAN identifiers and signal encoding from spreading throughout the autonomy software. The same controller can therefore be reused across multiple platforms when only the vehicle-interface configuration or adapter layer changes.

The reverse direction is equally important. The vehicle controller provides feedback such as actual steering angle, wheel speed, vehicle velocity, acceleration, brake state, motor state, and diagnostic information. The bridge converts these CAN signals into ROS2 messages with consistent units and timestamps. This feedback becomes part of the closed-loop control system and allows controllers and safety monitors to determine whether the commanded vehicle behavior is actually being achieved.

Timestamp handling is essential when ROS2 and CAN operate on different timing domains. A message may be generated by a controller at one time, transmitted through the bridge later, received by a vehicle controller after another delay, and measured by a sensor at yet another time. The interface should preserve available timestamps and distinguish message-generation time from reception time where necessary. This information supports latency measurement, state estimation, synchronization, and diagnosis of delayed control behavior.

The bridge should also enforce command validity before transmission. Steering angle, steering rate, acceleration, propulsion, and braking requests should be checked against configured physical and software limits. NaN values, infinities, stale timestamps, missing fields, invalid enumerations, and unexpected numerical ranges should not be forwarded to the vehicle. Validation at this boundary provides an additional defense against software defects and corrupted messages originating elsewhere in the autonomy stack.

Timeout handling is particularly important for safety. If the bridge stops receiving valid control commands, it should not continue transmitting the last command indefinitely. Depending on the vehicle architecture, the interface may issue a neutral command, controlled deceleration request, brake request, or another predefined safe response. The exact behavior must be defined by the vehicle\'s safety architecture rather than assumed by the bridge. A heartbeat or watchdog mechanism can also detect whether the upstream controller and communication path remain operational.

ROS2 Quality of Service settings should be selected according to the characteristics of the control data. High-rate control commands generally require different communication behavior from configuration data, diagnostics, or low-frequency status information. Reliability, durability, queue depth, and deadline-related behavior can affect how messages are delivered. The bridge should avoid unnecessary buffering because excessive queueing can increase control latency and cause an actuator to respond to an outdated command.

Real-time considerations become increasingly important as control frequency and vehicle speed increase. ROS2 message handling, serialization, executor scheduling, operating-system scheduling, CAN transmission, and actuator response all contribute to the end-to-end control loop. The bridge should therefore minimize unnecessary processing, avoid uncontrolled blocking, and provide measurable timing behavior. Where strict timing is required, real-time capable execution and appropriate operating-system configuration may be necessary.

Safety supervision should remain capable of overriding or restricting commands generated through the normal ROS2-to-CAN path. An emergency stop, safety controller, remote operator, or independent watchdog may need to disable propulsion or apply braking even when the primary autonomy process continues operating. The architecture should define command priorities and arbitration behavior explicitly so that a normal trajectory-tracking command cannot unintentionally defeat a higher-priority safety intervention.

Platform adaptation is another major function of the interface architecture. Two vehicles may use different CAN databases, signal names, scaling rules, steering conventions, motor interfaces, and braking mechanisms while exposing similar high-level control semantics. A vehicle-specific adapter can isolate these differences. This allows the ROS2 autonomy stack to operate with a stable internal command interface while the adapter maps those commands to the particular hardware configuration.

For AMRs, the same concept can be extended beyond conventional automotive drive-by-wire systems. An outdoor AMR may use independent wheel motors, differential drive, Ackermann steering, four-wheel steering, or other configurations. The ROS2 control interface can maintain platform-independent motion semantics, while the lower-level adapter converts those commands into wheel torque, steering actuator, motor-controller, or brake commands. This is particularly useful when one autonomy software architecture must support multiple robot platforms.

Diagnostics should be treated as a first-class part of the bridge. Communication state, CAN bus errors, message age, command frequency, actuator feedback, conversion failures, watchdog state, and safety overrides should be observable through structured diagnostic information. Logging should preserve sufficient information to reconstruct command flow and timing after a field incident. Such observability is essential for distinguishing autonomy-controller problems from communication, actuator, or vehicle-interface problems.

Configuration management is also important because CAN mappings and vehicle parameters may change between platforms or software versions. Message identifiers, signal definitions, scaling factors, limits, timeout values, and control modes should be version-controlled rather than hidden inside application code. A controlled configuration approach reduces integration errors and makes it possible to reproduce a known vehicle-interface configuration during testing, deployment, and field maintenance.

Testing should begin at the message-conversion level before connecting the interface to a physical vehicle. Unit tests can verify scaling, saturation, sign conventions, coordinate transformations, invalid-value handling, and timeout logic. Interface tests can then verify ROS2 message exchange and CAN frame construction. Simulated CAN traffic and software-in-the-loop environments provide a controlled way to test normal and abnormal communication behavior without exposing vehicle hardware to incorrect commands.

Hardware-in-the-loop testing can subsequently connect the real bridge and controller software to a simulated vehicle or representative CAN environment. This allows message timing, watchdog behavior, actuator feedback, command limits, communication failures, and safety overrides to be exercised under repeatable conditions. Physical vehicle testing should then proceed with controlled operating conditions and clearly defined emergency intervention mechanisms.

The ROS2-to-CAN drive-by-wire bridge ultimately serves as a controlled boundary between high-level autonomous intelligence and physical vehicle actuation. Its purpose is not simply to translate messages but to preserve semantics, timing, validity, safety, diagnostics, and platform independence across two different software and communication domains. A well-designed interface allows trajectory and control algorithms to evolve independently from vehicle-specific hardware while maintaining predictable and testable actuator behavior.

For autonomous vehicles and outdoor AMRs, this architecture establishes a reusable integration pattern: control algorithms generate platform-independent motion requests, ROS2 transports those requests within the robotics software architecture, the bridge validates and translates them, CAN or another vehicle network carries the commands, and the vehicle returns measured states through the same boundary. Closed-loop feedback, timing management, watchdogs, safety arbitration, diagnostics, and systematic HIL and vehicle testing complete the interface required for reliable control integration.

08.06. Control Latency Compensation Predictive Control [w/Code]

Control latency is the total delay between sensing the vehicle state, generating a control decision, transmitting the command, and obtaining the resulting physical response. In an autonomous vehicle, this delay may originate from localization, perception, trajectory generation, controller execution, ROS2 communication, CAN transmission, actuator dynamics, and sensor feedback. Even when every individual component operates correctly, their accumulated latency can significantly change the behavior of a closed-loop controller.

Latency becomes especially important because the controller calculates an actuator command using a vehicle state that may already be outdated when the command is physically applied. If the vehicle is moving quickly, even a relatively small delay can correspond to a meaningful spatial displacement. The controller may therefore steer or accelerate according to a past state rather than the state that exists when the actuator responds. This effect can increase tracking error, produce oscillation, and reduce stability margins.

A useful control architecture separates latency into measurable stages rather than treating it as one unknown delay. Sensor acquisition and timestamping introduce an initial delay, state estimation adds processing time, trajectory generation and controller execution require computation, and communication networks introduce transmission and scheduling delays. Finally, steering, motor, or brake actuators have their own response dynamics. Measuring these stages independently makes it possible to identify the dominant sources of delay and determine where compensation provides the greatest benefit.

Timestamp management is fundamental to latency analysis. Each state and command should carry timing information that identifies when the physical measurement was generated, when software processed it, and when communication occurred. Comparing these timestamps allows the system to estimate sensing delay, computational delay, network delay, and actuator-related delay. Without consistent time references, latency can easily be confused with vehicle dynamics, localization error, or controller instability.

A simple compensation strategy is to predict the current vehicle state from a delayed measurement. If the latest available position, heading, velocity, and yaw rate correspond to an earlier time, a motion model can propagate that state forward by the estimated delay. For short horizons, constant-velocity or constant-acceleration assumptions may be sufficient. For vehicle control, a kinematic or dynamic model can provide a more appropriate prediction when steering, yaw dynamics, and acceleration significantly influence future motion.

Predictive control extends this concept by considering the state that will exist when the next control action becomes effective. Instead of calculating a command solely from the current measured error, the controller estimates future vehicle behavior and selects an input that minimizes predicted tracking error. This approach is particularly useful when the control loop contains significant computational or communication latency and when the reference trajectory is already known several steps into the future.

Model Predictive Control naturally incorporates latency compensation because it predicts vehicle states across a future horizon. The prediction model can include actuator delay, steering dynamics, acceleration response, and other relevant system characteristics. The controller then optimizes future commands against the delayed plant response. Only the first command is applied, after which the prediction is updated using newly received state information. This repeated optimization allows the controller to adapt as the actual vehicle response differs from the model.

Actuator delay must be distinguished from communication delay. A CAN command may reach the vehicle controller quickly but still require additional time before the steering mechanism or motor produces the requested physical response. Steering systems may exhibit rate limits, dead zones, mechanical compliance, and actuator lag, while propulsion and braking systems may have their own response characteristics. Including these effects in the control model can prevent the controller from assuming instantaneous actuation.

Latency compensation can also use trajectory preview. If the controller knows that a vehicle will move forward during the expected delay, it can select a future reference point rather than using the geometrically nearest current point. For lateral control, previewing future curvature and heading can reduce the effect of delayed steering response. For longitudinal control, future velocity and acceleration targets can be used to compensate for propulsion or braking delay before a large speed error develops.

The amount of compensation should correspond to the measured or estimated end-to-end delay. Excessive compensation can be as problematic as insufficient compensation because prediction becomes increasingly uncertain as the horizon grows. Model errors, changing terrain, wheel slip, unexpected disturbances, and inaccurate velocity estimates can cause the predicted state to diverge from reality. Practical systems therefore use bounded prediction horizons and continuously update the prediction using the latest valid measurements.

Latency also interacts with control frequency. Increasing controller frequency does not automatically eliminate latency if sensing, communication, and actuator delays remain unchanged. A high-frequency controller operating on delayed information can still produce an outdated response. The architecture should therefore distinguish sampling frequency from end-to-end latency and evaluate both when determining whether a control loop is sufficiently responsive for its operating condition.

ROS2 and CAN integration introduces additional timing considerations. ROS2 message scheduling, executor behavior, serialization, transport, bridge processing, and CAN transmission all contribute to the time between command generation and actuator reception. Queueing can further increase effective delay when messages accumulate faster than they are transmitted. Control-critical communication should therefore avoid unnecessary buffering and should expose message age, deadline violations, and communication timing to the control and safety supervision layers.

Latency compensation must remain consistent with safety constraints. A predicted state is an estimate rather than a measurement, and prediction uncertainty increases with time. Safety logic should therefore monitor prediction age, state freshness, localization validity, actuator feedback, and controller execution time. If the estimated delay exceeds a configured operating limit, the system may reduce speed, switch to a more conservative controller, restrict commands, or transition toward a predefined minimal-risk condition.

Outdoor AMRs experience additional latency-related uncertainty because terrain can change the relationship between commanded and observed motion. Loose gravel, slopes, wet surfaces, wheel slip, payload changes, and uneven terrain can alter acceleration and steering response after a command has already been issued. A prediction model calibrated on smooth pavement may therefore become inaccurate outdoors. Terrain-aware parameters, conservative prediction, and feedback correction can reduce the resulting error.

For low-speed AMR operation, latency compensation may focus on precise docking, narrow passages, and slow maneuvering. At higher speeds, the same absolute delay produces a larger spatial displacement and can have a stronger effect on lateral stability. The control architecture should therefore consider speed-dependent compensation, controller gains, prediction horizon, actuator limits, and trajectory preview. A single fixed compensation value may not provide consistent behavior across the complete operating envelope.

Latency should be measured using controlled experiments rather than inferred only from tracking performance. A known command can be generated, timestamps can be recorded at each software and communication boundary, and actuator or vehicle feedback can identify when the physical response begins. Repeating this process under different computational loads, communication conditions, vehicle speeds, and actuator states can reveal both nominal latency and variation. The variation is important because a controller designed for a fixed delay may behave differently when latency fluctuates.

Simulation and Hardware-in-the-Loop testing provide useful environments for evaluating compensation strategies. Artificial sensing, computation, network, and actuator delays can be introduced independently and systematically. The controller can then be evaluated using lateral error, heading error, velocity error, oscillation, settling behavior, actuator effort, and stability margins. HIL testing is particularly useful for validating real communication and scheduling behavior before exposing a physical vehicle to large delayed-control errors.

A robust implementation should also monitor the difference between predicted and measured vehicle states. This prediction residual can indicate that the assumed latency, vehicle model, or actuator response is no longer accurate. Persistent residual growth may result from payload changes, terrain transitions, tire behavior, actuator degradation, or timing anomalies. Such information can support adaptive model updates, controller mode changes, fault detection, or increased safety restrictions.

Control latency compensation ultimately transforms timing from an uncontrolled source of error into an explicit part of the control problem. The architecture should measure end-to-end delay, preserve timestamps, predict future vehicle state, model actuator response, preview future trajectory information, and continuously correct predictions using fresh feedback. When combined with constrained predictive control, safety supervision, ROS2/CAN timing management, and systematic HIL and vehicle testing, these mechanisms enable more stable and accurate trajectory tracking despite unavoidable delays in autonomous vehicle and outdoor AMR control systems.

08.07. Traction Control and Slip Management

Traction control and slip management maintain usable tire-ground interaction when propulsion or braking demand approaches the available friction limit. In autonomous vehicles and outdoor AMRs, commanded wheel torque does not always produce the expected vehicle acceleration because tire forces depend on surface friction, normal load, wheel speed, terrain, payload, and vehicle dynamics. The control objective is therefore not simply to maximize torque, but to maintain stable and controllable longitudinal motion while preserving sufficient traction for steering and stopping.

Wheel slip occurs when the rotational speed of a driven wheel becomes inconsistent with the actual longitudinal motion of the vehicle. During acceleration, excessive positive slip can occur when motor torque exceeds available tire-road friction. During braking, excessive negative slip can cause the wheel to approach lockup. Slip can be described using wheel angular velocity, effective tire radius, and vehicle longitudinal velocity. Reliable estimation becomes challenging at very low speed because small velocity errors can produce large apparent slip ratios.

A practical traction-control system combines wheel-speed measurements with vehicle-speed and inertial information. Wheel encoders provide individual rotational speeds, while an IMU supplies longitudinal acceleration and angular-rate information. Localization, odometry, or other motion estimates can provide an independent estimate of vehicle velocity. Comparing these sources allows the controller to distinguish normal wheel rotation from abnormal acceleration or braking behavior caused by reduced tire-ground adhesion.

The available traction force depends strongly on the surface condition and vertical load. Dry pavement, wet pavement, gravel, grass, mud, compacted soil, and other outdoor surfaces can produce substantially different friction behavior. Load transfer can also change the normal force available at individual wheels during acceleration, braking, steering, or operation on slopes. A traction controller therefore should not assume that a fixed maximum torque is valid for every wheel and every operating condition.

For a four-wheel-drive or six-wheel-drive AMR, individual wheel behavior becomes particularly important. A vehicle can continue moving even when one wheel experiences significant slip, but uncontrolled torque at that wheel may waste energy and reduce overall stability. Independent motor control allows torque to be reduced on a slipping wheel while maintaining useful torque on wheels with better contact. This capability is especially valuable on uneven terrain where wheel loading can change continuously.

Slip detection should use more than a single threshold whenever practical. A sudden difference between wheel speed and estimated vehicle speed can indicate slip, but the same difference may also result from sensor error, steering geometry, tire-radius variation, or rapid changes in vehicle motion. Combining wheel-speed differences, IMU acceleration, estimated vehicle velocity, motor torque, and temporal consistency can provide a more reliable slip indicator. The resulting estimate should also include confidence information when sensor quality is uncertain.

A simple traction controller can reduce requested motor torque when estimated slip exceeds a defined operating threshold. The torque reduction should normally be gradual rather than an abrupt cutoff because sudden changes can themselves destabilize the vehicle. Once traction is recovered, torque can be restored according to a controlled recovery rule. Hysteresis, filtering, rate limits, and minimum activation times can prevent the controller from repeatedly switching between traction and non-traction states when the estimated slip is close to the threshold.

The relationship between slip and usable traction is not constant. Tire-ground friction can vary with wheel load, speed, temperature, moisture, surface material, and tire condition. In some conditions, a moderate amount of slip may produce high longitudinal force, while excessive slip causes the available force to decrease. A production system can therefore use a calibrated slip target or operating region rather than simply attempting to force slip to zero under every condition.

Braking requires complementary slip management. Excessive negative slip during braking can reduce longitudinal tire force and compromise steering capability. Brake control can therefore reduce braking demand when wheel behavior indicates an approach toward lockup, while maintaining the required deceleration as closely as possible. On electric AMRs, regenerative braking and mechanical braking may also need coordinated control so that regeneration does not create excessive wheel slip on low-friction surfaces.

Traction control interacts directly with longitudinal speed and acceleration control. The upper-level controller may request a specific acceleration, but the traction layer determines whether that acceleration can be physically achieved under current surface conditions. When available traction is insufficient, the traction controller can reduce propulsion or braking demand and report the limitation to higher-level control. This preserves the distinction between desired motion and physically feasible motion.

Traction management also interacts with lateral control because the total tire-force capability is shared between longitudinal and lateral forces. During a sharp turn, a tire already generating significant lateral force has less remaining capacity for acceleration or braking. Strong propulsion while steering on a low-friction surface can therefore increase instability risk. A coordinated controller can reduce longitudinal demand when curvature, lateral acceleration, steering demand, or estimated friction indicates that the available force margin is becoming small.

Slope operation introduces another important consideration. On an incline, gravity changes the longitudinal force balance and may cause additional wheel loading or unloading depending on vehicle geometry. During downhill braking, available tire force must be managed together with gravitational acceleration and braking demand. Feedforward compensation for slope can reduce unnecessary controller effort, while traction feedback determines whether the resulting propulsion or braking command remains compatible with actual surface adhesion.

Payload variation changes both longitudinal dynamics and wheel loading. An unloaded AMR and a heavily loaded AMR can exhibit different acceleration responses even when identical motor torque is commanded. Payload distribution can also alter the normal force at individual wheels. Traction management should therefore operate together with payload-aware longitudinal control rather than assuming that a fixed torque or slip threshold provides identical behavior for every loading condition.

Outdoor AMRs may encounter abrupt transitions between surfaces. A wheel can move from pavement to gravel, from dry ground to wet ground, or from a firm surface to loose soil within a short distance. Such transitions can produce rapid changes in available traction before a stable friction estimate is available. Conservative torque limiting, rapid slip detection, and gradual recovery can reduce the likelihood of excessive wheel acceleration during these transitions.

Terrain perception can provide useful information before significant slip occurs. A perception or terrain-estimation system may classify the surface or estimate traversability, allowing the control system to select appropriate torque limits, acceleration constraints, or expected friction parameters. This information should be treated as predictive context rather than as a replacement for direct traction feedback because actual tire-ground interaction can differ from the estimated terrain class.

Torque distribution becomes important on multi-wheel platforms. A controller may distribute total propulsion demand equally, according to axle load, or according to individual wheel conditions. When one wheel loses traction, reducing its torque and reallocating part of the available demand to wheels with better contact can improve utilization of the available friction. The redistribution strategy must still respect motor limits, drivetrain constraints, thermal conditions, and the mechanical structure of the vehicle.

Slip management should also consider actuator response and communication latency. A traction controller that detects slip but applies torque reduction too slowly may allow wheel speed to increase significantly before corrective action becomes effective. Conversely, excessive filtering can delay detection and create unnecessary oscillation. The complete loop from wheel measurement through estimation, decision, communication, motor response, and renewed measurement should therefore be evaluated as an end-to-end dynamic system.

Safety supervision provides a higher-level boundary around traction control. Persistent excessive slip, inconsistent sensor information, loss of multiple-wheel traction, unexpected vehicle acceleration, or actuator faults may indicate that normal control assumptions are no longer valid. The supervisory system can restrict propulsion, reduce vehicle speed, request controlled stopping, or transition to a predefined degraded operating mode. Traction control should therefore complement rather than replace the overall vehicle safety architecture.

Energy efficiency is another practical consideration. Continuous wheel slip converts electrical energy into tire and ground losses without producing useful vehicle motion. Excessive corrective oscillation can also increase motor and drivetrain losses. Maintaining appropriate traction improves not only controllability but potentially energy utilization and component durability. For long-duration outdoor AMR missions, traction-aware control can therefore contribute to both mobility performance and operational efficiency.

Calibration requires representative surfaces, loads, speeds, and operating conditions. A traction strategy calibrated only on smooth dry pavement may not remain effective on gravel, grass, mud, slopes, or wet surfaces. Tests should examine acceleration and braking at different torque levels, wheel loads, vehicle speeds, steering conditions, and payload configurations. The resulting data can be used to establish thresholds, filters, recovery rates, torque limits, and model parameters appropriate to the intended operating domain.

Simulation and Hardware-in-the-Loop testing provide controlled environments for developing slip-management algorithms. Tire-ground friction, wheel load, slope, payload, motor torque, sensor noise, actuator delay, and communication timing can be varied systematically. Such testing makes it possible to examine difficult combinations that may be unsafe or expensive to reproduce repeatedly on a physical vehicle. Real-vehicle tests are then required to verify that simulated traction behavior corresponds sufficiently to actual tire and terrain interaction.

Validation should evaluate both slip suppression and vehicle-level behavior. Useful measurements include slip ratio, wheel-speed deviation, longitudinal acceleration, vehicle speed error, stopping distance, braking stability, torque utilization, energy consumption, recovery time, oscillation, and lateral behavior during combined steering and acceleration. Testing should include low-friction surfaces, surface transitions, slopes, uneven terrain, different payloads, and representative actuator delays so that the traction controller is evaluated under realistic operating conditions.

Traction control and slip management ultimately form an intermediate control layer between desired vehicle motion and physically available tire-ground force. The upper-level controller specifies the desired acceleration or braking behavior, while traction management determines how much of that request can safely and effectively be delivered through the wheels. By combining slip estimation, torque modulation, brake coordination, load awareness, terrain information, longitudinal and lateral coordination, actuator constraints, safety supervision, and systematic validation, autonomous vehicles and outdoor AMRs can maintain more predictable mobility across changing ground conditions.

08.08. Emergency Brake and Override Logic [w/Code]

Emergency braking and override logic form the final protective control layer between autonomous motion commands and physical vehicle actuation. Their purpose is to intervene when normal trajectory tracking can no longer guarantee an acceptable response. Unlike nominal longitudinal control, which optimizes speed and acceleration tracking, emergency logic prioritizes rapid risk reduction, predictable command authority, and transition toward a controlled stop or another predefined safe vehicle state.

The architecture should separate nominal control from independent safety supervision. Trajectory planners and motion controllers normally generate steering, propulsion, and braking requests, while the safety supervisor continuously evaluates whether those commands remain valid. When a critical condition is detected, the supervisor can override normal commands and issue a higher-priority braking or motion-inhibition request without depending on the nominal controller to recognize and resolve the problem.

Emergency braking can be triggered by several classes of events. An imminent collision, unexpected obstacle, excessive tracking error, localization failure, loss of control communication, actuator fault, excessive wheel slip, controller timeout, or violation of a safety boundary may require intervention. The trigger logic should distinguish conditions requiring immediate braking from faults that permit controlled deceleration, reduced-speed operation, or transition to a degraded operating mode.

Command priority must be explicitly defined so that conflicting requests cannot reach the actuators ambiguously. A normal trajectory command should have lower authority than a safety intervention, while an emergency-stop request should normally dominate propulsion commands. Manual or remote override may introduce another authority level depending on the system design. Arbitration logic determines which source owns the final actuator request and prevents lower-priority software from unintentionally cancelling a safety action.

Emergency braking behavior should reflect the available physical stopping capability rather than assume instantaneous deceleration. Vehicle speed, mass, payload, road slope, tire-ground friction, brake capability, actuator delay, and wheel slip influence the achievable stopping distance. A safety controller can use these factors to determine whether maximum braking is required or whether a controlled deceleration profile can reduce risk while maintaining vehicle stability.

Stopping distance contains both reaction distance and braking distance. During sensing, decision, communication, and actuator delays, the vehicle continues to move before significant braking force develops. At higher speeds, this delay can contribute substantially to total stopping distance. Safety design should therefore consider end-to-end latency together with physical deceleration capability when establishing obstacle-detection range, protective zones, speed limits, and emergency-braking thresholds.

Emergency braking must also coordinate with traction and slip management. Applying maximum brake demand on a low-friction surface does not necessarily produce maximum useful deceleration. Excessive wheel slip can reduce braking force and impair steering capability. The emergency controller can therefore request strong deceleration while the lower-level traction or brake controller modulates individual wheel forces to preserve tire-ground adhesion and directional stability.

For electric AMRs, regenerative and mechanical braking may participate in the stopping process. Regenerative braking can provide useful deceleration and recover energy, but its available torque may depend on vehicle speed, battery state, motor limits, and traction conditions. Emergency stopping should not depend exclusively on regeneration when an independent braking mechanism is required for the intended safety architecture. Brake coordination should ensure predictable deceleration when electrical operating conditions change.

Override logic extends beyond emergency braking. A safety system may need to inhibit propulsion, limit maximum speed, restrict steering, hold the vehicle stationary, or switch control authority to a remote or manual operator. Each override should have a clearly defined activation condition, command priority, allowed actuator behavior, and release condition. This prevents an override from becoming an uncontrolled secondary control path that introduces new hazards.

Manual override requires particular care because human input and autonomous commands may otherwise compete for the same actuators. The system should define how control authority is transferred, how the transition is detected, and whether autonomous commands are immediately suppressed or smoothly disengaged. The operator should receive clear indication of the active control mode so that there is no ambiguity about whether the vehicle is responding to autonomous, remote, or manual commands.

Remote override introduces communication dependency. A remote operator may request a stop or assume control, but communication delay or link loss can make continuous remote control unreliable. Safety-critical stopping behavior should therefore remain available locally on the vehicle. If the remote link disappears during an override state, predefined local logic should determine whether the vehicle holds position, performs a controlled stop, or enters another safe state appropriate to the operating environment.

An emergency stop and a controlled safety stop should be distinguished architecturally. An emergency stop is intended for conditions requiring rapid hazard reduction and may use the strongest permitted braking action. A controlled safety stop can use a smoother deceleration profile when sufficient time and distance remain. Separating these responses avoids unnecessary aggressive braking while preserving the ability to react immediately when a critical hazard develops.

State machines are commonly used to organize these operating modes. The vehicle may transition among normal operation, warning, degraded operation, controlled stopping, emergency braking, stopped-safe, and recovery states. Each transition should be associated with explicit conditions rather than informal software behavior. A state-machine structure also makes it easier to define which commands remain permitted and which subsystems must acknowledge a safety transition.

Once emergency braking has been activated, automatic release should be handled conservatively. The disappearance of the original trigger does not necessarily mean that normal motion can resume immediately. The vehicle may require standstill confirmation, fault clearance, operator acknowledgment, localization recovery, communication restoration, or system reinitialization. Latching selected safety states prevents rapidly changing sensor signals from repeatedly activating and releasing braking.

Standstill detection is therefore an important part of emergency logic. A commanded stop does not prove that the vehicle has physically stopped. Wheel-speed sensors, estimated vehicle velocity, IMU information, and brake status can be combined to confirm standstill. On slopes, additional holding torque or a mechanical brake may be required after stopping to prevent rollback or unintended motion before the system declares a stable safe state.

Sensor validity must be considered when emergency decisions are made. A single erroneous obstacle detection should not unnecessarily destabilize the vehicle, but waiting for excessive confirmation can delay a genuinely required stop. Safety architectures may combine independent observations, confidence measures, temporal consistency, plausibility checks, and conservative fallback rules. The required strategy depends on the consequence of missed detection compared with the consequence of unnecessary braking.

Communication watchdogs provide another important trigger mechanism. The drive-by-wire interface can monitor the age and frequency of control messages and detect when the upstream controller no longer supplies valid commands. ROS2 deadlines, heartbeat messages, CAN counters, checksums, and actuator acknowledgments can contribute to this monitoring. When communication becomes stale or invalid, the system should transition according to a predefined response rather than indefinitely retaining the previous motion command.

Actuator feedback is necessary to verify that an emergency request is actually being executed. A brake command may be transmitted correctly while the physical brake fails to generate the expected response. Steering or propulsion may also remain active because of hardware or communication faults. Comparing commanded and measured actuator states enables the supervisor to identify failed intervention and escalate the response through redundant braking, propulsion isolation, or other available safety mechanisms.

Outdoor AMRs introduce additional challenges because emergency behavior must remain effective across slopes, gravel, wet pavement, loose soil, uneven terrain, and changing payloads. A stopping strategy calibrated only for level pavement may underestimate distance or stability limitations elsewhere. The safety system should therefore use conservative operating limits and, where available, terrain, slope, traction, and payload information when determining safe speed and braking margins.

Emergency braking can interact strongly with lateral motion. Heavy braking while turning changes tire-force distribution and may reduce the lateral force available for path stabilization. Depending on the vehicle architecture, the controller may need to coordinate steering and braking so that deceleration does not produce an unstable yaw response. The objective during an emergency is not perfect trajectory tracking but maintaining sufficient directional stability while reducing kinetic energy and collision risk.

The drive-by-wire interface is a critical enforcement point for override logic. It can reject invalid propulsion commands, apply command priority, monitor timeouts, and forward safety commands to the appropriate vehicle controllers. However, software architecture should avoid creating a single unprotected failure point. Where the safety concept requires independence, emergency-stop circuits, safety controllers, or dedicated hardware paths can remain separate from the normal ROS2 control path.

Diagnostics and event logging are essential because emergency interventions must be explainable after testing or field operation. Logs should preserve trigger conditions, vehicle state, active control mode, command source, actuator requests, actuator feedback, timestamps, communication status, and the sequence of safety-state transitions. This information supports root-cause analysis and helps determine whether an event originated from perception, planning, control, communication, actuation, or safety supervision.

Simulation and Hardware-in-the-Loop testing allow emergency logic to be exercised repeatedly without creating unnecessary physical risk. Tests can inject obstacle events, stale commands, communication loss, actuator delays, brake faults, low-friction conditions, localization failures, and controller crashes. HIL environments are especially useful for verifying that real controller software, watchdogs, CAN interfaces, and command arbitration produce the intended response under precisely controlled fault conditions.

Physical vehicle validation remains necessary because stopping performance depends on real tires, brakes, motors, mass distribution, terrain, and mechanical dynamics. Tests should measure trigger-to-command latency, command-to-brake latency, total stopping distance, peak and average deceleration, wheel slip, directional stability, standstill confirmation, and override recovery. Different speeds, payloads, slopes, surfaces, and steering conditions should be included within the intended operational design domain.

Emergency brake and override logic ultimately provide deterministic authority when normal autonomous control becomes unsafe or unreliable. A robust architecture combines independent hazard detection, explicit command arbitration, braking and traction coordination, watchdogs, actuator verification, safe-state management, controlled recovery, diagnostics, and systematic fault testing. By placing these mechanisms above nominal trajectory tracking while connecting them directly to enforceable actuator behavior, autonomous vehicles and outdoor AMRs can transition predictably from normal motion toward a controlled safe condition when critical failures or hazards occur.

08.09. Control Module HIL Test Automation [w/Code]

Hardware-in-the-Loop testing places the real control software and selected electronic hardware inside a simulated vehicle environment so that control behavior can be evaluated before extensive physical vehicle testing. The controller receives realistic sensor and vehicle-state signals, generates steering, propulsion, and braking commands, and interacts with a real-time plant model. This arrangement allows the complete control interface to operate as if it were connected to an actual autonomous vehicle or AMR.

A control-module HIL environment normally contains the controller under test, a real-time simulation computer, vehicle and actuator models, communication interfaces, signal conditioning, data acquisition, and test-management software. Depending on the integration level, the controller may execute on its production ECU or edge computer while ROS2, CAN, Ethernet, digital I/O, or other interfaces connect it to the simulator. The objective is to preserve realistic timing and interfaces rather than merely reproduce control algorithms offline.

The simulated plant should represent the dynamics that materially affect controller behavior. Longitudinal velocity, acceleration, steering response, yaw motion, wheel dynamics, actuator delay, saturation, tire-ground interaction, and relevant sensor outputs can be modeled according to the intended vehicle. Outdoor AMRs may additionally require slope, payload, wheel slip, uneven terrain, rolling resistance, and changing friction conditions so that the controller experiences representative operating conditions.

Closed-loop execution distinguishes HIL from simple command playback. The controller calculates an actuator request from the simulated state, the plant model applies that request to calculate the next vehicle state, and new sensor feedback is returned to the controller. This cycle repeats in real time. Because each command changes the subsequent simulated state, controller instability, oscillation, saturation, accumulated tracking error, and recovery behavior can emerge naturally during the test.

Real-time timing is essential because control performance depends not only on numerical outputs but also on when those outputs are generated and applied. The HIL platform should reproduce controller periods, sensor update rates, communication delays, actuator delays, and scheduling behavior with sufficient determinism. Timing measurements can expose deadline violations, jitter, stale messages, delayed actuator commands, or excessive computation time that may remain invisible in non-real-time simulation.

Communication interfaces should be tested as part of the control system rather than bypassed whenever practical. ROS2 messages can exercise middleware behavior and software integration, while CAN communication can verify frame encoding, counters, checksums, update rates, timeouts, and drive-by-wire interaction. Testing the actual bridge and communication path allows faults caused by serialization, queueing, bus load, message loss, or interface configuration to appear before vehicle deployment.

Automated testing transforms HIL from an engineering demonstration into a repeatable verification process. A test framework can configure the initial vehicle state, load a scenario, start the controller, execute the simulation, inject disturbances or faults, record signals, evaluate acceptance criteria, and generate a result automatically. The same sequence can then be repeated after software changes, allowing regression testing to determine whether previously validated control behavior has been preserved.

Test scenarios should represent both nominal and boundary operating conditions. Straight driving, acceleration, braking, lane or path tracking, curvature transitions, stopping, reverse motion, slopes, payload changes, and low-friction surfaces can exercise normal controller behavior. Additional cases near steering, torque, acceleration, velocity, and actuator limits reveal how the controller behaves when commands approach physical constraints rather than remaining within comfortable nominal conditions.

Fault injection is one of the strongest advantages of HIL testing. Sensor dropout, frozen measurements, biased signals, communication loss, delayed CAN frames, stale ROS2 messages, actuator lag, motor faults, brake degradation, localization jumps, controller timeout, and inconsistent feedback can be introduced without physically damaging a vehicle. The resulting response can verify watchdogs, fallback logic, emergency braking, command arbitration, degraded modes, and recovery behavior.

Control latency can also be varied systematically. Artificial sensing, processing, network, and actuator delays can be inserted independently or in combination to determine how much delay the controller can tolerate. Tests can measure tracking degradation, oscillation, stability margin, stopping distance, and recovery as latency increases. This provides a controlled method for validating predictive compensation and identifying timing limits for the integrated control architecture.

Traction and slip management can be evaluated by changing simulated friction and wheel-ground conditions. Individual wheels can encounter different friction coefficients, temporary loss of contact, or surface transitions while the controller continues operating. Wheel speed, vehicle speed, motor torque, brake demand, slip ratio, and trajectory error can then be observed together. Such tests are useful for four-wheel-drive and six-wheel-drive AMRs operating on heterogeneous outdoor terrain.

Emergency brake and override logic should receive dedicated automated scenarios because these functions are difficult to exercise repeatedly on a real vehicle. The HIL system can create imminent obstacles, communication failures, actuator faults, excessive tracking error, or safety-boundary violations at precisely controlled times. Automation can then verify intervention latency, command priority, braking behavior, standstill detection, safety-state transitions, latching, and permitted recovery conditions.

Automated test execution requires explicit pass and fail criteria. A scenario should not be considered successful merely because the simulation completes without a software crash. Acceptance criteria can include maximum lateral error, velocity error, overshoot, settling time, acceleration limits, steering-rate limits, wheel slip, command latency, stopping distance, actuator saturation duration, and safety-response time. Thresholds should correspond to system requirements and the intended operational design domain.

Signal logging must preserve enough information to reconstruct controller behavior. Useful signals include reference trajectory, estimated vehicle state, controller error, steering request, motor torque, brake request, actuator feedback, wheel speed, slip estimate, safety state, communication status, timestamps, and fault-injection events. Synchronizing these signals to a common time reference makes it possible to determine whether an observed failure originated in control logic, communication, actuation, simulation, or timing.

Test automation should manage configuration as carefully as test execution. Controller gains, vehicle parameters, payload, tire characteristics, actuator limits, communication settings, software versions, scenario versions, and simulator models should be recorded with every result. Without configuration traceability, two tests with the same scenario name may represent different systems. Reproducibility therefore requires both deterministic execution and controlled configuration management.

A structured test description can separate scenario definition from execution logic. Initial conditions, reference paths, speed profiles, environmental parameters, fault events, expected responses, and evaluation metrics can be stored as machine-readable test data. The automation framework interprets this information and executes the same test procedure consistently. This approach makes it easier to expand the test library without rewriting the HIL control software for every new scenario.

Regression testing becomes increasingly important as control software evolves. Changes to lateral control, longitudinal control, traction management, latency compensation, drive-by-wire interfaces, or safety logic can unintentionally affect functions that were previously stable. An automated HIL suite can execute a defined collection of representative scenarios after each significant software update and compare results with requirement thresholds or approved reference behavior.

Continuous Integration can extend this concept by connecting software builds with automated simulation and selected HIL tests. Fast software-only tests may execute for every code change, while longer HIL campaigns can run at scheduled intervals or before release candidates. The resulting pipeline progressively increases test realism while controlling execution cost. Failed tests should preserve logs, configuration, software versions, and relevant traces so that engineers can reproduce the failure.

Test coverage should be considered across operating conditions rather than only by counting test cases. Vehicle speed, curvature, payload, slope, friction, control mode, communication delay, actuator condition, and fault type define a multidimensional test space. Parameterized automation can systematically vary these factors and reveal combinations that are rarely tested manually. Boundary-focused sampling can provide additional value by concentrating tests near controller limits and safety transitions.

HIL models must themselves be validated because an inaccurate simulator can produce misleading confidence. Vehicle acceleration, steering response, actuator delay, braking behavior, and wheel dynamics should be compared with measured physical-system data when available. Model fidelity does not need to be maximal in every subsystem, but it should be sufficient for the behavior being tested. Differences between simulated and measured responses should be documented and considered when interpreting test results.

The transition from HIL to physical vehicle testing should preserve scenarios and evaluation metrics wherever possible. A path-tracking scenario validated in HIL can later be reproduced on a test vehicle with equivalent speed, curvature, payload, and acceptance criteria. Differences between HIL and vehicle results help identify model mismatch, unmodeled actuator behavior, sensor characteristics, terrain effects, and integration problems. This creates a feedback loop that improves both the controller and the HIL model.

For outdoor AMRs, automated HIL testing is particularly valuable because the physical operating envelope can include many combinations of payload, terrain, slope, traction, speed, and multi-wheel behavior. Reproducing every combination repeatedly outdoors is expensive and difficult to control. HIL enables systematic exploration of these conditions before a smaller set of representative and safety-critical scenarios is transferred to controlled proving-ground or field testing.

A mature HIL automation architecture therefore connects requirements, scenarios, real-time simulation, production-like communication, controller execution, fault injection, synchronized logging, automated evaluation, and regression management. It does not replace vehicle testing, but moves a large portion of control verification into a repeatable environment where failures can be reproduced safely. This enables autonomous vehicle and outdoor AMR control modules to reach physical testing with better characterized performance, timing, interfaces, and safety behavior.

08.10. Outdoor AMR Control Integration Tuning Case

An outdoor AMR control-integration case brings lateral control, longitudinal control, feedforward compensation, drive-by-wire communication, latency compensation, traction management, and safety intervention into one operational system. Individual controllers may perform well in isolation but interact differently when deployed together. Integration tuning therefore focuses on the complete closed loop from trajectory reference and state estimation through command generation, vehicle actuation, physical motion, and feedback.

The tuning process should begin with a clearly defined vehicle configuration and operating envelope. Vehicle mass, payload range, wheelbase, steering geometry, wheel radius, drivetrain structure, actuator limits, maximum speed, braking capability, and expected terrain establish the physical boundaries of control. Sensor update rates, localization accuracy, controller periods, communication timing, and actuator response must also be characterized because software gains cannot compensate reliably for unknown hardware behavior.

Before aggressive controller tuning, basic actuator commands should be verified independently. Steering commands can be applied at low speed to measure steering angle response, dead zone, rate limit, hysteresis, and delay. Propulsion tests can relate motor commands to acceleration and steady velocity, while braking tests characterize deceleration and stopping behavior. These measurements create practical actuator models and reveal scaling, sign, saturation, or communication errors that would otherwise appear as controller problems.

Longitudinal tuning can start on level, high-friction ground with conservative acceleration and speed targets. The objective is to establish stable velocity tracking without excessive overshoot, oscillation, or repeated torque saturation. Feedforward terms can compensate for nominal rolling resistance and required acceleration, while feedback corrects residual error. Once baseline behavior is stable, payload, slope, low-friction surfaces, and higher-speed operation can be introduced progressively.

Lateral tuning should similarly begin with low-speed straight and constant-curvature paths. Cross-track error, heading error, steering command, yaw rate, and steering actuator response can be examined together. Controller gains or prediction parameters are adjusted until the AMR follows the reference without excessive steering oscillation. Speed should then be increased gradually because a lateral controller that is stable at walking speed may become oscillatory or delayed as vehicle velocity rises.

Feedforward and feedback terms should be tuned as complementary mechanisms rather than independently maximized. Feedforward predicts the steering or propulsion input required by the reference trajectory and vehicle model, while feedback corrects model mismatch and disturbances. Excessive feedback gain can create oscillation and actuator activity, whereas weak feedback allows persistent error. Good integration uses feedforward to reduce predictable error and feedback to handle the remaining uncertainty.

Control latency should be measured after the complete software and communication path is connected. Timestamps can identify delay through state estimation, trajectory processing, controller execution, ROS2 communication, CAN bridging, and actuator response. If the vehicle travels a meaningful distance during this interval, the controller should operate on a predicted state or future trajectory reference. Compensation should be tuned using measured delay rather than an arbitrary preview distance.

Outdoor operation makes traction management part of normal controller tuning rather than a separate exceptional function. Gravel, wet pavement, loose soil, grass, slopes, and uneven surfaces can cause the commanded motor torque to produce different acceleration responses. Wheel speed, estimated vehicle velocity, IMU acceleration, and motor commands can be compared to detect slip. Torque limiting should intervene early enough to preserve traction without unnecessarily reducing performance on high-friction ground.

Multi-wheel AMRs require additional attention to torque distribution. In a four-wheel-drive or six-wheel-drive platform, wheel loading can change as the vehicle crosses uneven terrain, accelerates, brakes, or carries an asymmetric payload. Applying identical torque to every wheel may therefore be inefficient. Integration tuning can evaluate wheel-speed differences and traction conditions so that torque is reduced at slipping wheels while useful propulsion is retained at wheels with stronger ground contact.

Longitudinal and lateral control must also be evaluated simultaneously. Strong acceleration during a turn can consume tire-force capacity that would otherwise support lateral tracking, while heavy braking can alter yaw behavior and path stability. The integrated controller can therefore limit acceleration or braking according to curvature, steering demand, estimated friction, and vehicle speed. The objective is to preserve predictable motion rather than maximize each control channel independently.

Payload variation is an important outdoor AMR tuning variable because it changes acceleration, braking, tire loading, and sometimes steering response. A controller tuned only with an unloaded vehicle may produce sluggish acceleration or longer stopping distance at maximum payload. Conversely, aggressive gains selected for a heavy configuration may create excessive response when unloaded. Gain scheduling, mass estimation, or payload-dependent feedforward parameters can reduce these differences.

Slope testing should include both uphill and downhill operation. Uphill driving requires additional propulsion force, while downhill operation may require continuous braking or regenerative torque to maintain the target speed. Incorrect slope compensation can produce speed error, integral windup, or abrupt transitions when terrain grade changes. Combining estimated slope with feedback control allows predictable gravitational effects to be compensated while preserving correction for modeling error.

Trajectory characteristics must be considered during integration because control performance depends on what the planner requests. Sudden curvature changes, discontinuous speed targets, or physically infeasible acceleration can force even a well-tuned controller into saturation. The control system should therefore expose steering, acceleration, jerk, and traction constraints to trajectory generation. Integration is most effective when planning and control share consistent assumptions about the vehicle\'s achievable motion.

Safety limits should remain active throughout tuning. Maximum speed, acceleration, steering rate, motor torque, braking demand, lateral error, communication age, and actuator status can be monitored independently of experimental controller parameters. If tracking error or system behavior exceeds a configured boundary, safety supervision can reduce speed or initiate a controlled stop. This allows tuning to progress toward higher-performance conditions without removing the protective control architecture.

Emergency braking and override behavior should be verified after nominal control becomes stable but before high-risk field testing. The AMR should respond predictably to obstacle triggers, communication loss, controller timeout, localization faults, and manual emergency-stop commands. Tests should verify command priority, propulsion inhibition, brake response, standstill detection, and recovery conditions. Nominal controller outputs must never be able to cancel an active higher-priority safety intervention.

Logging is essential because integrated control problems are often difficult to diagnose from vehicle motion alone. Reference trajectory, estimated pose, velocity, heading, cross-track error, steering command, torque, brake request, wheel speeds, slip estimate, actuator feedback, safety state, and timestamps should be recorded on a synchronized timeline. Correlating these signals helps distinguish poor controller gains from localization noise, actuator delay, communication jitter, traction loss, or trajectory discontinuity.

A useful tuning campaign progresses from simple and controlled conditions toward the intended operating domain. Simulation and HIL can first expose software, timing, communication, and fault-handling problems. Low-speed vehicle tests then establish actuator and controller baselines on predictable surfaces. Speed, curvature, payload, slope, surface variation, and disturbances are subsequently increased in controlled stages so that the cause of each performance change remains identifiable.

Quantitative metrics make this progression repeatable. Lateral error, heading error, velocity error, acceleration error, overshoot, settling time, steering activity, torque saturation, wheel slip, stopping distance, command latency, and safety interventions can be calculated for every run. Comparing metrics across software versions and configurations prevents tuning decisions from depending only on subjective observations and supports regression detection when one controller improvement degrades another behavior.

Parameter changes should be controlled and traceable. Controller gains, feedforward coefficients, prediction horizon, latency estimate, slip thresholds, torque limits, steering limits, vehicle parameters, payload configuration, and software version should be associated with each test result. Changing many parameters simultaneously makes causal analysis difficult. A disciplined process changes a limited set of related parameters, repeats representative scenarios, and retains configurations that demonstrate measurable improvement.

Terrain transitions provide an important final integration challenge. An AMR may move from pavement onto gravel, encounter a slope, cross uneven ground, and return to a high-friction surface within one mission. The controller should adapt without abrupt torque changes, steering oscillation, or unnecessary safety interventions. Terrain information can adjust limits or model parameters, while feedback and traction estimation provide correction when the perceived terrain does not accurately predict actual wheel-ground behavior.

The final integrated configuration should be validated across representative combinations rather than at a single nominal operating point. Unloaded and loaded states, low and higher speeds, straight and curved trajectories, slopes, different friction levels, communication delays, and selected faults should be included. The objective is not to obtain one set of parameters that is mathematically optimal everywhere, but to establish stable, bounded, and predictable behavior throughout the intended operating envelope.

Outdoor AMR control integration is therefore an iterative systems-engineering process rather than a final gain-adjustment exercise. Vehicle modeling, actuator characterization, lateral and longitudinal tuning, latency compensation, traction management, planning constraints, safety supervision, logging, HIL testing, and field validation continuously inform one another. When these elements are tuned and validated as a complete closed-loop system, the AMR can maintain accurate and stable motion while adapting to payload, terrain, speed, traction, and timing variations encountered in real outdoor operation.


Author: Richard Minsoo Go

LinkedIn: Richard Minsoo Go

Top comments (0)