Geometric Insight into the Control Allocation Problem for Open-Frame ROVs and Visualisation of Solution

: The overall control system for an open-frame Remotely Operated Vehicle (ROV) is typically built from three subsystems: guidance, navigation and control (GNC). The control allocation plays a vital role in the control subsystem. Typically, open-frame underwater vehicles have p actuators (thrusters) for the motion in the horizontal plane, and the control allocation problem, in this case, is very complex and hard to visualise, because the normalised constrained control subset is a p-dimensional unit cube. The aim of this paper is to give a clear picture and a geometric interpretation of the problem and to introduce a hybrid method, based on the integration of a weighted pseudoinverse and the ﬁxed-point method. The main idea of the hybrid method is visualised, and the deep geometric insight is provided using a “virtual” ROV in low-dimensional control spaces, including visualisation of the attainable command set, solution lines, control energy spheres and the role of pseudoinverse and ﬁxed-point iterations. The same concepts are then extended to higher-dimensional cases, for open-frame ROV with four X-shaped (vectored) horizontal thrusters, which is one of the most common thruster conﬁgurations for commercial ROVs. The proposed hybrid method has been developed, integrated into a generic fault-tolerant ROV control system and evaluated in virtual and real-world environments o ﬀ the west coast of Ireland using observation-class ROV Latis and work-class ROV É ta í n.


Introduction
In general, a fault is the primary cause of changes in the system structure or parameters that eventually leads to degraded system performance or even the loss of the system function. A Fault-Tolerant Control (FTC) system continuously analyses the behaviour of the plant in order to identify faults and changes the control law to hold the closed-loop system in a region of acceptable performance. Fault tolerance includes two steps [1]: (i) Fault diagnosis (the existence of faults has to be detected, and the faults have to be identified); (ii) Control re-design (the controller has to be adapted to the faulty situation so that the overall system continues to have satisfactory performance). Like faults, disturbances and model uncertainties change the plant behaviour and have similar effects on the system. Disturbances and model uncertainties are nuisances which are known to exist, but whose effects on the system performance are handled by appropriate measures like filtering or robust design. On another side, the FTC system is designed to detect the faults and remove their effects by remedial actions, i.e., it is aimed to change the control law in order to cancel the effects of the faults or to attenuate them to an acceptable level. trials demonstrate the effectiveness of the method and the ability of the FTC to complete the mission in the presence of a single (partial and total) fault in a single thruster.

Problem Definition
The interconnection between Guidance, Navigation and Control (GNC) subsystems for open-frame ROV is shown in Figure 1.
• Guidance: subsystem that continuously computes the reference (desired) position, velocity and acceleration of an ROV to be used by the motion control system. • Navigation: subsystem to determine position/attitude, course, travelled distance and (optionally) velocity and acceleration of an ROV. • Control: subsystem to determine necessary control forces and moments to be provided by the ROV to satisfy certain control objective (in conjunction with the guidance system).  [18]).
The control design problem consists of two steps [19]: • STEP 1 (Regulation Task): Design a control law, which specifies desired virtual control input (normalised vector of forces and moments τ d ) in the virtual control space; • STEP 2 (Actuator Selection Task): Design control allocator, which finds the "best" feasible true control input u (normalised command vector to be applied to individual actuators) in the true control space.
In the GNC Signal Flow shown in Figure 1, the Motion Control System and the Control Allocation components execute STEPS 1 and 2, respectively. After actuation with the control vector u, the Propulsion System block will generate a total control effect (vector τ in Figure 1). After normalisation, this vector should be equal to the desired virtual control input τ d in the case of successful control allocation.
Decomposition of the virtual control input τ d into the horizontal and vertical planes is presented in Table 1.
The main focus of the discussion in the following will be based on the control allocation problem in the horizontal plane. However, a similar approach applies to the vertical plane with minor modifications.
The open-frame ROV with four horizontal thrusters in X-shaped (vectored) configuration and three controllable DOF is shown in Figure 2a, while the top view of thruster configuration in the horizontal plane is shown in Figure 2b. This configuration is the most dominant configuration of horizontal thrusters for commercial ROVs. However, the approach can be easily extended to other configurations. For open-frame ROV, shown in Figure 2, dimensions of virtual and true control spaces are k = 3 and m = 4, respectively. For full geometric insight into underlying control allocation problem, the main difficulty is the inability to easily visualise what is happening in 4D true control space during the execution of control allocation solution steps.
To overcome this issue and to provide a clear picture into the geometry of the control allocation solution steps, an artificial "virtual" ROV is introduced (Figure 3), with very specific star configuration of the horizontal thrusters, such that the dimensions of control spaces are reduced by one, i.e., dimensions of virtual and true control spaces are k = 2 and m = 3, respectively. Introduction of the "virtual" ROV provides a framework to visualise concepts and all steps of the solution using 2D/3D figures, including the attainable command set, the shape of control energy spheres, solution lines, pseudoinverse solution, and cases for triggering the fixed-point iterations. The most important feature of the star configuration is the inability of thrusters to create a moment and rotate "virtual" ROV since all thruster axes intersect in a common point, as indicated in Figure 3. Hence, two controllable DoFs are Surge and Sway, while Yaw DoF is not controllable. To simplify notation, the underline and subscript d will be removed from normalised variables in the following text. When vectors/variables are not normalised, it will be stated explicitly. Based on the normalisation method described in [7], the general constrained problem for the "virtual" ROV, and the open-frame ROV can be formulated using normalised variables as indicated in Table 2.

