Skip to content

sungwook87/ArduSwarmSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

ArduSwarmSim

Ardupilot based UAV Swarm + Gazebo simulator

This is an instruction for using KETI GCS + nCube_MUV + Ardupilot + Gazebo.

(This is for Non-ROS users or can be used with ROS)

ui

1. Prerequisites

1.1 Ubuntu and ROS

Ubuntu 64-bit 18.04., ROS Melodic. ROS Installation (Not essential)

1.2 ardupilot

Follow the instructions: ardupilot

    cd ~/path_to_[ardupilot]
    git submodule update --init --recursive

1.3. Install ardupilot_gazebo plugin

Follow the instructions: ardupilot_gazebo

1.4. Gazebo 8 or 9

Make sure you run Gazebo at leat once.

    gazebo --verbose iris_arducopter_demo.world

1.5 Modify the model & world files

For multi-UAVs, you need to edit the model.sdf and .world files.

    cd ~/path_to_[ardupilot_gazebo]/models/iris_with_standoffs_demo
    gedit model.sdf

Find arducopter_plugin, and edit as shown in below Figure:

ui

In addition, you need to clone the model folder in the same path as follow:

ui

In each folder, model.sdf should be editted. Each new instance of SITL is created in ports skipped by 10 units to each other. So, simply add 10 in every port to each cloned model. The first model has ports 9002 and 9003, the second will have 9012 and 9013, and the next will have 9022 and 9023. You can add the UAVs with added ports as much as you want.

Second UAV: model.sdf

ui

Third UAV: model.sdf

ui

Then, you need to modify the .world file.

    cd ~/path_to_[ardupilot_gazebo]/worlds
    sudo cp iris_ardupilot.world multiuav.world
    sudo gedit multiuav.world

Find below part,

ui

and replace those lines with

ui

then run,

    gazebo --verbose multiuav.world

You will see this world.

ui

1.6 Clone the ardupilot source folder

At the moment, I only tested one by one matching architecture which means you need to run the ardupilot SITL code for each UAV. In this case, I set 3 UAVs, so you need to have 3 ardupilot SITL code as follows:

ui

Then, you are READY to GO.

2. Run

Terminal 1 (9002)

    cd ~/ardupilot/Tools/autotest
    ./sim_vehicle.py -v ArduCopter -f gazebo-iris --console -I0 -L Keti --out udpin:127.0.0.1:14551 (not this one)
    ./sim_vehicle.py -v ArduCopter -f gazebo-iris --console -I0 -L Keti --out udpin:127.0.0.1:14552 (use this one)

somehow, I guess 14551 port roles in-out connection, so if you use 14551 port, the data goes to Web GCS twice (from 14550 and 14551). Please use xxxx2 port which seems like it is in-only port. Same with the other drones.

Terminal 2 (9012)

    cd ~/ardupilot2/Tools/autotest
    ./sim_vehicle.py -v ArduCopter -f gazebo-iris --console -I1 -L Keti --out udpin:127.0.0.1:14562

Terminal 3 (9022)

    cd ~/ardupilot3/Tools/autotest
    ./sim_vehicle.py -v ArduCopter -f gazebo-iris --console -I2 -L Keti --out udpin:127.0.0.1:14572

Terminal 4 (gazebo)

    gazebo --verbose multiuav.world

ui

3. Etc

3.1 14550 port is basically from MavProxy to GCS. We can use 14551 port as input from GCS to MavProxy by --out udpin:127.0.0.1:14551 option.

3.2 SITL parameter settings

  • set SYSID_THISMAV to your UAV ID. It should be same with the number you set in the resource server (either Web GCS).
  • set SERIAL0_PROTOCOL to 1:MAVlink1 and SERIAL1_PROTOCOL to 1::MAVlink1. Since nCube can parse only MAVLINK 1 protocol at the momnet.

About

Ardupilot based UAV Swarm + Gazebo simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published