Professional Documents
Culture Documents
Abstract: This paper presents a quaternion version of the well-known Line-of-Sight (LOS)
guidance algorithm for marine applications. The transformation from Euler angles is achieved
by exploiting the nature of the quaternion structure and using fundamental half-angle formulae
from trigonometry. First, the Euler angles version of the LOS guidance algorithm is briefly
presented for two uncoupled cases: a) the horizontal xy-plane, and b) the vertical zx-plane.
Then, a coupled case is also considered and the transformation procedure is presented for all
three cases. The vehicle considered pertains to a 5-DOF kinematics model where the roll angle is
neglected, typical of torpedo-shaped Autonomous Underwater Vehicles (AUVs). Naturally, the
Euler angles representation of the system involves singularities which, in the general 3-D space
navigation case, should be avoided. The presented method aims at providing a singularity-free
and computationally-efficient version of the conventional LOS algorithm.
pk xe
3.1 Horizontal Plane LOS Guidance
U
xb In the case of decoupled horizontal plane path-following we
LOS
ye vector
assume that θ = 0◦ , consequently the kinematics equation
to be considered is:
ẋ = u cos(ψ) − v sin(ψ), (9)
ẏ = u sin(ψ) + v cos(ψ), (10)
p
ψ̇ = r. (11)
xn
y b
The horizontal-plane speed Uh is given by:
p
Uh := u2 + v 2 , (12)
and is assumed to be positive and bounded:
yn
Uh,min ≤ Uh ≤ Uh,max , 0 < Uh,min . (13)
From (12)–(13) it is implied that the vessel always has
Fig. 1. Line-of-sight guidance geometry for straight lines at least a nonzero surge speed. The reason for setting a
in the xy plane. Here the sideslip angle is equal to minimum positive speed Uh,min is related to the stability
zero. proof of the LOS algorithm and a more rigorous approach
as well as the coupled case. The quaternion transformation is outside the scope of this paper and can be found in
for the uncoupled horizontal plane is given in Section 4, Lekkas and Fossen (2013). The model (9)–(11) includes
for the uncoupled vertical plane in Section 5 and for the only absolute velocities and describes the motion of an
coupled case in Section 6. Some simulation results can be underactuated vehicle since only two out of three DOF’s
found in Section 7, and Section 8 concludes the paper. can be controlled independently, namely the yaw angle and
the surge velocity.
2. VEHICLE MODEL
Path Following Objective: Assuming that the vehicle is
2.1 Vehicle Dynamics assigned to converge to the line connecting the waypoints
WPk –WPk+1 , the along-track and the cross-track error for
Following the methodology of Børhaug and Pettersen a given vehicle position (x, y) are given by:
(2005), for the path-following task we can neglect the roll
xe x − xk
angle, hence for an underactuated autonomous vehicle the = R> (γp ) , (14)
ye y − yk
following 5-DOF dynamic model can be used:
where (xk , yk ) is the position of the k-th waypoint ex-
η̇ = J(η)ν, (1) pressed in the NED frame, and the rotation matrix from
Mν̇ + C(ν)ν + D(ν)ν + g(η) = τ , (2) the inertial frame to the path-fixed reference frame is given
where M is the mass and inertia matrix, C(ν) is the by:
Coriolis and centripetal matrix, D(ν) is the damping cos(γp ) − sin(γp )
R(γp ) = ∈ SO(2). (15)
matrix, g(η) describes the gravitational and buoyancy sin(γp ) cos(γp )
forces, and τ includes the control forces and moments. Moreover,
Accordingly, the generalized position and velocity are xe = (x − xk ) cos(γp ) + (y − yk ) sin(γp ), (16)
recognized as: ye = −(x − xk ) sin(γp ) + (y − yk ) cos(γp ), (17)
η = (x, y, z, θ, ψ)T , ν = (u, v, w, q, r)T , (3) where γp is the horizontal-plane path-tangential angle:
where (x, y, z) is the vehicle’s inertial position in Cartesian γp = atan2(yk+1 − yk , xk+1 − xk ), (18)
coordinates, θ is the pitch angle and ψ is the yaw angle.
Then, the associated control objective for horizontal plane
In addition, u is the surge velocity, v is the sway velocity,
straight-line path-following is:
w is the heave velocity, q is the pitch rate and r is the yaw
rate. lim ye (t) = 0. (19)
t→+∞
2.2 Vehicle Kinematics Note that the along-track error xe does not need to be
minimized in a path-following scenario, the contrary is
The model considers only absolute velocities and is the true for applications that impose temporal constraints.
following, see Børhaug and Pettersen (2005): The lookahead-based guidance law is given by (see Breivik
and Fossen (2009)):
ẋ = u cos (ψ) cos (θ) − v sin (ψ) + w cos (ψ) sin (θ), (4)
−ye
ẏ = u sin (ψ) cos (θ) + v cos (ψ) + w sin (ψ) sin (θ), (5) ψd = γp + arctan . (20)
ż = −u sin (θ) + w cos (θ), (6) ∆h
In the presence of external disturbances, or during turns,
θ̇ = q, (7) the heading angle ψd and the course angle χd are not
1 aligned anymore and are related in the following way:
ψ̇ = r, cos (θ) 6= 0. (8)
cos(θ) χd = ψd + β, (21)
246
IFAC CAMS 2013
September 17-20, 2013. Osaka, Japan
−ye
ψd = γp + arctan − β. (22)
∆h
where
β = atan2(v, u), (23) Uh
which is equal to the orientation of the vehicle’s velocity u xb
vector Uh with respect to the body-fixed frame. In other
words, (23) is the angle between the vehicle’s velocity ori- v
entation and the vehicle’s heading. This is the commonly
known as sideslip, or drift, angle. yb
Uh = u
247
IFAC CAMS 2013
September 17-20, 2013. Osaka, Japan
| {z } | {z }
η ε3 x, z ✓, q
4.1 Transforming ψr to the quaternion qψr Fig. 3. Block diagram of the LOS guidance for the uncou-
pled horizontal and vertical planes.
First we define: γ γ
p p
ye2 + ∆2h := Rh2 (42) qγp = cos + k sin , (57)
2 2
−ye ∆h
sin (ψr ) = , cos (ψr ) = , (43) ∆y
γp = atan2 , (58)
Rh Rh ∆x
Then, since and, for the sake of notational brevity, we define:
ψr ψr q
sin (ψr ) = 2 sin cos , (44) Rxy = ∆x2 + ∆y 2 , (59)
2 2
consequently the quaternion transformation gives:
ψr
cos (ψr ) = 2 cos2 − 1, (45)
2
s
∆x + Rxy
we get: η γp = ± , (60)
2Rxy
sin (ψr ) = 2ε3 η, (46)
∆y
2
cos (ψr ) = 2η − 1. (47) ε3γp = p . (61)
2Rxy (∆x + Rxy )
Combining (42)–(43) with (44)–(45) yields:
−ye
2ε3r ηr = p 2 , (48) 4.3 Transforming β
∆h + ye2
∆h Implementing the same procedure for the sideslip angle β
2ηr2 − 1 = p 2 , (49)
∆h + ye2 yields:
and solving w.r.t. ηr and ε3r gives: β β
qβ = cos + k sin , (62)
r
∆h + Rh 2 2
v
ηr = ± , (50)
2Rh β = atan2 . (63)
−ye u
ε3r = (51) which gives:
2Rh η r
−ye u+U
=p . (52) ηβ = ± , (64)
2Rh (∆h + Rh ) 2U
v
It is important to note that either the positive or negative ε3β = p . (65)
value for ηr can be chosen, hence affecting the sign of εr 2U (u + U )
accordingly. Both cases correspond to the same rotation,
as it is shown by (A.5). Therefore, the corresponding 4.4 Horizontal Rotation Quaternion
quaternion, qψr is written:
A quaternion-based control law system will make use of
r
∆h + R h −ye
qψr = + kp . (53) the horizontal rotation quaternion, qh , which is given by
2Rh 2R(∆h + R) the quaternion products of qψr , qβ , qγp . Therefore:
It can be confirmed that (53) corresponds to a rotation qh = qψr ⊗ qβ ⊗ qγp . (66)
quaternion by computing the norm:
Due to the fact that all the rotations considered in (66)
kqk = η 2 + εT ε (54) are around the z-axis, the order of the multiplication is
2
∆h + R h ye not important. Note, however that this is a special case.
= + (55)
2Rh 2Rh (∆h + Rh )
= 1. (56) 5. VERTICAL LOS GUIDANCE IN QUATERNION
FORM
4.2 Transforming γp to the quaternion qγp
The transformation procedure is similar to the one in
Similarly to Section 5.1 we have: Section 4. A quaternion qθ representing a rotation of an
248
IFAC CAMS 2013
September 17-20, 2013. Osaka, Japan
∆x
ε3αp = p . (84)
zd
q
2Rzx (∆z + Rzx )
Depth Autopilot
Fig. 4. Block diagram of the LOS guidance for the coupled Implementing the same procedure for the angle of attack
horizontal and vertical planes. α yields:
α α
angle θ around the y-axis can be expressed as follows qα = cos + j sin , (85)
(Kuipers, 1999): 2 2
w
α = atan2 . (86)
θ θ
qθ = cos +j sin . (67) u
2 2 which gives:
| {z } | {z } r
η ε3 u + Uv
ηα = ± , (87)
5.1 Transforming θr to the quaternion qθr 2Uv
w
ε3α = p . (88)
2Uv (u + Uv )
ze2 + ∆2v = Rv2 (68)
ze ∆v 5.4 Vertical Rotation Quaternion
sin (θr ) = , cos (θr ) = , (69)
Rv Rv
Then, since As was the case in the previous section, we now calculate
the quaternion qv that describes the total rotation around
θr θr the y-axis for the vertical LOS case:
sin (θr ) = 2 sin cos , (70)
2 2
qv = qθr ⊗ qα ⊗ qαp . (89)
θr
cos (θr ) = 2 cos2 − 1, (71)
2 6. LOS GUIDANCE FOR 3-D COUPLED MOTIONS
we get: IN QUATERNION FORM
sin (θr ) = 2ε3 η, (72)
2
cos (θr ) = 2η − 1. (73) As discussed earlier, the only difference in this case is the
coupled sideslip angle βv . Assuming perfect pitch tracking
Combining (68)–(69) with (70)–(71) yields: (θ = θd ), we have from (35):
ze
2ε3r ηr = p , (74) θ − α = arctan (−∆z/∆x) + arctan (ze /∆v ),
∆2v + ze2
= arctan ((ze ∆x − ∆v ∆z)/(∆x∆v + ze ∆z)), (90)
∆h
2ηr2 − 1 = p
| {z }
, (75) λ1
∆2v + ze2
then we calculate the quantity:
and solving w.r.t. ηr and ε3r gives: q
λ2 := cos(θ − α) = 1/( 1 + λ21 ). (91)
r
∆v + R v
ηr = ± , (76)
2Rv The transformation in this case gives:
ze s
ε3r = (77) Uv λ2 + ζ
2Rv η ηβv = ± , (92)
ze 2ζ
=p . (78)
2Rv (∆v + Rv ) ν
ε3βv = p . (93)
Therefore, the corresponding quaternion, qθr is written: 2ζ(Uv λ2 + ζ)
r
∆v + Rv ze
qr = + jp . (79) 7. SIMULATIONS
2Rv 2R(∆v + Rv )
5.2 Transforming αp to the quaternion qαp In order to test the validity of the transformation method-
ology presented in the previous sections, a simple nu-
Similarly to Section 5.1 we have: merical example was constructed and implemented. The
α
p
α
p
lookahead distance was chosen as ∆h = 4 m and the cross-
qαp = cos + j sin , (80) track error increased linearly from −10 m to +10 m with a
2 2
step of .01 m, hence generating 2001 samples. In Fig. 5 the
−∆z
αp = atan2 , (81) quaternion computed by (53) is presented and Fig. 6 shows
∆x the corresponding Euler angles. It can be observed that the
249
IFAC CAMS 2013
September 17-20, 2013. Osaka, Japan
250