Virtual ROV
Open-Frame ROV Control Allocation Problem (Inequalities (2) and (4) apply component-wise.) For a given v, find u such that For a given τ, find u such that In general case, the equation Bu = τ defines the set of hyperplanes in the true control space R m . The intersection of these hyperplanes is a convex set, denoted by N. The set of inequalities u ≤ u ≤ u represents the hyper box in the same space. This hyper box is called constrained (admissible) control subset and denoted by Ω. The solution set J is given by the intersection of N and Ω. Three cases are possible: • J is empty (i.e., no solution exists), • J has exactly one element (i.e., there is one unique solution), • J has more than one element (i.e., there are many solutions).
The following discussion is limited to Control Allocation Problem for the "virtual" ROV. Equation (1) represents a system of equations Each Equation in (5) represents a plane in R 3 . Consequently, (5) can be rewritten as are normal vectors, orthogonal on planes π 1 and π 2 , respectively. Since the determinant ∆ = 0.1925 0, these planes are not parallel, and their intersection is a line : where t is the parameter of the line. The line is a convex set, denoted by N in the previous discussion. The constrained control subset Ω, which satisfies actuator position constraints (2), is a unit cube in R 3 : Geometric interpretation of the control allocation problem can be obtained by reformulating the problem as follows: For a given v, find the intersection J of (7) and Ω (8) (9) Three cases are possible: • If the intersection is a segment, there is an infinite number of solutions (each point that belongs to the segment is a solution), • If the intersection is a point, there is only one solution, • If the intersection is an empty set, no solution exists.
The output of the Control Allocation subsystem in Figure 1 must be a single vector for all three cases. In the first case above, a secondary criterion (like minimum control energy) is introduced to select a unique solution. In the third case above, the "best" approximation is used as the output of the algorithm. All three cases are discussed in the following in more details.

Nomenclature
The following nomenclature is adopted for referring to Ω, shown in Figure 4 [20]: The boundary of Ω is denoted by ∂(Ω). A true control vector belongs to ∂(Ω) if and only if at least one of its components is at a limit (−1 or +1). Vertices are the points on ∂(Ω) where each component receives a limit (min or max). In Figure 4, vertices are denoted as 0, 1, . . . , 7. In the general case, the number of vertices is equal to 2 m . Vertices are numerated using the following rule: if the vertex is represented in a binary form, then "0" in the k th position of this representation indicates that the corresponding component u k is at a minimum u k = −1, while "1" indicates it is at a maximum u k = +1. For example, binary representation for the vertex 1 is 001. Using the rule it can be decoded as u 1 u 2 u 3 , which refers to the vertex generated by u 1 = −1, u 2 = −1, u 3 = +1. Edges are lines that connect vertices and that lie on ∂(Ω). In Figure 4  Facets are plane surfaces on ∂(Ω) that contain two adjacent edges, i.e., two edges that have a common vertex. In Figure 4, facets are denoted as 0132, 0451, . . . , 7623. In the general case, the number of facets is equal to 2 m−2 m 2 . A facet is defined as the set in the true control space obtained by taking all but two components at their limits and varying the two free components within their limits. For example, for facet 0132 binary representations of its vertices are 000 for 0, 001 for 1, 011 for 3 and 010 for 2. It can be seen that the first digit in these representations is fixed, while the other digits are not fixed, indicating that on this facet the first component is fixed at the limit u 1 = −1, while the other two components u 2 and u 3 are free to vary between their limits [−1, +1].
In the virtual control space R 2 the allowable virtual control subset Φ ( Figure 5) is defined as a set of all allowable virtual control inputs (unit square in R 2 ): Figure 5. The allowable virtual control subset Φ ⊂ R 2 for "virtual" ROV.

Geometric Insight into Problem
Equation (1) defines a linear transformation B from the true control space R 3 to the virtual control space R 2 , which maps (projects) the constrained control subset (unit 3D cube) Ω into attainable command set Φ v ⊂ Φ ( Figure 6). In the general case, the optimal true control input is given by the solution to a two-step optimisation problem [9]: u = arg min W u u − u p p , u ∈ Ψ (11) where u p represents preferred positions of the actuator inputs (preferred true control input) and W u and W v are weighting matrices. The problem defined with (11)- (12) can be interpreted as follows: given Ψ, the set of feasible control inputs that minimise Bu − v (weighted by W v ), find the true control input u that minimises u − u p (weighted by W u ). In Equations (11) and (12) u p , W u , and W v are design parameters. The choice of u p may correspond, for example, to minimum control deflections in aerospace applications. The non-actuated state of the horizontal thrusters is a preferred state for an ROV, i.e., preferred true control input in (11) is u p = 0. Matrix W u can be used for actuator prioritisation, i.e., which actuator should be used primarily. Similarly, matrix W v allows for prioritisation among the virtual control inputs when the problem (11)- (12) has no exact solution. Geometric interpretation of (11)-(12) for "virtual" ROV is given in the following example.  Since v ∈ Φ v , i.e., v is attainable, the problem (11)- (12) can be reduced to min u u p (13) subject to Substituting v 1 = −0.5 and v 2 = 0.6 in (7) yields the following solution line The intersection (solution set) J of (16) and T (for t = t 1 = −123/77) and P 2 = − 1 2 1 0 T (for t = t 2 = 30/77) (see Figure 8). The points P 1 and P 2 belong to facets 0132 and 7623, respectively. The solution of the problem is a point on the segment P 1 P 2 that minimises u p . Hence, the solution depends on the choice of the norm.

