Home        Store        Docs        Blog

ArduSub + SITL simulations



Sorry to disturb you again, I simply have a quick question. The simulations work for me using rc override with sitl, gazebo and mavros. I wanted to know if it is possible to use modes such as circle or guided with these simulations ? For example by using local coordinated instead of the gps ?
Thanks for your help !

(Patrick José Pereira) #2

Good to see that sitl is working for you !
Have you tested the SITL running with QGC and some auto missions or controlling it with the joystick ?

Here you can see the SITL working with circle mode and gazebo, and the system is able to maintain the depth and orientation without problems.

Take a look in your parameters, try this bluerov2_gazebo_sitl.params (23.1 KB), it’s the one that I’m using right now.

You can use local coordinates, but you need to make sure that the ROV have a 3D fix.


I tried to reproduce the settings I had for ArduCopter, which were provided by Erle Robotics, so I’m not running QGC but APM and mavros. I could test that it works well by writing a script which publishes rc override messages to the mavros topics in manual mode, that works fine. For a more detailed description of what I installed you can take a look at this gist :slight_smile:

However as soon as I switch to guided or circle mode the vehicle sinks. I figured that was because it needs global positioning to use these modes, but I might be wrong ? Maybe it has something to do with my parameters ? I’d like to check wit yours but I can’t open them and when I param load them in the sitl console it says invalid line at each line… It seems you sent me a binary file and I would need a parser of some sort to open it? If ever you have another version of that file it would be great!

(Patrick José Pereira) #4

It appears that something is wrong with your parameters, can you send them ? and to be sure, can you send your telemetry log with QGC ? That’ll help us to take a better look in the problem.
We do not use apm ground station, so it’ll be hard to provide any help with that.


Sorry for the delay. Here are my sub.parm (1.1 KB), can you send me yours in another format too?
In QGC the only three modes I can access are Manual, Stabilize and Depth Hold (so all GPS-free modes), it says that other modes like Guided for example are not implemented. Here is a qgc_random_overriderc_test.tlog (3.5 MB) when I’m just playing around, controlling the rover through RC override and sending random commands. If QGC cannot recognize these other modes it seems like they’re missing in the firmware?
Don’t worry I’ll be ok with mavros and apm, for now my problem is probably with ArduSub itself! Maybe there’s been an upgrade somewhere that implemented the other modes? You can take a look at the versions I downloaded using the previous gist, maybe they’re too old or maybe something is missing that would allow me to use Guided and Circle…
Thank you for your help!

(Patrick José Pereira) #6

It appears that you need to change the AHRS_ORIENTATION to Roll180.

I tested with apm2 and here are the parameters that I’m using right now.
gazebo_sitl_apm_2.param (16.1 KB)

You can check in the ArduSub documentation all supported modes right now.

Try to use the parameter file that I sent to you, maybe i’ll solve your problem, let me know if not.


Thanks so much ! Using your parameters file indeed enabled me to use Guided and Circle modes. These modes are even better coded than for ArduCopter, in Circle mode the drone doesn’t face the center of the circle like it’s supposed to, but the BlueRov does :wink:
However something in your parameters must have upset my mavros because WP is now timing out after saying seq mismatch, which did not use to happen before:

[ INFO] [1517416222.794911362, 16.035000000]: WP: item #0 F:0 C: 16 p: 0.000000 0.000000 0.000000 0.000000 x: 33.810314 y: -118.393867 z: 0.360000
[ WARN] [1517416222.829334593, 16.042000000]: WP: Seq mismatch, dropping item (0 != 1)
[ WARN] [1517416222.829599118, 16.043000000]: WP: Seq mismatch, dropping item (0 != 1)
[ WARN] [1517416224.472186734, 17.035000000]: WP: timeout, retries left 2
[ WARN] [1517416226.133008380, 18.035000000]: WP: timeout, retries left 1
[ WARN] [1517416227.774312407, 19.035000000]: WP: timeout, retries left 0
[ERROR] [1517416229.401152090, 20.035000000]: WP: timed out.

Any idea what it could be ? And the rover in circle mode drifts a lot, the center of the circle moves to the right about 2 meters or so for each circle, maybe something needs to be tuned ?
Thanks again for your help !

(Patrick José Pereira) #8

Can you share your code with github, gist or pastebin ?
Are you sending waypoints while in circle ?

If you are sending in a high speed, the ROV will not be able to maintain the necessary linear and angular velocity to centralize the circle, you can check this website to see how the linear and angular velocity is important in circle mode.


I can share this github. It contains all the files you need except the world files that I use, because some of the models are confidential, so you’ll have to use underwater.world instead of my_underwater.world as written in the instructions.
Everything seems to be working ok though, when going slow enough the rover does not drift as much, and when changing only AHRS_ORIENTATION and no other parameter I don’t have the WP time out error! So for now I’m fine, I’ll message you again if I have other problems. Thank you so very much for your help!

(Patrick José Pereira) #10


Another question: circle mode is fine, but when I switch to guided mode the rover tends to be pretty unstable. As long as I haven’t sent it any setpoints it turns around itself and doesn’t stay still, and once I send it a setpoint on /mavros/setpoint_position/local it tries to go there while facing where’s it’s going, which can make it turn around itself weirdly at first until it faces the setpoint. It feels like switching to guided in general is making it much less stable and the trajectory much less smooth than in circle for example. Any ideas where that could come from?
Thanks so much for your help!

(Patrick José Pereira) #12

This is indeed an odd behaviour.
Can you send the tlog file for further investigation ?