Here I give a simple tutorial on how to get started with this plugin creating a simple example of movement with drag and lift in a robot with buoancy ( in water basicaly). This should serve as an extra of the previous answer.
Here you have the video of this example:Video
I created a two link model, with a fin that will move and generate a drag that will move a sphere floating in water.
You need to spawn the robot using the main_sphere_with_fin.launch
. Inside it you have a world launch and a robot spawn. In this robot spawn among other things you spawn the urdf of the model where the plugin is set up. The urdf of floating_sphere_with_fin.urdf
.
Inside it I set up the plugin in this fashion:
<gazebo>
<plugin name="sphere_caudal_fin" filename="libLiftDragPlugin.so">
<air_density>1000</air_density>
<cla>0</cla>
<cla_stall>0</cla_stall>
<cda>1.2535816618911175</cda>
<cda_stall>1.4326647564469914</cda_stall>
<alpha_stall>0</alpha_stall>
<a0>0</a0>
<area>0.0334265458342</area>
<upward>0 0 1.0</upward>
<forward>-1.0 0 0</forward>
<link_name>sphere_caudal_fin_link</link_name>
<cp>0 0.19 0</cp>
</plugin>
</gazebo>
As you can see here I only set the drag because I want it to move through the friction with the water, and no lift because the fin would generate one significantly.
The Center of pressure ( cp) is places on the fin ( that is the distance from the center of the sphere to the tip of the fin where I want it to generate the force). Of course all this depends on your application.
Here I leave you the code of all the files used:
main.launch
main_sphere_with_fin.launch
ocean.world
sphere_with_fin_complete.launch
floating_sphere_with_fin.urdf.sdf
Hope this was usefull. If you state a more precise case scenario we could try to apply all this to your case in particular. This is just an example of how to use it in a basic way.
Edit:
This is an extra example for a more complex robot fish to move it through drag also: VIDEO PART 2