Choice of Norm
It is useful to analyse the relationship between the choice of the norm l p , the weighting matrix W u and the solution of the control allocation problem for fault-free and faulty situations.
A set of points u that satisfy the condition W u u − u p p ≤ r is called a weighted sphere S W u u p , r p .
A family of spheres can be obtained by varying radius r. The optimal solution u * is a point where a family of these spheres, centred at u p and weighted by W u , "touch" the set J = P 1 P 2 . Figure 9 illustrates the situation for l 1 norm. The family of spheres is represented by concentric diamond-shaped bodies. If the radius of spheres is increased, for certain value r 1 the sphere S I 3 (0, r 1 ) 1 will touch the segment P 1 P 2 . The touching point is a solution, which minimises u 1 and min u u 1 = r 1 . Case p = 2 is illustrated in Figure 10. Now the shape of the sphere is familiar from the Euclidian metric. The same procedure, as described above, can be applied again: if the radius of spheres is increased, for certain value r 2 the sphere S I 3 (0, r 2 ) 2 will touch the segment P 1 P 2 . The touching point is a solution, which minimise u 2 and min u u 2 = r 2 .

•
In the case when W u is the unity matrix, the l 2 norm distributes the virtual control demand among the control inputs in a uniform way, while the l 1 solution utilises as few control inputs as possible to satisfy the virtual control demand.

•
The l 2 solution varies continuously with the parameters (elements) of B, while the l 1 solution does not. Change in a parameter (element) b of B will produce the change in the slope of . The l 2 solution will vary continuously with b, while it can be shown that the l 1 solution will have discontinuity for some value of b = b * and the solution in the breakpoint b * is not unique.

•
If W u is a non-singular, the problem min u W u u p has a unique solution for p = 2. For p = 1, this is not always the case, as discussed above. The reason lies in the fact that the sphere S W u (0, r) 2 is a strictly convex set, while this is not the case for S W u (0, r) 1 .
In the following, it is assumed that p = 2, i.e., that the l 2 norm is used as a measure of how good a solution (or approximation) is. This norm represents a measure of control effort and l 2 norm of solution (11) can be interpreted as control energy cost function.

Choice of the Weighting Matrix W u
The matrix W u is a design parameter typically used for actuator prioritisation. If all actuators have the same priority, then W u is equal to the unit matrix. Otherwise, the weight of the actuator with less priority is increased. In this way, it is possible to accommodate actuator faults by changing the , then the faulty horizontal thruster HT 3 is penalised for ∆w 3 > 0 and its contribution to the total control effort is less than in the fault-free case (∆w 3 = 0). Consider the same problem as before, but this time ∆w 3 = 1, i.e., W u = diag(1, 1, 2). Since w 3 = 2 > w 1 = w 2 = 1, the third actuator has a lower priority than the other two. Geometrically, weighted spheres in the true control space are compressed along the third control axis and become "flattened" spheres, i.e., ellipsoids, as indicated in Figure 11. In this way, the solution (touching point of the family of ellipsoids with the segment P 1 P 2 ) exhibits a lower contribution of the third control and higher participation of the other two controls, compared to the previous case, when all actuators had the same priority. The additional introduction of nonzero off-diagonal elements into the symmetric matrix W u yields to the rotation of these ellipsoids around the centre.

Description
The hybrid method for control allocation is based on the integration of the weighted pseudoinverse and the fixed-point method and implemented as a two-step process. The weighted pseudoinverse solution is found in the first step. Then, the feasibility of the solution is examined analysing individual components of the solution. If violation of actuator constraint(s) is detected, the fixed-point method is activated in the second step, which results in a guaranteed feasible solution. In this way, the hybrid method can allocate the exact solution, optimal in the l 2 sense, inside the entire attainable command set. This solution minimises the control energy cost function, which is the most suitable criteria for underwater applications.

Introduction
The first step of the hybrid method relies on the fact that an explicit solution to the unconstrained control allocation problem min W u u 2 (17) subject to Bu = v is given by is the weighted pseudoinverse of B [20]. For "virtual" ROV the matrix B † W u is given by where For case W u = I 3 the weighted pseudoinverse (20) is given by (the change of weights in W u produces the change in slope of the parallelogram Ω v and, consequently, the change in shape of Ω p ) The weighted pseudoinverse (18) is mapping from k = 2-dimensional virtual control space to m = 3-dimensional true control space ( Figure 12). The allowable virtual control subset (unit square intersection of the parallelogram Ω v with the constrained control subset Ω is a convex polygon Ω p = R 13 R 15 R 45 R 46 R 26 R 23 , where the vertex R ij lies on the edge i j of Ω. Partitions of the Virtual Control Space are: allowable virtual control subset Φ, attainable command set Φ v and feasible region for the weighted pseudoinverse Φ p . Images of these partitions in the true control space are: The following discussion will address these issues: To find Φ p it is sufficient to find points P ij such that Then (23) can be rewritten as The fact that R ij ∈ i j of Ω means that R ij is bounded to the edge i j defined by vertices i and j, i.e., two coordinates (controls) of R ij are fixed to their limits, while one is free to vary. Recall that the nomenclature for edges, introduced in Section 2.2, enables easy detection of free and fixed controls for i j: binary representations of vertices i and j differ in only one bit and the position of this bit indicates a free control for i j. For example, the edge 13 is determined by vertices 1 and 3. The binary representations of 1 (001) and 3 (011) differ in the second bit, which means that free control is u 13 2 , while fixed controls are u 13 1 = u 1 = −1 and u 13 3 = u 3 = +1. Once the fixed and free controls for i j are obtained, it is easy to find coordinates v ij 1 and v ij 2 of P ij from (24) by removing the equation that corresponds to free control and replacing the right-hand sides of other equations with corresponding limits for fixed controls. For example, for R 13 system (24) can be rewritten as Free control is u 13 2 so the second equation is removed, while the right-hand sides of the first and the third equation are replaced with u 13 1 = u 1 = −1 and u 13 which yields the solution v 13 1 = −0.6875 and v 13 2 = −0.5500. Other vertices can be found similarly, and results are shown in Table 3 (vertices P ij ) and Table 4 is a convex polygon P 13 P 15 P 45 P 46 P 26 P 23 , whose vertex P ij lies on the edge i j of Φ v ( Figure 12).
Subset Φ p represents a part of the allowable virtual control subset Φ attainable (feasible) by weighted pseudoinverse. That is, if v ∈ Φ p , then u * = B † W u (v) = ∩ Ω p and u * 2 = min Bu=v u 2 (see Figure 13). The sphere with the centre at 0 and radius u * 2 is also shown in Figure 13. This sphere touches the solution line at u * . In other words, if the virtual control input lies in Φ p , then the weighted pseudoinverse solution is the intersection of the solution line and parallelogram Ω p = B † W u Φ p , it is feasible and has a minimal l 2 norm compared to any other solution. Otherwise, if v Φ p , then u = B † W u (v) Ω, which means that the virtual control input v is not feasible with weighted pseudoinverse, although some other choice of general inverse or application of other methods, like the fixed-point method, could find a feasible solution. This aspect of the relationship between the position of the virtual control input and the feasibility of the solution is important and discussed in the following example. Example 2. Consider the control allocation problem (1)-(2) and let S = v 1 v 2 T denotes an arbitrary point from the allowable virtual control subset Φ. Recall that a total solution set J is given by the intersection of the line (7) and Ω. When a point S moves inside Φ, the corresponding line moves in the true control space. For a given S, the weighted pseudoinverse will select the solution from J where the line intersects the parallelogram Ω v . Three characteristic cases are possible, regarding the position of S relative to the partitions of Φ ( Figure 14):  Figure 15). A solution set is a segment J 1 = 1 ∩ Ω. This segment intersects the parallelogram Ω v in the point T 1 = J 1 ∩ Ω v . From all solutions in J 1 , the solution T 1 , selected by weighted pseudoinverse, is optimal in l 2 sense. represents the point where the segment P 1 P 2 intersects the parallelogram Ω v . This solution is feasible since it belongs to Ω.

