Mathematical Model

Center of Mass Guidance Model - Electrostatic Analogy

Model Overview

This model uses an analogy to electrostatic forces to guide a drone towards a goal while avoiding obstacles. The drone is treated as a charged particle influenced by attractive and repulsive forces.

Definitions

Force Equations

Total Force

\[ \vec{F}_{total} = \vec{F}_{goal} + \vec{F}_{\text{obs, squash}} + \vec{F}_{damping} \]

Goal Force

\[ \vec{F}_{goal} = \left( -F_{\text{goal, const}} + \frac{k_e \cdot Q_{drone} \cdot Q_{\text{goal}}}{\lVert\vec{r}_g\rVert^2 + \varepsilon_{\text{goal}}^2} \right) \hat{r}_g \]

Notes:

Obstacle Force

\[ \vec{F}_{\text{obs},i} = \left( \frac{ k_e \cdot Q_{drone} \cdot Q_i }{ \lVert\vec{r}_i\rVert^2 + \varepsilon_{\text{obs}}^2 } \right) \hat{r}_i \]

Raw and Squashed Obstacle Force

\[ \vec{F}_{\text{obs, raw}} = \sum_{i=1}^{n_{\text{obs}}}{\vec{F}_{\text{obs},i}} \] \[ \vec{F}_{\text{obs, squash}} = F_{\text{fac,squash}} \cdot \tanh\left( \frac{ \lVert \vec{F}_{\text{obs, raw}} \rVert }{ F_{\text{sat}} } \right) \cdot \hat{F}_{\text{obs, raw}} \]

Damping Force

\[ \vec{F}_{damping} = -K_{damping} \cdot \vec{v} \]

From Guidance Field to Desired Velocity

Let \(\vec{F}_{\text{field}}\) define the direction in which the drone "should" move:

Compute the unit direction:

\[ \hat{d} = \begin{cases} \dfrac{\vec{F}_{\text{field}}}{\Vert \vec{F}_{\text{field}} \Vert}, & \text{if } \vec{F}_{\text{field}} \neq \vec{0} \\ \vec{0}, & \text{otherwise} \end{cases} \]

Fix a target scalar speed \(v_{\text{ideal}} > 0\) (constant in the code) and a slow-down distance \(d_{\text{slow}} = 4 \, \text{m}\).

Define the desired velocity vector:

\[ \vec{v}_{\text{set}} = v_{\text{ideal}} \cdot \max\left(\frac{1}{3}, \frac{\lVert\vec{r}_g\rVert}{d_{\text{slow}}}\right) \cdot \hat{d} \]

This scales down the velocity as the drone approaches the goal, ensuring smooth arrival.

Control System

After computing \(\vec{v}_{\text{set}}\), the control system is designed to resemble the PX4 control architecture to allow for meaningful calibration results. The system follows this cascade structure:

  1. Velocity PID Controller - Computes desired acceleration setpoint from velocity signal
  2. Thrust Vector Computation - Converts acceleration to thrust force (world frame)
  3. Thrust Command Extraction - Projects thrust along body z-axis and normalizes
  4. Desired Attitude Computation - Derives quaternion from thrust vector and velocity direction
  5. Attitude Error to Body-Rate Setpoint - P-controller on attitude error quaternion
  6. Body-Rate Clamping - Saturates angular velocity setpoints to maximum limits
  7. Noise-Filtered Angular Velocity Derivative - 2nd-order Butterworth low-pass filter on derivative of angular velocity measurement
  8. Torque PID Controller - Computes body torque commands from body rate signal
  9. Yaw Torque Filtering - 1st-order low-pass on yaw torque output
  10. Force and Torque Application - Converts normalized commands to Newton forces/torques in simulation

System Invariants

VFF Guidance Constants

Physical Properties

Actuator Limits

Control System Fixed Parameters

Parameters for Calibration

These parameters are determined by the simulation calibration program.

VFF Guidance Parameters

Parameter Description
\(Q_{goal}\) Goal charge
\(F_{goal, const}\) Goal constant attraction
\(F_{\text{sat}}\) Obstacle total saturation scale
\(F_{\text{fac,squash}}\) Obstacle total factor after squashing
\(Q_{\text{vertical,obs}}\) Vertical obstacle charge modifier

Velocity PID Parameters

Parameter Description
\(K_x, K_y, K_z\) Velocity P gains (x, y, z axis)
\(K_{i,x}, K_{i,y}, K_{i,z}\) Velocity I gains (x, y, z axis)
\(K_{d,x}, K_{d,y}, K_{d,z}\) Velocity D gains (x, y, z axis)

Attitude Controller Parameters

Parameter Description
MC_ROLL_P Roll attitude gain
MC_PITCH_P Pitch attitude gain
MC_YAW_P Yaw attitude gain

Rate Controller Parameters

Parameter Description
MC_ROLLRATE_P, MC_ROLLRATE_I, MC_ROLLRATE_D Roll rate PID gains
MC_ROLLRATE_FF, MC_ROLLRATE_K Roll rate feedforward and global gain
MC_PITCHRATE_P, MC_PITCHRATE_I, MC_PITCHRATE_D Pitch rate PID gains
MC_PITCHRATE_FF, MC_PITCHRATE_K Pitch rate feedforward and global gain
MC_YAWRATE_P, MC_YAWRATE_I, MC_YAWRATE_D Yaw rate PID gains
MC_YAWRATE_FF, MC_YAWRATE_K Yaw rate feedforward and global gain

Implementation Notes