GNC/guidance/analytic_feedforward.py — Analytic EE Feedforward Twist

Pure trajectory kinematics: desired EE twist in closed form. Replaces finite-difference feedforward mission-wide.

zed=r^,ped=pc+rcamr^\bm{z}_{ed}=\hat{\bm{r}},\quad \bm{p}_{ed}=\bm{p}_c + r_\text{cam}\hat{\bm{r}}

Why Analytic over Finite-Difference?

FD feedforward: numerical noise, phase lag, step-size sensitivity.

Analytic FF: closed form from the reference alone — no state, no history.

νed=f ⁣(r,r˙,r¨,vcd,acd,Red,Rbd)\bm{\nu}_{ed}^\oplus = f\!\left(\bm{r},\dot{\bm{r}},\ddot{\bm{r}},\bm{v}_{cd},\bm{a}_{cd},\bm{R}_{ed},\bm{R}_{bd}\right)

Adopted Jun 21: pep_e median 28%-28\%, pe,99p_{e,99} 11%-11\%, coverage up.

Unit-Vector Aim Rate r^˙\dot{\hat{\bm{r}}} — Radial Part Projected Out

The projector P=Ir^r^\bm{P} = \bm{I} - \hat{\bm{r}}\hat{\bm{r}}^\top strips the radial component.

r^˙=1ρ(Ir^r^)r˙\dot{\hat{\bm{r}}} = \frac{1}{\rho}\left(\bm{I} - \hat{\bm{r}}\hat{\bm{r}}^\top\right)\dot{\bm{r}}

ρ˙=r^r˙\dot\rho = \hat{\bm{r}}\cdot\dot{\bm{r}}

Only the transverse part of r˙\dot{\bm{r}} drives the aim direction.

Aim Acceleration r^¨\ddot{\hat{\bm{r}}} — Three Terms

r^¨=1ρPr¨projected accel2ρ˙ρr^˙range rater^˙2r^centripetal\ddot{\hat{\bm{r}}} = \underbrace{\frac{1}{\rho}\bm{P}\ddot{\bm{r}}}_{\text{projected accel}} - \underbrace{\frac{2\dot\rho}{\rho}\dot{\hat{\bm{r}}}}_{\text{range rate}} - \underbrace{\lVert\dot{\hat{\bm{r}}}\rVert^2\hat{\bm{r}}}_{\text{centripetal}}

Term 1: transverse aim acceleration. Term 2: Coriolis-like range-rate correction. Term 3: centripetal — keeps r^\hat{\bm{r}} on S2S^2.

Roll-Free Angular Velocity & Acceleration

zed=r^\bm{z}_{ed}=\hat{\bm{r}} gives a natural roll-free choice:

ωed=r^×r^˙ω˙ed=r^×r^¨\bm{\omega}_{ed} = \hat{\bm{r}}\times\dot{\hat{\bm{r}}} \qquad \dot{\bm{\omega}}_{ed} = \hat{\bm{r}}\times\ddot{\hat{\bm{r}}}

Verified: r^ωed=0\hat{\bm{r}}\cdot\bm{\omega}_{ed}=0 and ωed×r^=r^˙\bm{\omega}_{ed}\times\hat{\bm{r}}=\dot{\hat{\bm{r}}}.

The r^˙×r^˙=0\dot{\hat{\bm{r}}}\times\dot{\hat{\bm{r}}}=\bm{0} term vanishes in ω˙ed\dot{\bm{\omega}}_{ed}.

One Pair (r^˙,r^¨)(\dot{\hat{\bm{r}}},\ddot{\hat{\bm{r}}}) Feeds the Full 6-DOF Twist

νed=[p˙edωed]=[vcd+rcamr^˙r^×r^˙]\bm{\nu}_{ed} = \begin{bmatrix}\dot{\bm{p}}_{ed}\\\bm{\omega}_{ed}\end{bmatrix} = \begin{bmatrix}\bm{v}_{cd}+r_\text{cam}\dot{\hat{\bm{r}}}\\\hat{\bm{r}}\times\dot{\hat{\bm{r}}}\end{bmatrix}

p˙ed=vcd+rcamr^˙p¨ed=acd+rcamr^¨\dot{\bm{p}}_{ed}=\bm{v}_{cd}+r_\text{cam}\dot{\hat{\bm{r}}} \qquad \ddot{\bm{p}}_{ed}=\bm{a}_{cd}+r_\text{cam}\ddot{\hat{\bm{r}}}

Single computation of (r^˙,r^¨)(\dot{\hat{\bm{r}}},\ddot{\hat{\bm{r}}}) determines all four quantities.

Local Frame & Circumcentroidal Conversion

Express in desired EE frame (R˙ed=ωed×Red\dot{\bm{R}}_{ed}=\bm{\omega}_{ed}^\times\bm{R}_{ed}):

νedlocal=[Redp˙edRedωed]ν˙edlocal=[Red(p¨edωed×p˙ed)Redω˙ed]\bm{\nu}_{ed}^\text{local}=\begin{bmatrix}\bm{R}_{ed}^\top\dot{\bm{p}}_{ed}\\\bm{R}_{ed}^\top\bm{\omega}_{ed}\end{bmatrix} \qquad \dot{\bm{\nu}}_{ed}^\text{local}=\begin{bmatrix}\bm{R}_{ed}^\top(\ddot{\bm{p}}_{ed}-\bm{\omega}_{ed}\times\dot{\bm{p}}_{ed})\\\bm{R}_{ed}^\top\dot{\bm{\omega}}_{ed}\end{bmatrix}

Circumcentroidal (\oplus) fold (Giordano eqs 13–16):

νed=νedlocalGvcvcd+Gωbωbd\bm{\nu}_{ed}^\oplus = \bm{\nu}_{ed}^\text{local} - \bm{G}_{v_c}\bm{v}_{cd} + \bm{G}_{\omega_b}\bm{\omega}_{bd}

ν˙ed=ν˙edlocal(G˙vcvcd+Gvcacd)+G˙ωbωbd\dot{\bm{\nu}}_{ed}^\oplus = \dot{\bm{\nu}}_{ed}^\text{local} - \left(\dot{\bm{G}}_{v_c}\bm{v}_{cd}+\bm{G}_{v_c}\bm{a}_{cd}\right) + \dot{\bm{G}}_{\omega_b}\bm{\omega}_{bd}

Cruise-Lag Floor x~ss\tilde{\bm{x}}_{ss} (eq 4.14)

At cruise steady-state x~˙=0\dot{\tilde{\bm{x}}}=\bm{0}, stiffness balances Coriolis + CoM coupling:

x~ss=(Jx~K˘)1 ⁣[C˘v˘d+(Cc+D˘G˘vc)x~˙c]\tilde{\bm{x}}_{ss} = -\left(\bm{J}_{\tilde x}^\top\breve{\bm{K}}\right)^{-1}\!\left[\breve{\bm{C}}\breve{\bm{v}}_d + \left(\bm{C}_c+\breve{\bm{D}}\breve{\bm{G}}_{v_c}\right)\dot{\tilde{\bm{x}}}_c\right]

Coriolis-only idealization (perfect CoM tracking):

x~ss=(Jx~K˘)1C˘v˘d\tilde{\bm{x}}_{ss} = -\left(\bm{J}_{\tilde x}^\top\breve{\bm{K}}\right)^{-1}\breve{\bm{C}}\breve{\bm{v}}_d

Solved via lstsq\text{lstsq} — minimum-norm at near-singular steps.