# set constant speed for AUV on dynamic uwsim

I want to set constant speed for AUV, however, uwsim is dynamic which means I am only able to give force to the AUV's thruster and the AUV is influenced by the water's friction force. If I could make the force equal to the friction force, then the AUV can move at a constant speed. After that I found that the friction force is controlled by a damping matrix on the dynamics_g500.yaml file, but I don't know the relationship between the damping matrix and the friction force. Can anyone help me? Thanks so much. The launch file is shown below:

<launch>
<include file="$(find underwater_vehicle_dynamics)/launch/dynamics.launch"> <arg name="namespace" value="g500" /> <arg name="params" value="$(find underwater_vehicle_dynamics)/config/dynamics_g500.yaml" />
</include>
<rosparam param="/g500/dynamics/external_force_topic">g500/ForceSensor</rosparam>

<arg name="scene" default="/home/gupta/catkin_ws_shen/src/underwater_simulation/uwsim/data/scenes/lbl.xml" />
<node name="uwsim" pkg="uwsim" type="uwsim" args="--configfile $(arg scene)" output="screen" respawn="false" /> <arg name="thrusters_topic" default="/g500/thrusters_input" /> </launch>  edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted Hi, Actually setting the friction force to thrusters will not assure constant speed due to the vehicle inertia. Vehicle needs to accelerate from stop so it will slowly gain speed. Furthermore friction depends on the velocity the vehicle is moving so you will need to dynamically adjust it. So the best option is use a controller, the most basic is a PID: wikipedia. There is a tutorial about how to create it in UWSim using Matlab/SImulink here, but it is pretty straight forward to implement it yourself. Edit: Some comments after reading your problems, thrusters effort ranges from -1 to 1 so setting higher effort will not help. Also check keyboard controller is not running as it sends 0's to the thrusters effort (default dynamics launcher, runs this node). Anyway a big part of navigation involves controlling the vehicle speed, but if you are not testing this just use it in kinematic mode. About the oscillating speed in a PID try adjusting the parameters and use small values, obtaining good values is not trivial, there is a lot of research work about this. Just using a P controller with a small value should be enough to achieve a reasonable result like this: effort=(vel_reference-velocity)*P . It may not achieve the desired velocity or do it slowly but should work. more ## Comments Hi, I met a weird condition which is that while I give the thruster a constant input, for example, -25, the speed of the AUV along its trajectory will increase then decrease and then increase then decrease again. Here are the speed of AUV: 0, 0.000812425, 0.357602, 1.42693, 1.48798, 0.739892, .... ( 2016-10-05 12:07:43 -0500 )edit Hi, Follow the comment above I use PID and found that it does not work. While the difference between the current speed and desired speed > maximum error, PID output will be input for the thruster. Else, the output will be zero. ( 2016-10-05 12:13:15 -0500 )edit Hi, Follow the comment above, problem is that while the PID output is zero (because the current speed is close enough to desired speed), the speed of AUV will decrease sharply due to friction force. Thus, I found that the performance of PID controlling speed is oscillated instead of steady state. ( 2016-10-05 12:16:12 -0500 )edit Hi, So do you have some ideas about setting constant speed for AUV? ( 2016-10-05 12:18:02 -0500 )edit Hi, I have deleted keyboard controller but the velocity is also oscillating under constant thruster input (for example 1). The normal condition should be: under the constant thruster input, the velocity is increasing until reach its maximum velocity. The PID does not work under this condition. ( 2016-10-06 13:05:13 -0500 )edit <node name="uwsim" pkg="uwsim" type="uwsim" args="--configfile$(arg scene)" output="screen" respawn="false"/> <arg name="thrusters_topic" default="/g500/thrusters_input"/> </launch>

( 2016-10-06 13:09:16 -0500 )edit

Hi,

Follow the previous comment. The keyboard controller has been deleted from the launch file but the issue is still here. The launch file has been added to the question.

( 2016-10-06 13:13:27 -0500 )edit

Hi,

I met a really weird condition: I give the thruster constant input to make the AUV move along the X axis. Then I subscribe the topic /g500/dvl and found that bi_y_axis (speed along y axis) change. It is not correct right. It should be close to zero.

( 2016-10-06 13:50:50 -0500 )edit