Student notes - Unit 07: Guidance: DP, lines, and moving targets

Warning

English draft for instructor review. The integration design is approved; the material is not yet approved for teaching or assessment. Croatian synchronization awaits approved English content.

Purpose, prerequisites and outcomes

A survey vehicle should approach its survey line smoothly, continue along it, and report when current or steering limits make the reference infeasible. These are guidance decisions. A heading controller alone cannot decide which heading removes a geometric path error.

Prerequisites are Units 03–06: rotation matrices, planar kinematics, current-relative velocity, and low-level control. The optional shared reference common/control_foundations/en/notes.qmd reviews Lyapunov stability; the derivation below states its own assumptions.

After this unit, you should be able to:

  1. Distinguish path following, trajectory tracking, dynamic positioning and relative-target tracking.
  2. Construct signed line errors and convert explicitly between the course NED convention and the simulator plot.
  3. Derive the ideal straight-line LOS error dynamics and interpret its convergence rate and proof boundary.
  4. Distinguish heading from ground course and check current-compensation feasibility.
  5. Compare reproducible simulator runs using the actual model, logged quantities and limitations.

From mission geometry to motion references

Navigation supplies a state estimate. Guidance turns a mission objective into desired position, velocity, course or heading. Control and allocation attempt to realize those references through available forces. A desired course is therefore a reference, not an achieved velocity measurement (Fossen 2011, Chs. 9–10).

A path specifies geometry without a required time law. Path following regulates distance from that geometry while allowing progress speed to change. A trajectory specifies position as a function of time; following the correct line while arriving late is a tracking error. Dynamic positioning (DP) regulates an earth-fixed position and usually yaw. Relative-target tracking regulates an offset from a moving object whose estimate is supplied to guidance. Each objective requires different errors and feasibility checks.

The guidance output should carry its frame, units, timestamp, validity and limits. For example, a course request without the current estimate needed to turn it into a heading request leaves an interface assumption unstated. The same problem arises if a moving-target position is current but its attitude is stale.

Declare the frame before choosing a sign

The course uses NED navigation coordinates, with planar position 𝒑n=[N,E]⊀\mathbf p^n=[N,E]^\top in metres and heading ψn\psi_n measured from north toward east. Body coordinates are FRD. In this plane,

𝑹bn(ψn)=[cos⁑ψnβˆ’sin⁑ψnsin⁑ψncos⁑ψn] \mathbf R_b^n(\psi_n)= \begin{bmatrix}\cos\psi_n&-\sin\psi_n\\ \sin\psi_n&\cos\psi_n\end{bmatrix}

maps forward/right body components into north/east components. Positive yaw appears clockwise on a north-up map because NED’s third axis points down.

The maintained simulator html/los.html uses a different display convention: xx points east, yy points north, and plot heading ψg\psi_g increases counterclockwise from east. The superscript gg below identifies this plot frame. The mapping is

𝒑g=[xy]=[0110]𝒑n,ψn=wrap⁑(Ο€/2βˆ’Οˆg).(1) \mathbf p^g=\begin{bmatrix}x\\y\end{bmatrix} =\begin{bmatrix}0&1\\1&0\end{bmatrix}\mathbf p^n, \qquad \psi_n=\operatorname{wrap}(\pi/2-\psi_g). \qquad(1)

The same angle mapping applies to path bearing and ground course. Here wrap\operatorname{wrap} chooses an equivalent angle in (βˆ’Ο€,Ο€](-\pi,\pi]; angles in equations are radians unless degrees are explicitly shown. Swapping the two planar components reverses planar orientation. Consequently, the plot’s left-normal cross-track error has the opposite sign to the NED path-frame right-normal error for the same physical path direction.

For a northbound line, a vehicle 5 m east of the line has eyn=+5e_y^n=+5 m in NED but eg=βˆ’5e^g=-5 m in the plot convention. Both must command a correction toward the west. This physical check is more useful than memorizing a sign without a frame.

DP and moving offsets: which error is regulated?

For DP, let the fixed desired position be 𝒑dn\mathbf p_d^n and define the target-minus-vehicle error 𝒑̃n=𝒑dnβˆ’π’‘n\tilde{\mathbf p}^n=\mathbf p_d^n-\mathbf p^n. If a body-axis velocity controller receives the reference, transform the desired velocity, or its position-error input, consistently:

𝒑̃b=(𝑹bn)βŠ€π’‘Μƒn,𝒗dn=𝑲p𝒑̃n,𝒗db=(𝑹bn)βŠ€π’—dn. \tilde{\mathbf p}^b=(\mathbf R_b^n)^\top\tilde{\mathbf p}^n, \qquad \mathbf v_d^n=\mathbf K_p\tilde{\mathbf p}^n, \qquad \mathbf v_d^b=(\mathbf R_b^n)^\top\mathbf v_d^n.

The gain 𝑲p\mathbf K_p has units sβˆ’1\mathrm{s}^{-1}. Under ideal realization 𝒑̇n=𝒗dn\dot{\mathbf p}^n=\mathbf v_d^n, a symmetric positive-definite gain gives 𝒑̃̇n=βˆ’π‘²p𝒑̃n\dot{\tilde{\mathbf p}}^n=-\mathbf K_p\tilde{\mathbf p}^n. This statement does not establish the stability of an actual position–velocity–force cascade with saturation or disturbances. DP also requires sufficient controllable directions and force authority (Fossen 2011, secs. 12.2.8–12.2.10).

For a quick frame check, take a 2 m northward position error while the vehicle faces east (ψn=90∘\psi_n=90^\circ). Its body-frame error is [0,βˆ’2]⊀[0,-2]^\top m: north is to port, not forward.

A moving target adds an offset definition. If target position 𝒑̂tn\hat{\mathbf p}_t^n, attitude ΟˆΜ‚t\hat\psi_t and their timestamps are valid, a target-frame offset 𝒅t\mathbf d^t gives

𝒑dn=𝒑̂tn+𝑹tn(ΟˆΜ‚t)𝒅t. \mathbf p_d^n=\hat{\mathbf p}_t^n+\mathbf R_t^n(\hat\psi_t)\mathbf d^t.

A constant target-frame offset rotates when the target turns. For differentiable estimates and a constant offset, its desired velocity includes

𝒑̇dn=𝒑̂̇tn+𝑹tn[0βˆ’110]𝒅tΟˆΜ‚Μ‡t. \dot{\mathbf p}_d^n= \dot{\hat{\mathbf p}}_t^n+ \mathbf R_t^n\begin{bmatrix}0&-1\\1&0\end{bmatrix} \mathbf d^t\dot{\hat\psi}_t.

Leaving out the second term changes the desired motion during a turn. If target attitude is unavailable, define a navigation-frame offset and state that choice. A camera or acoustic tracker does not automatically provide every quantity this construction requires; Units 09–10 develop the measurement and estimate interfaces.

Signed line geometry and the LOS construction

Derive the guidance law first in the plot frame. Let 𝒑0g\mathbf p_0^g be any point on an oriented infinite line and let Ξ³g\gamma_g be its fixed tangent angle. Define unit tangent and left normal

𝒕=[cos⁑γgsin⁑γg],𝒏=[βˆ’sin⁑γgcos⁑γg]. \mathbf t=\begin{bmatrix}\cos\gamma_g\\\sin\gamma_g\end{bmatrix}, \qquad \mathbf n=\begin{bmatrix}-\sin\gamma_g\\\cos\gamma_g\end{bmatrix}.

For vehicle position 𝒑g\mathbf p^g, the line coordinates and orthogonal projection are

a=π’•βŠ€(𝒑gβˆ’π’‘0g),eg=π’βŠ€(𝒑gβˆ’π’‘0g),π’‘βŸ‚g=𝒑0g+a𝒕. a=\mathbf t^\top(\mathbf p^g-\mathbf p_0^g),\qquad e^g=\mathbf n^\top(\mathbf p^g-\mathbf p_0^g),\qquad \mathbf p_\perp^g=\mathbf p_0^g+a\mathbf t.

Here aa is an along-line coordinate, not a tracking error against a timed reference. Choose a fixed lookahead Ξ”>0\Delta>0 m and a preview point on the tangent line:

𝒑LOSg=π’‘βŸ‚g+Δ𝒕. \mathbf p_{LOS}^g=\mathbf p_\perp^g+\Delta\mathbf t.

