# Design, Modeling, and Simulation of a Wing Sail Land Yacht
## 2 Materials and Methods
### Platform Simulation
#### 2.3.3. Gazebo Plugins  
The simulation of the land yacht uses three plugins: a modified liftdragplugin (Gazebo aerodynamics plugin: [[http://gazebosim.org/tutorials?tut=aerodynamics&cat=physics](http://gazebosim.org/tutorials?tut=aerodynamics&cat=physics)]([http://gazebosim.org/tutorials?tut=aerodynamics&cat=physics](http://gazebosim.org/tutorials?tut=aerodynamics&cat=physics)), accessed on 19 March 2021) and two new plugins named land_yacht_plugin and land_yacht_appar_wind. The land_yacht_plugin enables the control from ROS of the wing sail flap and of the land yacht steering; and the land_yacht_appar_wind plugin simulates an apparent wind sensor (velocity and direction of the wind relative to the land yacht). The liftdragplugin simulates the aerodynamic forces and the pitching moment on an airfoil (the torque generated by the wind on the airfoil), since it was developed for airplanes. Given that an airfoil on a land yacht is positioned vertically, the plugin will calculate the yawing moment. In short, the liftdragplugin, apart from generating lift and drag forces, also aligns the wing sail to the direction of the wind. However, this plugin was created to simulate these forces on aeroplanes or fixed wing drones in windless conditions. In other words, this plugin assumes the world's wind velocity corresponds to the world's linear velocity of the vehicle, which, in this case, is only partially correct. The plugin was modified to add the world's wind velocity to the world's linear velocity of the vehicle. For example, if the vehicle is moving westward with a linear velocity of \(1\,\mathrm{m/s}\) and there is a westerly wind of \(2\,\mathrm{m/s}\), then the two linear velocities are added, generating a total apparent wind velocity of \(3\,\mathrm{m/s}\). Without this change, the apparent wind velocity would remain \(1\,\mathrm{m/s}\). Finally, the plugin was also adapted to subscribe a ROS topic that broadcasts the world's wind velocity in the \(x\) and \(y\) axis. Figure 5 displays a diagram that details the processing pipeline of the modified plugin. Before calculating the lift and drag forces, the plugin subtracts the vehicle linear velocity and the true wind velocity in the world frame and, subsequently, uses the vehicle orientation to establish the apparent wind, which corresponds to the relative wind to the vehicle. With the apparent wind and the wing sail angular position, the plugin calculates the wing sail angle of attack (AoA) and, using the linearized airfoil parameters, determines the lift and drag coefficients. With these coefficients, the plugin calculates the lift and drag forces to get the resulting force. This resulting force is applied to the wing sail pressure point; in this case, it is situated in the middle of the wing, and is also used to calculate its yawing moment. This yawing moment is translated into torque and, finally, applied to the wing sail. The land_yacht_plugin is composed of a ROS node that subscribes two topics--the flap angle and steering angle--and publishes the vehicle ground truth for control and debugging. When the plugin receives new messages from the subscribed topics, it sets the corresponding joint angle to the broadcasted value. The land_yacht_appar_wind plugin converts the true wind (velocity and direction in the world reference frame) into the vehicle's apparent wind (velocity and direction in the vehicle reference frame). It subscribes the true wind topic, transforms the true into the apparent the wind, using the vehicle's heading and velocity in the world reference frame, and, finally, publishes the result in a new topic. Figure 5: liftdragplugin diagram. Plugins can be loaded in the model or the world SDF file. Listing 3 illustrates the loading of the liftdragplugin.