Home        Store        Docs        Blog

Attitude and heading problem with SITL + Gazebo



I have followed the recommended instructions for installing SITL and gazebo, and haven’t modified anything. I am trying to run sitl + gazebo with the default bluerov2 model in order to test the auto mode but can’t get the attitude and heading estimation to work properly (and thus get very bad results in auto mode).

My procedure is to run sitl with the -w option (to have the default parameters), then I load the bluerov2_gazebo_sitl.params (23.1 KB) parameters that I found in the forum. I get a few erros when I do that :

Then I reboot gazebo and sitl for the new parameters to be applied. I get an imu-related warning in gazebo :
“convertion of sensor type [imu] not supported”

Then, when I test the vehicle in manual mode, the vehicle seems to go in a random direction (often lateral) when I issue a forward command. There also seems to be no consistency between the orientation displayed in QGC and the one in gazebo (relative to the fixed axes displayed in gazebo).

I am on the master branch of ardusub, I have QGC v.3.5.0 and gazebo 7.
The AHRS_ORIENTATION is set to Roll 180, so that isn’t the problem.

@patrickelectric, could you check if the attitude and heading estimation works well for you with these parameters and if you can get good results in auto mode ? This way we’ll know if it’s a parameter problem or a problem with my install.

If anyone else got the gazebo model to work properly, that would also be very useful.



SITL + Gazebo with heavy configuration
(Jacob) #2

Why are you loading this parameter file? Auto mode will work with the default SITL parameters as seen on http://autotest.ardupilot.org/

(Jacob) #3

QGC is made to work with the stable version of ArduSub (3.5.3), you are on development/master version. The parameter file you loaded is also targeting the older stable version.


Hi @jwalser, thank you for your suggestions.

I had made the mistake of cloning from https://github.com/bluerobotics/ardusub and not from the ardupilot repo, I cloned again following the “Build Ardusub” instructions and set up sitl again.

The problem I have now is that the gazebo-bluerov2 frame does’t seem to be available (only the vectored frame is available) :

Am I supposed to be able to use gazebo and SITL with the 3.5.3 stable version ?


(Patrick José Pereira) #5

Hi JArber,

gazebo-bluerov2 only exists in master branch, it’s not available in ArduSub-Stable.

After some point, ArduPilot changed the parameters name, so this parameter file is deprecated right now, try to run the Gazebo simulation with the default parameters and after that the PID tuning. You can also try to find the equivalent PID values from the old to the new name.
The old name contains _Z_ and _XY_.

This probably usually is a result of the wrong parameters, the IMU position is different. But since you are using it with Roll 180 it should work. Are you having problems only while moving ? Is the attitude ok when you start the application ?

Yes, you should be able to run missions in Gazebo without problems in auto mode, with the correct PID tune.

Gazebo do an entire physic simulation of the robot, fluids and etc. ArduPilot SITL only uses a simple state-space of the forces in the robot body. bluerov2-gazebo needs some PID tune and a different orientation in the IMU (This IMU orientation in roll 180 is something that need to be fixed).


Hi @patrickelectric, thanks for your reply.

To answer your question, I only have problems when moving, the attitude is ok when I start the application.

Could you tell me exactly what version of the code (which repo : ardupilot or ardusub, and what branch) and of QGC you are using ? If you have working parameters, could you export them and send them to me along with the versions you’re using ?

If I understand correctly, a few people got sitl + gazebo to work properly (using the bluerov2_sitl_params file I found in the forum) but it was a few months ago, and there have been modifications to the master branch which require to modify the parameter file, is that correct ? If I can’t manage to make it work on the latest version, could I alternatively checkout a commit from a few months ago when people reported that it worked out of the box ?

About the PID tuning, do you mean manually testing different sets of values or is there a program to automatically tune the parameters ?