Since 𝒑g=π’‘βŸ‚g+eg𝒏\mathbf p^g=\mathbf p_\perp^g+e^g\mathbf n, the vector to this point is Ξ”π’•βˆ’eg𝒏\Delta\mathbf t-e^g\mathbf n. Its bearing is

Ο‡d,g=wrap⁑(Ξ³gβˆ’atan2(eg,Ξ”)).(2) \boxed{\chi_{d,g}=\operatorname{wrap}\!\left(\gamma_g- \operatorname{atan2}(e^g,\Delta)\right).} \qquad(2)

The ratio inside the angle is dimensionless. A vehicle above an eastbound line has eg>0e^g>0 and receives a negative course correction. At eg=0e^g=0 the desired course is the path tangent. A smaller lookahead makes the correction larger at the same error, while a larger lookahead gives a gentler approach (Fossen 2011, sec. 10.3).

In NED use the path-right error eyne_y^n and north-referenced line bearing Ξ³n\gamma_n. The corresponding formula is Ο‡d,n=Ξ³nβˆ’atan2⁑(eyn,Ξ”)\chi_{d,n}=\gamma_n-\operatorname{atan2}(e_y^n,\Delta), wrapped to the chosen interval. The algebraic form is the same; its error and angle conventions must travel with it. For the northbound example, Ξ³n=0\gamma_n=0, eyn=5e_y^n=5 m and Ξ”=10\Delta=10 m give Ο‡d,n=βˆ’26.565∘\chi_{d,n}=-26.565^\circ. In the plot this is Ο‡d,g=116.565∘\chi_{d,g}=116.565^\circ.

What the ideal Lyapunov calculation proves

Assume a straight infinite line, constant through-water speed U>0U>0, no current or sway, and instantaneous heading realization: ψg=Ο‡d,g\psi_g=\chi_{d,g}. There are no steering limits, delays or measurement errors in this calculation. Vehicle kinematics then give

eΜ‡g=π’βŠ€π’‘Μ‡g=Usin⁑(ψgβˆ’Ξ³g)=βˆ’UegΞ”2+(eg)2.(3) \dot e^g=\mathbf n^\top\dot{\mathbf p}^g =U\sin(\psi_g-\gamma_g) =-\frac{Ue^g}{\sqrt{\Delta^2+(e^g)^2}}. \qquad(3)

Choose the positive-definite, proper scalar function

V(eg)=12(eg)2,VΜ‡=βˆ’U(eg)2Ξ”2+(eg)2.(4) V(e^g)=\frac12(e^g)^2,\qquad \dot V=-\frac{U(e^g)^2}{\sqrt{\Delta^2+(e^g)^2}}. \qquad(4)

VV has units m2\mathrm{m}^2 and VΜ‡\dot V has units m2/s\mathrm{m}^2/\mathrm{s}. The derivative is strictly negative for every nonzero error. The scalar vector field is smooth for Ξ”>0\Delta>0, and |eΜ‡g|≀U|\dot e^g|\le U prevents finite-time escape. Standard Lyapunov reasoning therefore gives global asymptotic convergence of this ideal scalar line-error system. It is not a global stability proof for the heading-controlled vehicle.

Near the line, where |eg|β‰ͺΞ”|e^g|\ll\Delta,

eΜ‡gβ‰ƒβˆ’UΞ”eg,Ο„local≃ΔU.(5) \dot e^g\simeq-\frac{U}{\Delta}e^g, \qquad \tau_{local}\simeq\frac{\Delta}{U}. \qquad(5)

This is a local exponential approximation. Far from the line, the magnitude of lateral speed approaches UU, rather than increasing without bound. Do not infer a global exponential rate from the near-line linearization.

The simulator instead uses the heading servo

ΟˆΜ‡g=sat⁑[βˆ’rmax,rmax](kψwrap(ψcmd,gβˆ’Οˆg)), \dot\psi_g=\operatorname{sat}_{[-r_{max},r_{max}]} \left(k_\psi\operatorname{wrap}(\psi_{cmd,g}-\psi_g)\right),