Case 2.2:
In this case, point S 2 lies outside Φ p , but inside Φ v . The image T 2 = B † W u (S 2 ) lies outside Ω p , but inside Ω e (Figure 16). Geometrically, a solution set is the segment J 2 = 2 ∩ Ω that does not intersects with Ω v , which means that the weighted pseudoinverse solution T 2 lies on J 2 = 2 but outside J 2 , i.e., T 2 Ω. Hence, the virtual control input S 2 is unfeasible (unattainable) by weighted pseudoinverse, but, because J 2 is not empty, some other methods (like fixed-point method) can allocate solution from J 2 , optimal in l 2 sense.  Figure 17). The image Figure 17). In this case line 3 does not intersect with Ω, i.e., J 3 is an empty set, and the exact solution of the problem does not exist. The weighted pseudoinverse solution T 3 is unfeasible, since it does not belong to Ω. For example, if S 3 = −0.9000 0.5000 T , then the solution line = 3 (7) is given by 3 The line 3 does not intersect Ω, and the exact solution of the control allocation problem does not exist ( Figure 17). However, the intersection of 3 and Ω v is the weighted pseudoinverse solution This solution lies outside Ω and is not feasible. This example demonstrated that the weighted pseudoinverse could allocate the exact solution (optimal in l 2 sense) only if the virtual control input v lies in Φ p . Otherwise, if v ∈ Φ\Φ p , the weighted pseudoinverse finds solutions that lie outside Ω, i.e., that violate control constraints. The approximation of these solutions is the topic of the following section.

Approximation of Unfeasible Solution
If a virtual control input v lies outside Φ p (for example, S 2 and S 3 in Figure 14), then the weighted pseudoinverse solution u = B † W u v is unfeasible and lies outside Ω, i.e., it violates control constraints (T 2 in Figure 16 and T 3 in Figure 17). In this case, it is necessary to approximate unfeasible u Ω with feasible u * ∈ Ω such that Bu * ≈ v.

Definition 1. (Approximation Error):
The approximation error is defined as e = v − v * , where v is the virtual control input, v * = Bu * is an approximation of v and u * is an approximation of u = B † W u v. To be able to compare different approximations, two scalar errors are introduced: direction error θ = cos −1 v T ·v * v 2 v * 2 and magnitude error e 2 = v − v * 2 . The direction error represents the angle between v and v * , while the magnitude error represents the module of the approximation error vector e (Figure 18). In the case when θ = 0, the approximation v * preserves the direction of the original vector v. Two common approximations (Truncation and Scaling) are defined in the following: Truncation (T-approximation): In this case approximation u * t is obtained from u by truncating (clipping) all controls that exceed their control constraints.
Scaling (S-approximation): In this case approximation u * s is obtained from u by scaling all components by factor f such that u * s = f u ∈ ∂ Ω p . T-approximations (T * 2t and T * 3t ) and S-approximations (T * 2s and T * 3s ) of unfeasible weighted pseudoinverse solutions T 2 (Case 2.2) and T 3 (Case 2.3) are shown in Figure 19, respectively.

Remarks 2.
• T-approximation u * t of the unfeasible pseudoinverse solution, u introduces direction error θ t 0, i.e., vectors v and v * t have not the same direction. At the same time, the direction error θ s = 0 for S-approximation u * s , i.e., vectors v and v * s always have the same direction, but the magnitude error e s 2 = v−v * s 2 is greater The fixed-point method (Section 3.3) is able to improve the T-or S-approximation of the unfeasible weighted pseudoinverse solution u. Approximations u * t or u * s can be used as the initial iteration u 0 and the algorithm will find the solution u * f such that v * f = Bu * f is a better approximation of v than v * t or v * s . This feature is the main idea of the hybrid approach for control allocation.

Introduction
The fixed-point method [21] finds the control vector u that minimises subject to (2), where |ε| < 1. The algorithm proceeds by iterating on the equation where and sat[u] is the saturation function that clips the components of the vector u to their limits. The condition for stopping the iteration process is The fixed-point algorithm is very simple, and most computations need to be performed only once before iterations start. The only condition for the initial point is u 0 ∈ Ω. However, the number of iterations depends on the desired accuracy and the choice of the initial point (solution). To improve efficiency, authors [22] suggest selecting the initial point u 0 as the true control input calculated at the previous time sample, i.e., u 0 (t) = u(t − T). Design parameters of the fixed-point method are W u , W v , ε and tol. Example 3. In this example, the fixed-point method is used to find a feasible solution for Case 2.2 from Example 2, optimal in l 2 sense. Design parameters are W u = I 3 , W v = I 2 , ε = 10 −6 and tol = 10 −6 . Results are shown in Figure 20 and Table 6. Since the (unfeasible) pseudoinverse solution u 2 = T 2 has been already found (Figure 16 Figure 20a. Individual iterations are shown as black dots if they start from the T-approximation, and as red dots, if they start from the S-approximation. Details about iterations are given in Table 6. If v 2 ∈ Φ v \Φ p , the fixed-point algorithm converges toward the exact solution T * 2 f = P 1 , which lies on the solution set J 2 and has a lower l 2 norm than any other point in J 2 . The corresponding sequence in the virtual control space converges toward the desired S * 2 f = S 2 (Figure 20b).

Algorithm (Hybrid Method)
Step 1: For a given τ d (v d ), find the weighted pseudoinverse solution.
Step 2: If the solution is feasible, go to Step 4.
Step 3: Use the fixed-point method (Section 3.3) to find a feasible solution.
Step 5: Deliver the output to the Thruster Interface module.
It should be emphasized that the number of fixed-point iterations, performed to find the feasible solution for cases when the weighted pseudoinverse solution is unfeasible, depends on the desired accuracy and the choice of the design parameters. The desired accuracy is closely related to requirements imposed by the Thruster Interface module. For example, some thruster control protocols require desired velocities to be presented as integer numbers between −100 and +100. This means that the true control space for motion in the horizontal plane is discretised by the uniform grid of 201 4 = 1.632240801 × 10 9 discrete control vectors and each solution must be rounded to the closest point in the grid. Design parameters must be chosen to take into account these issues.

Extension of Concepts from "virtual" ROV to Open-Frame ROV
In previous sections, the main idea of the hybrid method is visualised, and the deep geometric insight is provided using a "virtual" ROV in low-dimensional control spaces, including visualisation of the attainable command set, solution lines, control energy spheres and the role of pseudoinverse and fixed-point iterations. In this section, the same concepts are extended to higher-dimensional cases, for open-frame ROV with four X-shaped (vectored) horizontal thrusters.
Equation (3) defines a linear transformation from the true control space R 4 to the virtual control space R 3 , which maps (projects) the tesseract Ω into attainable command set Φ v (see Figure 21), a subset of the allowable virtual control subset Φ (the unit 3D cube), defined as Coordinates of vertices of Ω and Φ v are shown in Table 7. Recall from Section 2.2 that the component values (controls) of u in a vertex can be decoded from its binary representation. For example, decoding the binary representation 1000 of the vertex 8 yields u 1 = +1, u 2 = −1, u 3 = −1 and u 4 = −1.  For the X-shaped configuration of horizontal thrusters the matrix B † W u is given by

Label Coordinates Label Coordinates
Feasibility of the weighted pseudoinverse solution depends on the position of virtual control input τ inside the allowable virtual control subset Φ. For a fault-free case, when W u is the identity (unit) matrix, the shape of the feasible region for the pseudoinverse Φ p , defined as a set of virtual control inputs τ that satisfy (38) subject to u ∈ Ω, is shown in Figure 22. The boundary of a convex polyhedron Φ p represents a set of all virtual control inputs for which at least one component of the pseudoinverse solution (38) receives extreme value. This boundary is determined by the intersection of the four pairs of parallel planes π + k (π − k ), k = 1, 4, where the plane π + k (π − k ) represents a set of all virtual control inputs for which k th component of solution (38) satisfies u k = +1 (−1). The weighted pseudoinverse can find the exact feasible solution of the control allocation problem, optimal in the l 2 sense, only if τ d ∈ Φ p . Geometrically, Equation (38) defines a linear transformation from the virtual control space to the hyperplane Π in the true control space 4 . The intersection of this hyperplane with the hyper line (solution of Bu = τ) is the point u * where the family of weighted hyperspheres "touch" the hyper line . Since τ ∈ Φ p , this intersection determines a feasible solution u * = B † W u τ ∈ Ω, optimal in l 2 sense. The main issue with the weighted pseudoinverse is that the feasible region for the weighted pseudoinverse Φ p is a subset of attainable command set Φ v (Φ p ⊂ Φ v ), and the weighted pseudoinverse cannot find an optimal feasible solution on the entire Φ v .
Extending ideas from Section 3.2, the allowable virtual control subset Φ can be partitioned into characteristic regions, as indicated in Figure 23. The two characteristic regions inside Φ are Φ p and Φ v ⊃ Φ p . The weighted pseudoinverse is able to find the exact feasible solution of the control allocation problem, optimal in l 2 sense, only if τ ∈ Φ p . Otherwise, for τ ∈ Φ v \Φ p , the solution obtained by weighted pseudoinverse is unfeasible. However, the fixed point method can find the solution, optimal in l 2 sense, for case τ ∈ Φ v \Φ p . Finally, for case τ ∈ Φ\Φ v , the solution does not exist, and approximation must be used (for example, T-approximation (truncation) or S-approximation (scaling), as described in Section 3.2.2).
It is useful to visualise the change in shapes of the attainable command set Φ v and the feasible region for the weighted pseudoinverse Φ p depending on faulty thruster states. In the fault-free state, all thrusters are equally prioritised, and the actuator position constraint in (4) is |u k | ≤ 1 for each component. In faulty case, faulty thruster HT i is penalised such that |u i | ≤ s i < 1. The numerical value of the constraint bound s i depends on the type of fault.
Change in the constraint bound yields to increase of corresponding weight in the weighting matrix where In the faulty case, restriction of constraints bounds reduces the size of the constrained control subset Ω, i.e., Ω is "clipped" to new actuator position constraint s i for an ith component of u. The image of the "clipped" Ω under mapping (3) is reduced attainable command set Φ v . Hence, the feasible region for the pseudoinverse Φ p and the attainable command set Φ v decrease in the case of a fault in the single thruster. In particular, Figure 24a displays Φ p only and Figure 24b shows Φ p &Φ v for the case of a partial fault in HT 2 (s 2 = 0.5, w 2 = 3). Analysing (37) and (38), the geometrical interpretation of change in the shape of Φ p can be obtained by observing that the change of weight w 2 yields the change of slopes of the planes π − k and π + k , k ∈ {1, 3, 4}, while the planes π − 2 and π + 2 with actuator position constraints −0.5 and +0.5 respectively moved closer to the origin, staying parallel, without changing their slopes. The image of the "clipped" constrained control subset Ω is the reduced attainable command set Φ v , as shown in Figure 24b. It can be seen that the relation Φ v ⊃ Φ p is still valid, i.e., the weighted pseudoinverse is not able to find a feasible solution for case τ d ∈ Φ v \Φ p . Similar to the fault-free case, the fixed-point method is triggered in this case, able to find a feasible solution optimal in l 2 sense. In this way, the hybrid method allocates the entire attainable command set optimally, despite the limited (restricted) usage of a faulty thruster.  Partitions of the allowable virtual control subset for the extreme case (shutdown of HT 2 ) is shown in Figure 25. In particular, Figure 25 displays Φ p ≡ Φ v . for the case of a total fault in HT 2 ( s 2 = 0.0, w 2 → ∞) . This means that the thruster HT 2 is disabled and the redundancy is eliminated by removing the variable u 2 and the second column of matrix B from (3). The modified thruster control matrix B is a non-singular 3 × 3 square matrix, and the problem can be solved in a standard way. The ratio of volumes of attainable command sets in Figures 24b and 25 relative to the full size Φ v (Figure 23), can be used as a measure of loss in manoeuvring capabilities. Figure 25. Partitions of the allowable virtual control subset Φ for X-shaped configuration of horizontal thrusters (total fault in HT 2 , The constrained control subset Ω becomes the 3D unit cube, a subset in 4D virtual control space, defined as Ω = (u 1 , 0, u 3 , u 4 ) ∈ 4 : |u 1 | ≤ 1, |u 3 | ≤ 1, |u 4 | ≤ 1 (41) Ω is mapped by modified B to Φ v , which coincides with Φ p , as indicated in Figure 25.

Testing and Validation
The hybrid method for control allocation, described in this paper, has been used as a foundation to build the thruster Fault-Tolerant Control system (FTC). The performance of FTC has been evaluated and validated in a virtual and real-world environment.

Evaluation of the FTC in Virtual Environment
In the virtual (simulated) environment thruster faults are simulated by varying properties of the dynamic thruster model (load, friction, etc.) inside the propulsion subsystem of the ROV dynamics simulator. More information about simulation models can be found in (Omerdic, 2009). To enhance the graphical presentation of simulation results, a virtual underwater world has been developed with open-frame ROV model moving in an underwater environment. The relative position of different objects in the underwater world is shown in Figure 26. Three particular objects (the rock with a hole in the middle, long pipe and "Stonehenge"-like group of rocks) were used throughout the number of test cases to evaluate the manoeuvring capabilities and performance of the ROV when equipped with the FTC. Selected test cases will demonstrate the ability of the FTC to complete the mission in the presence of a single (partial and total) fault in HT 2 . Diagrams for fault-free and faulty cases are shown next to each other, to provide an easier comparison. Command inputs in test cases were generated using pre-defined signals read from a file.
Two criteria are introduced to measure control effort over time: Weighted criterion : and Normal criterion : The weighted criterion J W u , minimised by the hybrid method, can be interpreted as a weighted control energy cost function. In contrast, the normal criterion J n represents the actual control energy cost function, that is, a real measure of control effort. In fault-free case J W u = J n , whereas in faulty situations, J W u ≥ J n . Criteria J W u and J n are denoted in diagrams as J W and J n , respectively.

Partial Fault in HT 2
This test case compares the performance of the FTC for two cases. In the first case, a simulation was performed assuming fault-free states in all thrusters. The second case considered fault-free states in thrusters HT 1 , HT 3 and HT 4 , and a faulty state in thruster HT 2 (partial fault, s 2 = 0.5). The same command input vector τ d (t) was used to drive the ROV model in both cases. The mission objective was to move the vehicle from the start point A through the pipe along the straight line. Figure 27a displays time diagrams of τ d (t), τ(t), u(t), J W u (t), J n (t), v(t) and Ψ(t), the plan view of the trajectory (x E (t), y E (t)) and partitions Φ p & Φ v of the allowable virtual control subset Φ for the first case. Diagrams for the second case are shown in Figure 27b. It can be seen that, in the fault-free case, the vehicle performs the perfect straight-line motion, vector τ d (t) lies inside Φ v for all time and τ d (t) ≡ τ(t), J W u (t) ≡ J n (t), ∀t. The situation is different for the second case, where the limited usage of HT 2 reduction in the size of the Φ p and Φ v (see Figure 24), and the trajectory τ d (t) becomes partially unfeasible, i.e., τ(t) lies partially outside Φ v . The FTC uses the S-approximation to approximate unfeasible solutions in these cases, which leads to an approximation τ(t) = τ s (t) with the same direction as unattainable command input τ d (t), but lower magnitude. The unfeasible part of trajectory τ d (t) is characterised by relationship τ(t) = τ d (t) and indicated as shadowed regions in time responses shown in Figure 27b. Pairs of thrusters HT 1 & HT 2 and HT 3 & HT 4 are equally actuated for straight-line motion (u 1 (t) = u 2 (t) and u 3 (t) = u 4 (t), respectively). The velocity profile v(t) follows the profile of τ X (t), which is now different than τ Xd (t), and the vehicle moves slower in shadowed region than in the fault-free case. However, heading Ψ(t) is constant in both cases, but trajectories (x E (t), y E (t)) are slightly different. The first difference stems from the fact that the higher forward velocity in the fault-free case means that the vehicle covers a longer distance than in the faulty situation, i.e., AB f ault− f ree > AB partial f ault in HT2 . The second difference comes from the shapes of the trajectories (x E (t), y E (t)). In the first case, it is a perfectly straight line, whereas, in the second case, although symmetrical pairs of thrusters have opposite spin direction coefficients, the vehicle is shifted from the straight line, such that the drift at the endpoint B is approximately 2.7cm. The drift is caused by unequal actuation of symmetrical thrusters in the second case, which leads to non-zero angular moments from these pairs, resulting in non-perfect straight-line motion of the vehicle. This test case demonstrates that, in the presence of a single partial fault in HT 2 , the faulty vehicle is able to perform straight-line motion with satisfactory performance. An unavoidable effect is a drop in forward velocity for cases when the command input vector τ d (t) lies outside reduced Φ v .

Total Fault in HT 2
This is an extreme case, where HT 2 is switched off, and the mission must be accomplished with three remaining horizontal thrusters. Recall from Figure 25 that Φ p and Φ v have the same shape (small parallelepiped inside the virtual control space), as indicated in Figure 28b. The volume of Φ p and Φ v is smaller than in Section 4.1.1, which yields the wider shadowed region, i.e., the larger unfeasible part of the trajectory τ d (t). Besides, a drop in velocity v(t), is larger for this test case. The faulty vehicle covers the shorter distance (AB f ault− f ree > AB total f ault in HT2 ) and the drift at the endpoint B is approximately 2.7cm. Nevertheless, again the heading Ψ(t) is constant for all time. This test case reveals an important feature of the FTC; that is, despite the presence of a total fault in HT 2 , which is switched off, the vehicle, equipped with the FTC, is able to continue the straight-line motion and complete the mission with acceptable performance. As in previous cases, the unavoidable consequence is a drop in velocity for cases when the command input vector τ d (t) lies outside reduced Φ v .
Materials and Methods should be described with sufficient details to allow others to replicate and build on published results. Please note that publication of your manuscript implicates that you must make all materials, data, computer code, and protocols associated with the publication available to readers. Please disclose at the submission stage any restrictions on the availability of materials or information. New methods and protocols should be described in detail while well-established methods can be briefly described and appropriately cited.

Evaluation of the FTC in Real-World Environment
The FTC has been used as a foundation for the development of OceanRINGS, a set of smart technologies for subsea operations. The OceanRINGS [23] is a generic fault-tolerant ROV control system, built to make complex subsea tasks simple, and which combines state-of-the-art navigation equipment with the best control algorithms and emerging VR technologies to provide smart, intuitive and easy to use user interface, enabling average pilots to achieve exceptional results. The performance of FTC has been evaluated and validated during several research cruises in period 2009-2019 off the West coast of Ireland using observation-class ROV Latis and work-class ROV Étaín. Smart, multiple modes of operation observation-class ROV Latis [23] (Figure 29a) has been designed at UL in period 2006-2009 and used as a prototype platform to design and develop OceanRINGS modules. The work-class ROV Étaín (modified ROV Comanche by SubAtlantic, Figure 29b) has been extended with OceanRINGS control suite. Dual-mode of operation provides an opportunity to evaluate the performance of both control systems under the same conditions. Selected results from these trials, related to testing of fault-tolerant control system features, are described in the following.

Path Following: Simulated Faults
The path following test with simulated faults has been performed during the research cruise in Bantry Bay (Figure 30) when ROV Latis has been deployed from support vessel Celtic Voyager in free-swimming mode. Since the vessel Celtic Voyager was not equipped with Dynamic Positioning (DP) system, it used an anchor to hold the position during the test.  Figure 31. The main objective was an evaluation of the FTC performance in path following, with simulated faults in single thrusters along the path. Thruster states along path segments are given in Table 8. The main sensor system for navigation, integrated on ROV Latis, was iXBlue PHINS, with several aiding sensors: GAPS USBL, RDI DVL, GPS and Digiquartz pressure depth sensor.   Figure 32 shows path-following performance along segment 01, with all thrusters ON. Desired speed was set to 0.3 m/s. 3D real-time view is shown in the upper right corner, while schematic showing thruster states is shown in the lower right corner. Above ROV 3D model, desired and actual velocity vectors are displayed as green and red cylinders, respectively. Raw ROV position estimation data obtained from the USBL system are shown as a red trace, while the position estimation from PHINS is shown as a yellow trace. The PHINS output has been used for path-following algorithm. "Jumps" in USBL raw data are due to multi-path issues while operating in shallow water (7 m depth).
The anchored support vessel Celtic Voyager was moving in lateral direction oscillating around the fixed position due to high winds. This motion introduced significant pull out forces on ROV via umbilical and the FTC had to compensate this disturbance while performing path following. After the way-point 2 has been reached, the total fault in HT 4 has been simulated by setting the saturation bound s 4 = 0.0. Figure 33 shows path-following performance along segment 23, with thruster HT 4 disabled. No significant deviation from the desired path was noticeable during the transition stage, and ROV continued to follow the path without the change in speed, as indicated in 3D view in the upper right corner (the actual velocity vector (red) has the same module and direction as the desired velocity vector (green)). This performance has been predicted in Section 4.1.2, since the command input vector τ d (t) required to follow desired speed 0.3m/s lies inside reduced Φ v (Figure 25) all the time on the path segments 23 and 34.
After the way-point 4 has been reached, thruster HT 4 has been re-enabled (s 4 = 1.0), but the total fault in HT 2 has been simulated by setting the saturation bound s 2 = 0.0. Figure 34 shows path-following performance along segment 45, with thruster HT 2 disabled. Similar to the previous case, no significant deviation from the desired path was noticeable during the transition stage, and ROV continued to follow the path without the change in speed, as indicated in 3D view in the upper right corner.

Complex Tasks with Faulty Thruster
The performance of FTC has been evaluated and validated during research cruise CE-19001 in January 2019, when the work-class ROV Étaín (Figure 29b), deployed from support vessel Celtic Explorer via Tether Management System (TMS), successfully performed several complex subsea tasks with a simulated fault in the horizontal front-left thruster HT 1 ( s 1 = 0.0, w 1 → ∞) (Figure 35c).

Circular Arc
The main task was to move the ROV with a constant velocity of 0.2m/s along the circular arc, with heading pointing toward the centre P 4 (Figure 35a,b). The screenshots of CCW and CW trajectories are shown in Figure 34a,b respectively. Desired surge speed was set to 0.0m/s, while desired sway speed was set to +0.2m/s (CCW motion) and −0.2m/s (CW motion). The heading controller used the "Fixed Point" mode, with the ROV heading directed toward the fixed point P 4 . In both cases, ROV trajectories were almost perfect circles, demonstrating a high quality of the thruster FTC in performing complex subsea manoeuvring. The same task has been trialled in the manual mode (with a joystick as an input device) by professional ROV pilot with disabled FTC, but the performance was not satisfactory.

Path Following
For this test, ROV had to follow the path (square) defined with four points 0, 1, 2 & 3 with constant speed 0.2m/s and constant heading 300 • . The screenshots of the main pilot screen during the subsea path following with a fault in a single thruster are shown in Figure 35d,e. In particular, the ROV position approaching the point 1 is shown in Figure 35d. After reaching waypoint 1, the vehicle continued to move toward 2 along the straight-line segment (Figure 35e). The same task has been given to a professional ROV pilot to execute under the same fault conditions, with disabled FTC (Figure 36). The ROV pilot had to maintain the heading and speed by applying manual compensation for unbalanced moment components, due to lack of contribution from the faulty thruster. Non-perfect compensation led to the poor tracking performance and oscillatory character of the heading response, as shown in Figure 36.

Conclusions
This paper presented a hybrid method for control allocation, able to allocate a feasible solution of the control allocation problem, optimal in l 2 sense, on the entire attainable command set in real-time. The paper provides a clear geometric interpretation of the underlying control allocation problem and deep insight into each step of the solution using a "virtual" ROV in low-dimensional control spaces. Then, the same concepts are extended to higher-dimensional cases, for open-frame ROV with four X-shaped (vectored) horizontal thrusters.
The hybrid method for control allocation is based on the integration of the weighted pseudoinverse and the fixed-point method. The weighted pseudoinverse method is a member of a family of generalised inverses and is the one that yields minimum control energy. The main disadvantage of the weighted pseudoinverse method is its inability to find the exact solution of the control allocation problem on the entire attainable command set, i.e., the feasible region for pseudoinverse is a subset of the attainable command set. In contrast, the fixed-point method can find the exact solution on the entire attainable command set. The price paid is the necessity to perform iterations at each program step. The number of iterations depends on design parameters and choice of initial iteration. The hybrid approach for control allocation originates from the integration of features of the weighted pseudoinverse and fixed-point method: the weighted psudoinverse method is used for cases when control inputs lie inside the feasible region for pseudoinverse, and the fixed-point method is used otherwise.
The performance of the thruster FTC system, whose main pillar is the hybrid method, has been evaluated not just in simulation, but in a real-world environment with observation-class ROV and work-class ROV through a series of complex, challenging subsea tasks in order to examine the performance of the FTC in fault-free and faulty conditions. Simulation results show that the FTC provides adequate reallocation in faulty situations, keeping all three DOF in the horizontal plane fully controllable, making it possible to control the motion of the faulty vehicle in a satisfactory way. Using different indicators and visualisation tools, the FTC can inform the ROV pilot about the position of actual command inputs relative to attainable command set. Using this information, even an inexperienced ROV pilot can detect the situation when thruster velocity saturation occurs and to correct the command inputs such that it becomes attainable. Results of real-world tests show that piloting of faulty ROV in pure manual mode was too hard task for a professional ROV pilot, i.e., disabling the faulty thruster without appropriate reallocation led to poor tracking performance and oscillatory character of yaw response during the way-point path following task. Execution of the same task with the FTC enabled led to a redistribution of available control energy among remaining operable thrusters, resulting in significant improvements in the global control performance of the vehicle in faulty situations.