Ardusub simulation (SITL)

Hi,

I was wondering if there is any way of implementing an ardusub simulation (software in the loop)? I’m working on a custom configuration/application ROV with the hope of having some autonomous functionality down the track - a software simulation for testing the control system would be really useful!

Any tips or advice welcome.

Cheers
-Karl

1 Like

It is possible, no one has done it yet for ArduSub that I know of. I would start by looking at the ArduCopter and ArduPlane implementations, and from there look at what needs to be done for ArduSub.

http://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html

Tune in on gitter and we can help you get the information you need if you want to take this on.

 

-Jacob

Thanks for the reply and info Jacob! I’ll definitely jump on the gitter when/if I end up having a go at it. Just wanted to see if anyone out there was thinking about or working on it yet.

Cheers
-Karl

Hey did you figure out how to simulate a rover? I plan on doing the same thing with a custom rover and It would be great if I could simulate it before I try any autonomous programs on a rover.

@jakkala-kalvik
You can simulate a Rover (a car) by running

sim_vehicle.py --vehicle=ArduRover

You can simulate an ROV (an underwater vehicle) by running. The ROV simulation is still in the early stages of development.

sim_vehicle.py --vehicle=ArduSub

You can find sim_vehicle.py at /Tools/autotest/sim_vehicle.py

Hi @jwalser ,
Is the ROV simulation now running? Is there some documentation somewhere saying what it can do yet and how it is going? I am trying to simulate an ROV in Gazebo, probably with ArduSub.
Thank you for the info!

Hello @monabf,

You can check this simple documentation, is something very new, but it works.
If you need more information about the SITL, you can check this or here to see more information about the gazebo sitl.

This should help, thanks very much!

Why did you use the freebuoyancy plugin instead the default plugin that comes from gazebo? The plugin’s git repo gave me little information about it’s advantages.

Hi @jakkala-kalvik,

The freebuoyancy is based over freefloating_gazebo, the actual buoyancy have some limitations that freefloating solves, like: damping, force based on distance to surface, different surface plane… You can check some parts here. The results of freefloating seems pretty realistic.

Hi @patrickelectric,
freebuoyancy is not working for me when I tried the example with the sphere and also the bluerov2 model. I downloaded it from your repo. made a build folder in it. Used cmake… and them sudo make install. I see the .so file in gazebo plugins folder. Am I missing something.

got it the .so file was in /usr/lib/x86_64-linux-gnu/gazebo-7.0/plugins but its supposed to be in /usr/lib/x86_64-linux-gnu/gazebo-7/plugins

@patrickelectric The sitl is not working for me. I was able to run the quadcopter sitl along with gazebo using the add_link ardupilot plugin from BR repo. But when I run Ardusub sitl it gets stuck at this.

Telemetry log: mav.tlog
MAV> Waiting for heartbeat from tcp:127.0.0.1:5760

And this happens only when I use the gazebo-bluerov2 frame. The default frame works fine though well without the gazebo part.

Hi @jakkala-kalvik,

How are you starting gazebo with bluerov2 model ?
Do you have any output in the terminal of gazebo ?

I started gazebo with

cd bluerov_ros_playground    
source gazebo.sh
gazebo worlds/underwater.world -u

and then the sitl with

sim_vehicle.py -f gazebo-bluerov2 -I 0 -j4 -D -L RATBeach --console

Got this when I run gazebo with verbose (gazebo)

[Err] [InsertModelWidget.cc:302] Missing model.config for model "/home/mlbots/model_editor_models/model"
[Err] [InsertModelWidget.cc:302] Missing model.config for model "/home/mlbots/model_editor_models/worlds"
[Err] [ArduPilotPlugin.cc:538] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Err] [ArduPilotPlugin.cc:547] [BlueRov2] Couldn't find specified joint []. This plugin will not run.

Tried the following to launch gazebo

cd bluerov_ros_playground    
source gazebo.sh
source ~/.bashrc
gazebo --verbose worlds/underwater.world -u

got the following error

[Err] [ArduPilotPlugin.cc:538] [BlueRov2] Please specify a jointName, where the control channel is attached.
[Err] [ArduPilotPlugin.cc:547] [BlueRov2] Couldn't find specified joint []. This plugin will not run.

Are you using the branch add_link branch of ardupilot plugin to install it ?
To test, go to path/ardupilot_gazebo and run git branch.

# this will appear
* add_link
  master

This branch isn’t in the principal master repository yet, still waiting the main developer feedback.

That was the issue. Its working now. I have one last question though. In order to get the sitl working with a custom frame will it be enough to update the Frame_Vectored.h file in ardupilot/libraries/SITL ?

Sorry about this, I’ll update the documentation to make it more explicit.

If you want to contribute with ArduSub and our new SITL environment, the best choice is to create a new file with your frame in this same repository, we’ll be happy to have more options to simulate ArduSub in SITL. I and @jwalser can continue this in personal message to help with this approach.

But, if you want only to test your model:

  1. Modify the Frame_Vectored.h.
  2. Add more two thrusters and channels in the BlueRov2 Gazebo model, like this one and more two channels here.
  3. and finallly some modification in SIM_Submarine.

Thanks. I will get back to you on gitter.