with kψk_\psi in sβˆ’1\mathrm{s}^{-1} and rmaxr_{max} in rad/s\mathrm{rad/s}. Its actual cross-track derivative depends on the current heading, not the commanded course. A positive plotted VΜ‡\dot V during a turn is therefore possible. It disproves monotonic decrease for that run; it does not contradict the ideal calculation whose heading assumption has been removed.

Heading, ground course and current

Let the constant current in plot coordinates be π’˜g=[wE,wN]⊀\mathbf w^g=[w_E,w_N]^\top m/s. The simplified no-sway kinematics are

𝒑̇g=U[cos⁑ψgsin⁑ψg]+π’˜g,Ο‡g=atan2⁑(yΜ‡,xΜ‡). \dot{\mathbf p}^g= U\begin{bmatrix}\cos\psi_g\\\sin\psi_g\end{bmatrix}+\mathbf w^g, \qquad \chi_g=\operatorname{atan2}(\dot y,\dot x).

Heading ψg\psi_g describes the vehicle’s orientation and through-water direction in this model. Ground course Ο‡g\chi_g describes motion over the earth and is undefined at zero ground speed. Their difference can result from current even though the model has no body sway. A real vehicle can also have water-relative sideslip; that is outside this simulator.

For an eastbound line with northward current π’˜g=[0,wN]⊀\mathbf w^g=[0,w_N]^\top, setting heading equal to the LOS course without compensation gives, under ideal heading tracking,

eΜ‡g=βˆ’UegΞ”2+(eg)2+wN. \dot e^g=-\frac{Ue^g}{\sqrt{\Delta^2+(e^g)^2}}+w_N.

When |wN|<U|w_N|<U, the unique steady error is

e*g=Ξ”wNU2βˆ’wN2.(6) \boxed{e_*^g=\frac{\Delta w_N}{\sqrt{U^2-w_N^2}}.} \qquad(6)

The sign of e*ge_*^g follows the current; preserve this sign when solving the squared equation. At this offset the vehicle has enough heading correction to cancel lateral drift. It follows the line direction over the ground, but follows a parallel displaced line. If |wN|β‰₯U|w_N|\ge U, there is no finite equilibrium for this uncompensated rule. This derivation concerns a constant cross-current and the specified idealized kinematics, not arbitrary disturbance rejection.

Known-current compensation and its feasibility

Define unit vectors in the desired ground-course direction, 𝒕d=[cos⁑χd,g,sin⁑χd,g]⊀\mathbf t_d=[\cos\chi_{d,g},\sin\chi_{d,g}]^\top and 𝒏d=[βˆ’sin⁑χd,g,cos⁑χd,g]⊀\mathbf n_d=[-\sin\chi_{d,g},\cos\chi_{d,g}]^\top, and current components wt=𝒕dβŠ€π’˜gw_t=\mathbf t_d^\top\mathbf w^g, wn=𝒏dβŠ€π’˜gw_n=\mathbf n_d^\top\mathbf w^g. A principal-branch crab angle is

Ξ²c=sinβ‘βˆ’1(βˆ’wn/U),ψcmd,g=wrap⁑(Ο‡d,g+Ξ²c). \beta_c=\sin^{-1}(-w_n/U),\qquad \psi_{cmd,g}=\operatorname{wrap}(\chi_{d,g}+\beta_c).

This cancels the current component normal to the desired course under ideal heading realization. Exact forward ground-course tracking also requires

|wn|≀U,Ug=Ucos⁑βc+wt>0.(7) \boxed{|w_n|\le U,\qquad U_g=U\cos\beta_c+w_t>0.} \qquad(7)

Checking only the arcsine argument is insufficient. A strong opposing tangential current can leave the resultant velocity pointing backward. Equality in the lateral condition is a marginal case with poor margin; engineering use requires suitable positive margins, not merely mathematical equality. The simulator warns if normal cancellation is impossible or forward ground speed would be nonpositive, and uses a clamped command for exploration. A clamped command does not establish that the desired course is achieved.

This mode assumes known constant current. It is neither a current estimator nor an integral/adaptive LOS method. Under compensation the realized ground speed generally differs from UU, so the no-current time constant Ξ”/U\Delta/U should not be reported as the exact current-compensated time constant.

