# Modifications to ArduSub That Improve BlueROV SITL Accuracy and Design of Hybrid Autopilot
## 2 ArduSub Alterations
### Changes to ArduSub and Motivation  
In this study, bolded variables represent vectors or matrices and non-bolded variables represent scalars. The body-fixed frame standard for ROS vehicles follows Forward-Left-Up (FLU) relative to an East-North-Up (ENU) inertial frame, whereas ArduSub's body-fixed frame is Forward-Right-Down (FRD), referencing a North-East-Down (NED) inertial frame. In robotics applications that use the ROS, there are certain guidelines that exists known as the ROS Enhancement Proposals (REPs). Generally, the REPs are guidelines to follow that help developers integrate with the larger ROS ecosystem. They serve as valuable touchstones which provide common threads for the community to latch on to, and standardize many fundamental things that help demystify the open-source landscape. For example, the convention that all ROS vehicles follow FLU-ENU is because of REP 103 [28]. There is a longstanding issue that those using the ROS in maritime applications were urged to use FLU-ENU frames by REP 103, but the rest of the industry followed the FRD-NED, also known as forward-starboard-down, FSD-NED, frame conventions. A new REP, 156, puts this issue to rest and advises that ROS users in maritime applications preserve FLU-ENU as the primary frames, but also maintain secondary frames with the appended suffixes \"_fsd\" or \"_ned\" [29]. Readers are also encouraged to follow the ROS Maritime Working Group updates on the ROS Discourse forums [30]. Moving forward, in this section all discussion and theory will reference an FRD-NED/FSD-NED frame if applicable.  
The thruster configuration of the BROV2 Heavy can be seen in Figure 3: horizontal azimuthal thrusters 1-4 create surge, sway, and yaw motions; vertical thrusters 5-8 create heave, roll, and pitch motions; and thrusters are numbered with indices that are referenced from this point onward. The symbols for vehicle states in the inertial frame are \(\mathbf{\eta}=[\mathbf{\eta_{1}},\mathbf{\eta_{2}}]^{\top}\), where linear components are grouped in \(\mathbf{\eta_{1}}=[x,y,z]^{\top}\) and angular components are grouped in \(\mathbf{\eta_{2}}=[\phi,\theta,\psi]^{\top}\). The symbols for velocities in the body-fixed frame are \(\mathbf{\
u}=[\mathbf{\
u_{1}},\mathbf{\
u_{2}}]^{\top}\), where linear components are grouped in \(\mathbf{\
u_{1}}=[u,v,w]^{\top}\) and angular components are grouped in \(\mathbf{\
u_{2}}=[p,q,r]^{\top}\). The symbols for forces and torques are grouped together in a single vector \(\mathbf{\tau}=[X,Y,Z,K,M,N]^{\top}\), where \(\mathbf{\tau}_{1:3}=[X,Y,Z]^{\top}\) are linear forces and \(\mathbf{\tau}_{4:6}=[K,M,N]^{\top}\) are angular torques.  
Figure 3: The BROV2 Heavy has four horizontal azimuthal thrusters and four vertical upright thrusters; the red triangle indicates the forward orientation of the vehicle; propellers of the thrusters shown with the color green (1, 2, 5 and 8) rotate counter-clockwise and those in blue (3, 4, 6, and 7) rotate clockwise, i.e., for the vertical thruster, the green ones have negative rotation about the z-axis and the green ones have positive rotation about the z-axis; the force resultant on the vehicle from positive forward thrust is in the direction of the more textured half of the azimuthal thrusters and downwards (on the page) for the vertical thrusters [31].  
The autopilot design for our intended pilot interface receives desired angular states of the BROV2 from the virtual reality headset orientation in \(\mathbf{\eta}_{2}\), \(\mathbf{\
u}_{2}\), and \(\mathbf{\tau}_{4:6}\) to achieve pilots' desired rotation with closed-loop feedback control. Linear degrees of freedom are currently handled with open-loop control from pilot gestures and handheld controller inputs that do not use error feedback (Figure 4).