# Modifications to ArduSub That Improve BlueROV SITL Accuracy and Design of Hybrid Autopilot
## 2 ArduSub Alterations
### Changes to ArduSub and Motivation
#### 2.2.1. Thruster Allocation Matrix Overview  
ROVs like the BROV2 owe their high manoeuvrability to the multiple thrusters that their boxy frame carries. Each of these thrusters work in tandem to impart control forces and torques on the body of the vehicle to carry out movements and stabilize the vehicle. For the BROV2 Heavy equipped with eight thrusters, this can be expressed quantitatively,  
\[\mathbf{\tau}=\mathbf{Tm} \tag{1}\]  
where \(\mathbf{\tau}\) is the six-by-one vector of control forces and torques, \(\mathbf{T}\) is the six-by-eight thruster allocation matrix [32], and \(\mathbf{m}\) is the eight-by-one vector of the force contributions of the eight thrusters. The constant matrix \(\mathbf{T}\) is a linear transformation that maps the force and torque inputs of the motors \(\mathbf{m}\) to the overall resultant forces and torques on the vehicle body \(\mathbf{\tau}\). The first three rows of \(\mathbf{T}\) transform the eight thruster input forces into the resultant body linear forces and are constructed column-wise with  
\[\mathbf{T}_{1:3,i}=\big{[}\cos(\alpha_{i})\ \sin(\alpha_{i})\ \sin(\beta_{i}) \big{]}^{\top}, \tag{2}\]  
where \(\alpha_{i}\) is the angle of the \(i\)-th thruster in the horizontal plane of the vehicle and \(\beta_{i}\) is the angle of the \(i\)-th thruster in the perpendicular upright plane (see Figure 3). The vector described in Equation (2) encodes the geometric orientation of the \(i\)-th thruster in space and can be considered a type of unit vector for forces. All the force unit vectors for the eight thrusters' orientations put together form the top three rows of \(\mathbf{T}\), which when given an input \(\mathbf{m}\), outputs the linear forces (i.e., the first three entries of \(\mathbf{\tau}\)). Figure 3 displays the FRD body frame coordinate axes, relative locations, and orientations of the thruster configuration. Thruster 1 is annotated as an example of how \(\alpha_{1}\) is defined: the angle \(\alpha\) follows the right-hand convention for clockwise yaw rotation about the downwards  
Figure 4: The mapping of gestures to control, as proposed by collaborators from University of Florida (UF); the coordinate systems for the human interface follow the Forward–Right–Down (FRD) body-fixed frame convention [19], as pictured. pointing z-axis; \(\beta\) is not visible in the figure but also follows the right-hand convention for pitch rotation about the y-axis. The last three rows of \(\mathbf{T}\) map the thruster force inputs to the resultant body torques and are constructed column-wise with  
\[\mathbf{T}_{4:6,i}=\mathbf{r}_{i}\times\mathbf{T}_{1:3,i}. \tag{3}\]  
where \(\mathbf{r}_{i}\) is the location of the \(i\)-th thruster relative to the vehicle's center of mass, and a cross product is performed with it and the first three rows of the \(i\)-th column of \(\mathbf{T}\) determined earlier in Equation (2). Similar to how Equation (2) is a unit vector for forces, Equation (3) is a unit vector for torques. All the torque unit vectors for the eight thrusters are put together to form the bottom three rows of \(\mathbf{T}\), which when given an input \(\mathbf{m}\), output the angular torques (last three entries of \(\mathbf{\tau}\)). Using the vehicle system geometry presented in [16] and concatenating the eight vectors resulting from Equations (2) and (3), the total thruster allocation matrix for the BROV2 Heavy is given in Equation (4) rounded to two decimal places. Given a vector \(\mathbf{m}\) containing the variable thrust of all eight thrusters, Equations (1) and (4) can determine the control forces and torques \(\mathbf{\tau}\) resulting from the thrusters on the BROV2 body. \[\mathbf{T}= \begin{pmatrix}-0.71&-0.71&0.71&0.71&0&0&0&0\\ 0.71&-0.71&0.71&-0.71&0&0&0&0\\ 0&0&0&0&1.0&1.0&1.0&1.0\\ -0.06&0.06&-0.06&0.06&0.22&-0.22&0.22&-0.22\\ -0.06&-0.06&0.06&0.06&-0.12&-0.12&0.12\\ 0.99&-0.99&-0.99&0&0&0&0\end{pmatrix}