PX4 Tutorial
Welcome to the SWARM Developer System. These instructions presented here will help you as you integrate the PX4 Flight Control software with the SWARM Developer System. We have attempted to be as verbose and clear as possible but always welcome feedback on steps that are unclear or don't work as we expect.
Step 1
First, you will need to ensure that you have downloaded the SWARM Developer Client and have received your License Key. You should receive a welcome email with a JSON file called "LicenseKey.json". Once you download the SWARM Developer Client, you can put that file in the "settings" folder. You can then start the Server using the shell file that is localed in the utils folder with:
Step 2
Next, you will need to modify your PX4 SITL UDP Onboard ports. This is because the default onboard Control port 14540, is taken by the SWARM Simulator so that kinematic and sensor information can be provided to the PX4 SITL. To modify the syste, you can use the instructions here: PX4 Installation Instructions.
Ensure that you follow the directions to add a new UDP onboard port, both local and remote ports. We usually use port 14530 as Remote and 14590 as local.
Step 3
Now, you will need to configure your SWARM Simulations File so that it can work with PX4. We have provided an example file below and this file is also in the SWARM Developer Client, in the "settings" folder, titled PX4SimulationSettings.json.
Now, what you will notice is that we have a suite of sensors set up. These include:
- Barometer
- Magnetometer
- IMU
- GPS
Step 5
Now, you are ready to run the simulation. Go to the root of the SWARM Developer Client and type in the following information, assuming that you are using the provided PX4SimulationSettings.json file provided in the repo. Note: You do NOT need .json on the end of the file names.
You will see that the simulation file is being validated. Once the system has uploaded your configuration file, you will see the following output.
Step 6
Next, start the PX4 Simulator using your method of choice. Once the Simulator has started, you will see the following output in the PX4 console.
Step 7
You can visualize the simulator ouptut by starting your favorite Web Browser and typing in "127.0.0.1" as the URL. You will see a gray screen, like below. Click on the screen to start the visualization.
There are a number of options to control the environment, depending on which environment is available to you. You can check those out here: Environment Control.
Step 8
Now, you can control the agent through your normal methods, whether MavROS or your own custom software connected to PX4. We will put together a "Using ROS" tutorial that showcases how you can use ROS to control the agent.
Walkthrough
Here is a short walkthrough on how to go about setting up the PX4 SITL.