Setting up a simulation environment

Hello,

Sorry for taking so long to reply. I did a small documentation to help you with your simulation environment, this same documentation will be added in ardusub.com in the future.

S.I.T.L (Software In The Loop)

SITL is a simulator that allows you to run ArduSub without any hardware. It is a build of the autopilot code using an ordinary C++ compiler, giving you a native executable that allows you to test the behaviour of the vehicle.

Installation

To configure and run SITL for the first time in your computer, take a look in Running SITL ArduPilot documentation.

Running ArduSub SITL

This part assumes that you have already set up SITL on your machine.
First is necessary to be inside ArduSub folder.

cd ardupilot/ArduSub

To execute SITL with sim_vehicle.py.

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

After that, ArduSub SITL will compile and start to run, you’ll be able to connect it with QGroundControl and control it.

For more information about sim_vehicle.py and the options available, check:

sim_vehicle.py --help

Running ArduSub SITL with Gazebo

To run ArduSub SITL with Gazebo, it’s necessary to:

  1. Install freebuoyancy_gazebo plugin for buoyancy simulation.

  2. Install ardupilot_gazebo/add_link plugin for ardupilot-gazebo communication. add_link is a branch that provides actuation over sdf links, after the git clone, it’s necessary to run git checkout add_link.

  3. Run BlueRov2 Gazebo model

    1. Download bluerov_ros_playground

      git clone https://github.com/patrickelectric/bluerov_ros_playground
      
    2. Run Gazebo model

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

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

The console will start to display the output if the connection was successful.

5 Likes