Curved paths: which projection and preview?

For a regular planar curve 𝒓(β„“)\mathbf r(\ell) parameterized by arc length β„“\ell, use tangent 𝒕=𝒓′(β„“)\mathbf t=\mathbf r'(\ell), left normal 𝒏\mathbf n and signed curvature ΞΊ\kappa in the plot frame. At a unique smooth closest-point projection,

(𝒑gβˆ’π’“)βŠ€π’•=0,𝒑gβˆ’π’“=eg𝒏. (\mathbf p^g-\mathbf r)^\top\mathbf t=0,\qquad \mathbf p^g-\mathbf r=e^g\mathbf n.

Differentiation gives

eΜ‡g=π’βŠ€π’‘Μ‡g,β„“Μ‡=π’•βŠ€π’‘Μ‡g1βˆ’ΞΊeg,1βˆ’ΞΊegβ‰ 0. \dot e^g=\mathbf n^\top\dot{\mathbf p}^g, \qquad \dot\ell=\frac{\mathbf t^\top\dot{\mathbf p}^g}{1-\kappa e^g}, \qquad 1-\kappa e^g\ne0.

The normal error derivative retains its simple form because the projection residual has zero tangential component. Nevertheless, the construction is local: a curved path can have multiple nearest points or a singular projection. Approaching 1βˆ’ΞΊeg=01-\kappa e^g=0 also reveals why the projection and the required tangent rate can become problematic (Fossen 2011, secs. 10.3–10.4).

