WHY these four? A lander with the right position but sideways velocity will scrape a leg and topple. Right velocity but tilted body means thrust has a horizontal component you can't kill in time. So position and velocity and attitude must converge together.
We want the vehicle to reach a desired state at time tf. Model the vehicle as a point mass (attitude handled by a faster inner loop):
r¨=acmd+g
Sign / definition convention (fix this in your head now):acmd is the net commanded acceleration the vehicle should experience, and gravity g=(0,0,−g) is added separately in the dynamics. This means the thrust acceleration the engine must physically produce isathrust=acmd(gravity is NOT re-added here) — the whole point of the −g term inside the formula below is that acmd already contains the gravity-cancelling contribution. So:
acmd=mT,r¨=acmdmT+g.
Keep this straight: the engine supplies exactly acmd, no more.
Step 1 — Ask: what trajectory shape can hit both a position and a velocity target?
Why this step? A single straight line only lets us aim position. To pin position AND velocity at tf we need enough free parameters. A constant acceleration gives us exactly the freedom we need.
Assume constant commanded acceleration a over the remaining time-to-go tgo=tf−t:
r(tf)=r+vtgo+21(a+g)tgo2v(tf)=v+(a+g)tgo
Step 2 — Impose the two boundary conditionsr(tf)=rf, v(tf)=vf.
From the velocity equation:
a+g=tgovf−v
Substitute into the position equation and solve. This is over-determined with only a constant a, so we allow a to vary linearly in time (add one more free vector). Doing the algebra (this is the classic E-guidance / two-point boundary value result):
Derivation check of the coefficients: With a linear-in-time acceleration a(t)=c0+c1τ (τ measured from now), integrating and matching the four scalar boundary conditions per axis gives the numbers 6 and 2. (Verified in the VERIFY block by integrating and confirming r(tf),v(tf) hit targets.)
Step 3 — Velocity vector alignment. For a vertical soft touchdown choose
vf=(0,0,−vtd),vtd≈1–2m/s.
The horizontal components of vf are zero, forcing the velocity vector to rotate to vertical as tgo→0.
WHY a tilt limit? A lander tips if its velocity + tilt push the center of mass outside the footprint of the legs. Geometrically, stability requires
θ+arctanvtdvh≲θtip
i.e. both a slow horizontal drift and a small body tilt.
Why must position AND velocity be targeted in terminal descent?
A right position with wrong velocity vector causes skid/topple; soft landing pins both endpoints — a two-point boundary value problem.
Write the soft-landing guidance acceleration.
acmd=tgo26(rf−r)−tgo2(2v+vf)−g
What does the −g term do and where does it live?
It cancels the +g in r¨=acmd+g; it is folded insideacmd, so the engine produces exactly T/m=acmd (do not add g again).
Does the engine supply acmd or acmd+g?
Exactly acmd: T/m=acmd, because the −g inside the formula already handles gravity compensation.
Where do the coefficients 6 and 2 come from?
Matching a linear-in-time acceleration to the four position+velocity boundary conditions per axis.
What happens as tgo→0?
The 1/tgo2 gain diverges → infinite thrust; must floor tgo or hand off to a hover-drop.
Name the touchdown envelope constraints.
Vertical speed, horizontal speed, tilt angle, angular rate, and position-within-pad — all AND-constraints.
Why a tilt-angle limit?
To keep the CoM inside the leg footprint so combined tilt + drift don't tip the lander.
What is velocity vector alignment?
Rotating velocity to nearly vertical (horizontal components → 0, vertical → small −vtd) at touchdown.
Recall Feynman: explain to a 12-year-old
Imagine landing a drone on a tiny box. You don't want to slam into it or slide off. So in the last few seconds you slow down until you're barely moving, make sure you're going straight down (not sideways), and keep the drone standing up straight — and you do all three at once, right when you touch. The math just says: "how hard should I push, given how far I still have to go and how fast I'm still moving?" Push harder if far/fast. And here's the key: the formula already includes the extra push needed to fight gravity — so the motor just does what the formula says, you don't tack on gravity a second time.
Dekho, terminal descent matlab landing ke last few seconds. Yahan sirf pad pe pahunchna kaafi nahi hai — vehicle ka velocity vector bhi seedha neeche point karna chahiye aur speed almost zero honi chahiye, warna lander sideways skid karke gir jaayega. Isliye hum ek "two-point boundary value problem" solve karte hain: position bhi target karo aur velocity bhi target karo, dono ek saath tf pe milne chahiye.
Guidance law ka formula hai acmd=tgo26(rf−r)−tgo2(2v+vf)−g. Pehla term position gap band karta hai, doosra term current velocity ko desired final velocity ki taraf le jaata hai. Ab important baat: −g term already acmd ke andar hai — matlab engine ko exactly T/m=acmd produce karna hai, gravity ko dobara add mat karo. Dynamics hai r¨=acmd+g, aur formula ka −g us +g ko cancel karta hai.
Touchdown constraints ek saath satisfy hone chahiye (AND conditions): vertical speed limit se kam, horizontal drift bahut kam, body ka tilt angle chhota, angular rate low, aur pad ke andar. Agar tilt aur sideways drift dono milke center of mass ko legs ke bahar dhakel de to lander topple ho jaayega — isiliye velocity vector ko vertical rotate karna zaroori hai.
Ek important trap: jaise-jaise tgo→0, gain 1/tgo2 infinity ki taraf jaata hai — thrust saturate ho jaayega. Isliye practical mein hum tgo ko floor karte hain ya last thodi height pe ek simple hover-then-drop pe switch kar dete hain. Mantra: SLOW, STRAIGHT, STEADY, ON-TIME, ON-PAD.