Home        Store        Learn        Blog

SITL + Gazebo with heavy configuration

Hi everyone,

I have a BlueRov2 in heavy configuration and would like to simulate it with SITL + Gazebo (to have a reasonably good simulation of the physics of a 6DOF ROV).

Is there an easy way to do this ? I guess this could be useful to a lot of bluerov2 heavy users.



You’ll need to update the xacro description file to add more thrusters and to change the buoyancy foam size/position if necessary.
Everything else should be straightforward.

Hi, Patrick, thanks for the quick reply.

I did the modifications you suggested, but the rov in gazebo still only has 6 thrusters. I am running SITL + Gazebo by following the instructions in the ardusub gitbook :

cd bluerov_ros_playground
 source gazebo.sh
 gazebo worlds/underwater.world -u
 # Start the simulation

 sim_vehicle.py -f gazebo-bluerov2 -L RATBeach --out=udp: --console

Are you sure that I need to modify the xacro file and not the sdf file in model/BlueRov2 ?

Hi @patrickelectric, I ended up modifying the sdf file in model/BlueRov2 (added thrusters and control channels) which modified the model in gazebo and allowed me to have pitch control of the rov after changing the frame to vectored 6DOF and setting the parameters to the default values for the heavy configuration in QGroundControl.

I then had to change the “autopilot orientation setting” in sensors > compass to roll 180 to get the AHRS to work properly, and I now have stabilize and depth hold modes working with pitch stabilization (which is pretty cool).

Could you give me some info on the physics simulation that is used when running SITL + gazebo the recommended way (with the commands in the ardusub gitbook, and not the launch files in bluerov_ros_playground,) ?

I would like to know what kind of model is used for the hydrodynamic forces (mostly drag), is it the one from freefloating_gazebo ? I read on another topic that freebuoyancy_gazebo was only used for buoyancy calculation, but then I don’t undertsand where the drag model comes from ? Do you know if there is a simple way to simulate water currents (by setting the water velocity somewhere for instance ?).
Thanks for your help !

1 Like


Great that you figure it out !
The physics simulation is a result of the original work of freefloating_gazebo, you can take a look in the paper here.

AFAIK freefloating is able to do the drag simulation that you are looking for, we have this but it’s not possible to control the currents/velocity and etc with our fork since we removed everything related to ROS. It’s not necessary for simple SITL simulations and ROS will result in a huge dependency if necessary.

Also, be free to send any PR to help us to improve our simulation environment : )

Note: There is some wind commands in mavlink, maybe you could send this messages to SITL to communicate with Gazebo with a modified version of freefloating or freebuoyancy. Or you could modify one of the plugins to receive a udp connection with such configuration/control.

Hi @patrickelectric, thanks for the info on the physics simulation.

I still have a problem, I can’t use auto mode, whether it’s with or without gazebo. To make sure it wasn’t because of modifications of the gazebo model or the parameters, I tried with just sitl and default parameters, by running :

sim_vehicle.py -w -L RATBeach --out=udp: --map --console

I can activate guided but not auto mode.
I have ardusub 3.6.0 dev (master branch on git repo) and QGC v.3.5.0 (latest stable version).

Is there something I’m forgetting to do, does this work on your side ?


Yes, it works here:

Can you inform if there is an error or a message about the failure ?
Have you done any modification in the code ?

Hi @patrickelectric,

I managed to fix it by uploading the bluerov_sitl_fast_params I found on another topic, it now works. I suspect that it worked on your side because you had different parameters, does this make sense ? What is the difference between the default parameters loaded by sitl and the bluerov_sitl_fast_params ?

To answer your question, there were no error messages and no code modification before. Could you try to wipe out the virtual eeprom of your sitl instance and then try again with the default parameters, to see if this is a general problem ?


It now works on my computer with the default parameters too. The -w option in sim_vehicle.py resets the parameters of the simulated rov, right ?
I don’t know why it didn’t work in the first place !

Hi @patrickelectric,

I think (or hope :smile: ) this is the last issue I’ll encounter. When using auto mode with gazebo, I get very bad results

I am running everything according to the instructions in the ardusub gitbook, the only thing I modified is the autopilot orientation setting in Sensors, set to roll 180 (otherwise it was upside down).

I think it may have something to do with the EKF, which doesn’t seem to be working properly according to the sitl console (appears in red) :

Any guess with what’s wrong here ?


Ok, the problem is not only for auto mode given that in manual mode a forward command causes the vehicle to go backwards, which could explain why auto mode can’t work.

Hi @patrickelectric,

I think this deserves a new topic, so I moved the discussion there (with a more detailed description of the problem) :