The LOS simulator represents a curve as 𝒓(ΞΎ)=[ΞΎ,f(ΞΎ)]⊀\mathbf r(\xi)=[\xi,f(\xi)]^\top and finds a projection by a local Newton iteration. The station ΞΎ\xi is horizontal position, not arc length; β„“Μ‡=1+[fβ€²(ΞΎ)]2ΞΎΜ‡\dot\ell=\sqrt{1+[f'(\xi)]^2}\dot\xi. Its tangent preview 𝒓(ΞΎβŸ‚)+Δ𝒕\mathbf r(\xi_\perp)+\Delta\mathbf t generally lies off the curve. It differs from selecting a future point on the curve at a specified arc-length advance.

With a valid projection and ideal course tracking, the same normal-error calculation is available locally. It does not guarantee globally valid projections, attainable yaw rate or freedom from obstacles. An independently moving virtual target is another construction: its station evolves by a specified law and need not be the closest-point projection. The cooperative simulator’s displayed cross-track quantity is only a local tangent approximation at ΞΎ=x\xi=x, so it must not be substituted for the LOS simulator’s projected error without checking definitions.

Worked numerical checks

Initial correction and a transient that differs from the proof

Take the simulator’s eastbound straight line, U=2U=2 m/s, Ξ”=12\Delta=12 m, eg(0)=16e^g(0)=16 m and zero current. The ideal command is

Ο‡d,g=βˆ’tanβ‘βˆ’1(16/12)=βˆ’53.130∘,eΜ‡g=βˆ’1.6m/s,V=128m2,VΜ‡=βˆ’25.6m2/s. \chi_{d,g}=-\tan^{-1}(16/12)=-53.130^\circ, \quad \dot e^g=-1.6\ \mathrm{m/s}, \quad V=128\ \mathrm{m}^2, \quad \dot V=-25.6\ \mathrm{m}^2/\mathrm{s}.

The near-line time constant is 6 s. With Ξ”=5\Delta=5 m or 30 m it becomes 2.5 s or 15 s respectively, under the same ideal assumptions.

The actual preset starts with ψg(0)=0∘\psi_g(0)=0^\circ. Before the vehicle turns, its actual initial eΜ‡g\dot e^g and VΜ‡\dot V are zero. The ideal numbers above predict a different initial heading assumption. With a 10 degree/s yaw limit, a 53.130 degree turn requires at least 5.313 s even if the command were fixed. The command evolves during motion, so this is a bound for that fixed angular change, not a claimed settling time.

Current bias and the crab angle

For wN=0.8w_N=0.8 m/s with U=2U=2 m/s and Ξ”=12\Delta=12 m,

e*g=12(0.8)4βˆ’0.64=5.23723m. e_*^g=\frac{12(0.8)}{\sqrt{4-0.64}}=5.23723\ \mathrm m.

On the line itself, a compensated eastward course requires ψcmd,g=βˆ’sinβ‘βˆ’1(0.8/2)=βˆ’23.578∘\psi_{cmd,g}=-\sin^{-1}(0.8/2)=-23.578^\circ and gives forward ground speed Ug=4βˆ’0.64=1.83303U_g=\sqrt{4-0.64}=1.83303 m/s. The heading points into the northward current while the ground course is eastward.

For a feasibility counterexample, set U=0.5U=0.5 m/s, wN=1.6w_N=1.6 m/s, Ξ”=3\Delta=3 m and eg=26e^g=26 m. The requested course is approximately βˆ’83.418∘-83.418^\circ. The normal-current magnitude is only 0.18340 m/s, so the arcsine exists, but the computed forward ground speed is approximately βˆ’1.12430-1.12430 m/s. Forward course tracking is impossible despite the lateral check passing.

Formative comparison activity

Use html/los.html from the maintained root collection; the companion quick guide is html/lesson-los.html. This activity replaces the existing unit demonstration and reasoning comparison. It is not an additional graded laboratory.

Reset between runs and record the settings before comparing:

Run Fixed conditions Prediction to test
A Straight line, U=2U=2 m/s, eg(0)=16e^g(0)=16 m, ψg(0)=0∘\psi_g(0)=0^\circ, Ξ”=5\Delta=5 m, kψ=1.8sβˆ’1k_\psi=1.8\ \mathrm{s}^{-1}, yaw limit 35 degree/s, zero current More aggressive correction than B; distinguish the heading transient from the ideal rate.
B As A, but Ξ”=30\Delta=30 m Local ideal time constant 15 s, versus 2.5 s for A.
C As A, but yaw limit 10 degree/s Does aggressive guidance still produce a smooth approach when steering is limited?
D Straight line, Ξ”=12\Delta=12 m, otherwise A, north current 0.8 m/s, compensation off Nonzero final offset near 5.237 m when the transient has decayed.
E As D, compensation on Smaller cross-track error; heading differs from ground course.

Predict signs and rate changes before running. Run each case for 120 simulated seconds, export the CSV and compare signed error, VV, V̇\dot V, heading, desired course and ground course on common time axes. Report final signed error and the maximum absolute error; record whether V̇\dot V becomes positive. Do not fit τ=Δ/U\tau=\Delta/U across the initial large-error or heading-limited interval. A suitable local estimate uses a small-error interval after the heading transient and states the interval used.

The maintained CSV headers state metres, seconds and radians explicitly; they include path/guidance mode, current handling, lookahead, speed, heading gain and yaw limit. Playback changes wall-clock display speed, not the numerical time axis. Numerical integration uses a fixed 0.04 s step with midpoint heading in translation. The model has no hydrodynamic sway, waves, force allocation, sensor noise, current-estimation uncertainty or collision avoidance. A numerical trend is evidence about this model and these settings; it is not a proof or field validation.

If the simulator is unavailable, compute the two worked examples and sketch qualitatively different heading/error histories for ideal versus rate-limited steering. Do not invent observed plots or numerical transient values.

Summary and reading

The LOS rule converts a signed geometric error into a desired course. Its ideal scalar proof requires assumptions about speed, heading realization and current. Actual steering, current, path projection and estimate validity determine whether those assumptions are met. DP and relative-target tracking use different reference errors, and their frame definitions are equally essential.

Core reading is [Fossen (2011), Secs. 10.3–10.4, pp.Β 254–284; Secs. 12.2.8–12.2.10, pp.Β 387–395], using the supplied 2011 first edition. The author-maintained Fossen handbook repository provides supplementary guidance resources; its current slide numbering should not replace the course’s verified 2011 page map. The incoming conversations and simulator are teaching-source leads, not literature authority. These derivations and numerical examples are explicit course developments of the stated models. The lecture source map records their provenance and remaining review status.

References

Fossen, Thor I. 2011. Handbook of Marine Craft Hydrodynamics and Motion Control. 1st ed. John Wiley & Sons. https://doi.org/10.1002/9781119994138.