Easiest way to build your own drone flight controller software with SWARM Simulation Platform

This post will demonstrate how to use an easy-to-use and low-cost solution for developing drone flight control software using the SWARM Simulation Platform (swarmsim.io). SWARM is a cloud-based simulation platform that provides a simple easy-to-use user interface for building autonomous flight control algorithms used by developers from all levels of backgrounds. It is designed to be a flexible and extensible platform for researchers to develop and test new swarm flight control algorithms using various simulated environments. The simulation also includes photorealistic real-world scenarios such as search and rescue (TBA), and forest fire surveys designed with Unreal Engine. Since all the input and the simulation runs on the cloud, there is no required dependency installation, so you can quickly get started working on your flight control software with just a browser. The software supports the open-source Colosseum API, which allows users to easily write flight control code with python libraries.

The SWARM platform also includes a competition page that allows users to compare and compete with other users for the best-performing flight control algorithm. The performance is measured based on waypoint checks placed in specific locations in multiple levels/environments with varying difficulties of obstacles. The results will be posted on the online leaderboard.
Competition Preview: SWARM Obstacle Avoidance Competition Preview - YouTube

A community discussion space is also coming soon for users to collaborate on their systems.

During the course of this blog post, we will go through the steps of setting up the parameters for the simulation including the drone hardware (lidar and camera settings) and the navigation flight controller software (path planning and obstacle avoidance algorithms).

If you are interested in learning more about the platform and various flight control systems, head over to SWARM. Also, feel free to check out the Documentation page for detailed tutorials and comprehensive information about the algorithms.

First, sign up for an account at swarmsim.io

Click the “Get started” button on the main landing page. (Alternatively, click the “Register” option from the drop-down options).

Creating a simulation instance

Head over to the “competition” tab on the top nav bar. Here, you will see the “Obstacle Avoidance” (more coming soon). Click on the “Create Submission” button.

Setting the drone hardware parameters

We are now in the parameter setup UI view where you will see various information about the drone. You can also adjust the sensor settings by clicking the “edit” button.

(Notice there is also a progress bar at the top of the setup page. This will be helpful if you need to go back to change any settings.)

Adjust the LiDAR parameters and click “save” once you are satisfied with the settings.

Building the Obstacle Avoidance Algorithm

We can now input our own Obstacle Avoidance Algorithm that will be used for the various levels. To input your own OA algorithm, click on “build your own”.

(To use a default algorithm or other pre-built algorithms provided, skip to the next step).

Now you will be given a basic python function template to get you started on building your own Obstacle Avoidance Algorithm! Your task is to finish the Python “avoid” function given the set of parameters. Click the “show explanation” for a detailed description about each parameter.

  • Point_cloud: Distance input data from the LiDAR sensor given in an array of points
  • Position: The current X, Y, Z location of the agent in the North, East, Down (NED) coordinate frame.
  • Goal: The current X, Y, Z goal location of the agent in the North, East, Down (NED) coordinate frame.

First, make sure the coordinate frame of reference is set to your preference. And write the Python function that can avoid the obstacles in each of the levels. Checking out the API documentation page will be useful in writing the code.

Feel free to run a few simulations and go through a trial-and-error process until you are confident with your algorithm.

Once you are satisfied with your system, click on “Validate” to check for errors. And if there are no errors, you can proceed to the next step.

Optional: Using a Pre-Built Obstacle Avoidance Algorithm

Alternatively, you can use the “Pre-Built Algorithm” option which allows you to choose from a list of algorithms provided in the algorithm library, including the “slope detection algorithm” (see details page for more information).

Selecting an algorithm will lead you to the Obstacle Avoidance parameter settings page.

(Hovering over the “i” icon will show you the details for each parameter).

Once you are satisfied with the settings, proceed to the last step by clicking “save”.

Creating the Simulation

You are now ready to run your simulation! Name the simulation instance of your current setup so far (we encourage you to be as descriptive as possible). You can choose to record a video of your simulation and the duration of the simulation (it is default 600 seconds).

You can start running your simulation by clicking “Run Simulation”.

Later, if you are satisfied with your flight control software setup, you can choose “create competition Submission” to run the simulation and submit the performance results to the leaderboard.

There is also an option to “Save For Later” to come back to the current instance of the flight control software setup to edit or continue working.

The status of your simulation will be visible in the “dashboard” tab on the nav-bar.

Once the simulation is done processing(status shown as “executing”), the status will be shown as “Completed” then you can click on “Results” to check the video of the simulation and the details on the performance of the obstacle avoidance algorithm. The result page has video download links as well as the data analytics for each simulation level.

For access to the live streaming of the simulation during the execution, please email tylerfedrizzi@codex-labs-llc.com.

Please feel free to leave comments with any questions or suggestions about the SWARM Simulation platform. We would also love to hear what you like about the platform experience and if you have suggestions to improve this guide. The team is continuously improving the user experience as well as working on the flight control algorithms. Read more about the team here.

6 Likes

Hello,

Please take a look at the wiki that is using ArduPilot Simulator (SITL) as the AirSim simulation engine. Do you have something similar on your environment ?

https://ardupilot.org/dev/docs/sitl-with-airsim.html#sitl-with-airsim

Hey @ppoirier,

I’m the co-founder of the company that built the SWARM platform.

As of today, we do not have a specific Ardupilot setup yet but that is next on our large list of tasks. We have found that the old AirSim (which we have continued on under the name Colosseum for the open-source version), had poor integration with Ardupilot. As such, we are rebuilding the interfaces in MavSDK with customer interfaces as needed.

Our goal is to build a SITL that supports PX4 and Ardupilot copters as well as supporting our custom implementation of Fixed Wing UAVs which are building from scratch.

I will update everyone here when this is released and you can also sign up for our news letter where we will put out this info as well.

Definitely happy to answer any questions or take any requests that you may have!

1 Like

Interesting, will check it out.

1 Like