Drone control

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
(Hardware)
 
(18 intermediate revisions by one user not shown)
Line 7: Line 7:
 
== Hardware ==
 
== Hardware ==
  
build on a hand-wired PCB as a prototype
+
Build on a hand-wired PCB as a prototype
  
[[Drone control hardware]]
+
[[Drone control hardware]]  
 +
<!-- [[File:schematic_rev0.png | 150px]] -->
  
 
== Drone software ==
 
== Drone software ==
Line 15: Line 16:
 
[[Drone firmware]]
 
[[Drone firmware]]
  
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.
+
== Magnetometer calibration ==
  
To get the source code - see section "software and files" below.
+
Calibration is used using a calibration version of firmware and a calibration app from Prop Shield manufacturer.  
  
=== Motor test firmware ===
+
[[Drone compass calibration]]
  
The motor test firmware is in the "motortest" directory.
+
== ESC calibration ==
  
To compile the source for a Teensy 3.5 or 3.6 the Teensiduino needs to be installed first.
+
The drone control uses ESC pulse width from 1 to 2 ms, and all ESCs should be calibrated to use this range.
  
Install Teensiduino, see https://www.pjrc.com/teensy/td_download.html .
+
[[ESC calibration]]
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 ==
 
== Propeller - motor performance ==
  
Measured with the "motortest" firmware and the python app below.
+
[[Drone motor performance]]
The used motor is the 3508-700KV Turnigy Multistar 14 Pole Brushless and a 14x5.5 carbon propeller.
+
[[File:3508-700-14x5.5-11v.png | 150px]]
The ESC is a Hobby-wing x-rotor 40A controller.
+
 
+
=== Time responce ===
+
 
+
[[File:3508-700-14x5.5-11v.png | 600px]]
+
[[File:3508-700-14x5.5-15v.png | 600px]]
+
 
+
 
+
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.
+
Measurement is in a fixed setup on a scale with 1g resolution. Propeller 50cm above ground level.
+
Power is a lab power supply. Motor and ESC temperature below 50 degree C.
+
 
+
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
+
 
+
[[File:trust-per-power-3508-700.png | 600px]]
+
[[File:rpm-per-power-3508-700.png | 600px]]
+
 
+
(Left) trust delivered for each propeller size as a function of motor input power.
+
It shows that bigger propellers are more power-efficient.
+
(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.
+
 
+
[[File:trust-TF-3508-700.png | 600px]]
+
[[File:transfer_gain_N-per-ms.png | 600px]]
+
 
+
(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 ==
 
== 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.
+
[[Drone motor test app]]
 
+
[[File:motortest_gui.png | 120px]]
[[File:motortest_gui.png | 600px]]
+
 
+
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.
+
 
+
[[File:drone_ctrl_simulink.png | 800px]]
+
 
+
Simulink model of hexacopter.
+
  
[[File:drone_ctrl_sim_hex.png | 600px]]
+
==Matlab simulation==
  
Sim mechanics simulated hex-drone hoovering.
+
[[Drone MATLAB simulation]]
 +
[[File:drone_ctrl_sim_hex.png | 120px]]

Latest revision as of 09:49, 21 December 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.

Contents

[edit] Hardware

Build on a hand-wired PCB as a prototype

Drone control hardware

[edit] Drone software

Drone firmware

[edit] Magnetometer calibration

Calibration is used using a calibration version of firmware and a calibration app from Prop Shield manufacturer.

Drone compass calibration

[edit] ESC calibration

The drone control uses ESC pulse width from 1 to 2 ms, and all ESCs should be calibrated to use this range.

ESC calibration

[edit] Propeller - motor performance

Drone motor performance 3508-700-14x5.5-11v.png

[edit] Motor test app

Drone motor test app Motortest gui.png

[edit] Matlab simulation

Drone MATLAB simulation Drone ctrl sim hex.png

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox