/DroneThrustIdentification

Code for relating the normalized thrust of a multirotor to the generated force

Primary LanguagePythonMIT LicenseMIT

DroneThrustIdentification

This code can be used for identifying a relationship between the force generated by a multirotor and its voltage and normalized thrust

Background

Many quadrotor controllers require the quadrotor to generate a given thrust force. Most flight controllers such as PX4 however do not use physical parameters but rather normalized control values between 0 (minimum thrust to avoid stalling) and 1 (maximum thrust). The relationship between the thrust and the normalized control thrust is also affected by the battery voltage, with the quadrotor having a greater maximum thrust at higher voltage and which reduces throughout the flight.

Gathering Data

The drone may be manually or automatically flown in an aggressive manner in order to get a range of control inputs. The quadrotor must record at the least the accelerometer data from the IMU, as well as the normalized control thrust values and battery voltage. These should be recorded at as high a frequency as possible and for Pixhawks flight controllers, it is recommended:

  • record the flight log directly to the SD card instead of streaming it over telemetry
  • set the SDLOG_PROFILE parameter to record high-rate inertial and control data

If you want to have an accurate force over the range of your safe battery voltage, you should perform test flights at full, mid, and low voltage. Because the data will be heavily weighted around the hover thrust, you may also want to add weight to some flights so that your data isn't skewed. To evaluate the quality of the regression, it is recommended to perform some flights for identification and some flights for identification.

Once you have several flight log files (these can be taken directly from the pixhawk SD card, or via telemetry/usb connection), these should be converted with the ulog2csv.sh script to create a folder of csv files for each flight.

Calculating Thrust

TODO

This means that the thrust is simply the z-component of the accelerometer measurement scaled by the mass of the drone.

Running the Identification

The main.py script shows an example of how to perform the identification. Each flight should be used to create a

It will perform a regression of the form

It will perform a regression of the form

It will perform a regression of the form