Drone control: Difference between revisions
Line 99: | Line 99: | ||
[[File:transfer_gain_N-per-ms.png | 600px]] | [[File:transfer_gain_N-per-ms.png | 600px]] | ||
(Left) Trust curve as a function of ESC pulse width. | (Left) Trust curve as a function of ESC pulse width. Bigger propellers require more power but deliver more trust. | ||
(Right) Static transfer gain as a function of ESC pulse width. | (Right) Static transfer gain as a function of ESC pulse width. | ||
The transfer gain is fairly constant (within a factor 2) in the useful trust area. | The transfer gain is fairly constant (within a factor 2) in the useful trust area. |
Revision as of 15:51, 8 October 2020
Drone project
This project is intended to be a rather simple core drone stabilizer application based on Teensy and the prop shield.
Intended to be expanded with an outer control loop with a non-realtime sensor, e.g. GNSS, camera or laser scanner.
Hardware
Drone software
There are two versions of the drone firmware, one for the motor test (mostly performance of a single motor) without the need of the prop-sheld and a full version to be used on the flying drone.
To get the source code - see section "software and files" below.
Motor test firmware
The motor test firmware is in the "motortest" directory.
To compile the source for a Teensy 3.5 or 3.6 the Teensiduino needs to be installed first.
Install Teensiduino, see https://www.pjrc.com/teensy/td_download.html . Start with installing the most recent supported version of Arduino, then overlay this by installing the Teensiduino.
Once installed the directory needs to be prepared for compilation.
Linux
make shortcut links to libraries and compiler. The shourtcut described below assumes you have installed arduino version 1.8.9 (and Teensiduino) in your home directory, change as appropriate:
cd drone_ctrl/motortest ln -s ~/arduino-1.8.9/hardware/teensy/avr/libraries ln -s ~/arduino-1.8.9/hardware/teensy/avr/cores/teensy3 ln -s ~/arduino-1.8.9/hardware/tools/ make make upload
Drone firmware
The drone flight controller (base) firmware is in the "drone_ctrl" directory.
To compile the source for a Teensy 3.5 or 3.6 the Teensiduino needs to be installed first.
Install Teensiduino, see https://www.pjrc.com/teensy/td_download.html . Start with installing the most recent supported version of Arduino, then overlay this by installing the Teensiduino.
Once installed the directory needs to be prepared for compilation.
Linux
make shortcut links to libraries and compiler. The shourtcut described below assumes you have installed arduino version 1.8.9 (and Teensiduino) in your home directory, change as appropriate:
cd drone_ctrl/drone_ctrl ln -s ~/arduino-1.8.9/hardware/teensy/avr/libraries ln -s ~/arduino-1.8.9/hardware/teensy/avr/cores/teensy3 ln -s ~/arduino-1.8.9/hardware/tools/ make make upload
Propeller - motor performance
Measured with the "motortest" firmware and the python app below. The used motor is the 3508-700KV Turnigy Multistar 14 Pole Brushless and a 14x5.5 carbon propeller. The ESC is a Hobby-wing x-rotor 40A controller.
Time responce
With 11 V supply (left) and 15V (right).
From 1.1ms to the ESC (idle) to 1.9ms almost full throttle. The ESC update frequency is 400 Hz.
Static response 3508-700
Transfer measurement with different propellers. The Hobby Wing controller is calibrated to 1ms=off, 2ms=full power.
The propellers
- 8"x 3.8 APC composite propeller
- 9"x 4.5 APC composite propeller
- 13"x 4.5 carbon fiber
- 14"x 5.5 carbon fiber
- 18"x 5.5 carbon fiber Quanum
(left) trust delivered for each propeller size as a function of motor input power. (right) RPM as a function of input power.
Static gain 3508-700
For the same data as above, bot now related to the ESC input pulse width. The ESC has been calibrated to 1ms is zero power, 2ms is maximum power. All data has been scaler to 11V, as the curves scale almost 1:1 with the input voltage.
(Left) Trust curve as a function of ESC pulse width. Bigger propellers require more power but deliver more trust. (Right) Static transfer gain as a function of ESC pulse width. The transfer gain is fairly constant (within a factor 2) in the useful trust area.
Software and files
The files for these results is in our subversion repository:
Install subversion - https://subversion.apache.org/packages.html - and from a command line
svn checkout svn://repos.gbar.dtu.dk/jcan/mobotware/drone_ctrl cd drone_ctrl/trunk/motortest_gui ls - motortest_gui.py is the application below. - plot_rpm_sensor.m is the Matlab script to make the plots above. ... other support and data files. cd drone_ctrl/trunk/doc/Matlab - Simulink version of hexacopter drone
Motor test app
A motor test GUI is available (in the motortest_gui directory) - it will talk to the motortest firmware - and there is no need for the prop-shield for this application.
Motor test GUI. There is the possibility to log time performance (in the log tab), to test run an ESC (or up to 6 ESCs) in the data tab.
The hardware configuration and pin-out are described in the hardware section above.
MATLAB simulation
Once the drone hardware (mass, configuration, motor and propeller) is known, then it can be simulated in Matlab simulink. The script in the doc/matlab directory has scrips for the simulation and estimating a linear transfer function in an operating point and calculate the needed controller parameters (roll, pitch, yaw - velocity and position as well as height control).
Further controllers for lateral velocity are added too, but these last controllers are not included in the drone firmware.
Simulink model of hexacopter.
Sim mechanics simulated hex-drone hoovering.