Drone control

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
(MATLAB simulation)
(Propeller - motor performance)
Line 66: Line 66:
  
 
[[File:3508-700-14x5.5-11v.png | 600px]]
 
[[File:3508-700-14x5.5-11v.png | 600px]]
 +
[[File:3508-700-14x5.5-15v.png | 600px]]
  
With 11 V supply (3 lipo cells).
 
From 1.1ms to the ESC (idle) to 1.9ms almost full throttle. The ESC update frequency is 400 Hz.
 
  
[[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.
  
With 11 V supply (4 lipo cells). note that 30 amps is not sustainable, the motor gets hot fast.
 
  
 
=== Trust 3508-700 14x5.5 ===
 
=== Trust 3508-700 14x5.5 ===

Revision as of 16:32, 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.

Contents

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

3508-700-14x5.5-11v.png 3508-700-14x5.5-15v.png


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.


Trust 3508-700 14x5.5

Transfer gain measurement from ESC pulse width to trust. The Hobby Wing controller is calibrated to 1ms=off, 2ms=full power.

Trust-3508-700 14x5.5.png

Normal size propeller (14x5.5) for the motor. The translation for ESC pulse to trust is almost linear. The thrust increases with the square of the rotation speed, but drag increases with power 3 of the rotation speed, so the end result is almost linear. The maximum thrust is about 1kg (10N).

Data for the graph above is

% Measurement from esc,motor,propeller test
% file created 2020-10-04 17:49:57.982360
% 1: esc value (motor 1) 0=1ms, 1024 = 2ms
% 2: rps (motor 1) a rotations per second)
% 3: rps (motor 1) b rotations per second)
% 4: Motor voltage (volt)
% 5: total current (amps)
% 6: thrust force (gram force)
% 7: CCV (rotation direction)
% 8: Temperature motor (deg C)
% 9: Temperature ESC (deg C)
100 8.27 8.27 11.3 0.1 10 0 38.8 33.3
200 18.89 18.91 11.3 0.4 54 0 28.8 27.9
250 24.78 24.78 11.3 0.7 92 0 27.2 28.0
300 30.11 30.16 11.3 1.2 136 0 27.8 27.6
350 35.65 35.65 11.1 1.7 192 0 27.2 28.2
400 40.33 40.54 11.2 2.5 246 0 26.3 28.7
450 44.49 44.47 11.3 3.6 300 0 27.4 28.4
500 49.34 49.33 11.3 4.5 371 0 26.8 28.5
550 54.00 54.01 11.4 5.8 440 0 27.9 29.2
600 58.11 58.07 11.2 7.2 523 0 27.0 29.3
650 61.94 61.71 11.0 9.0 600 0 27.0 30.0
700 65.24 65.20 11.0 10.3 660 0 27.6 29.8
750 68.22 68.67 11.2 12.5 730 0 29.2 30.6
800 71.01 71.14 11.3 14.4 806 0 31.7 30.3
850 73.87 73.89 11.5 16.7 870 0 32.1 29.1
900 76.76 76.62 10.8 18.7 930 0 33.0 31.3

Trust 3508-700 18x5.5

Trust-3508-700 18x5.5.png

Oversize propeller (18x5.5). The translation for ESC pulse to thrust is almost linear here, with lower RPM and higher motor current.

Data for the graph above with 18" propeller is

% Measurement from esc,motor,propeller test
% file created 2020-10-04 17:40:42.147504
% 1: esc value (motor 1) 0=1ms, 1024 = 2ms
% 2: rps (motor 1) a rotations per second)
% 3: rps (motor 1) b rotations per second)
% 4: Motor voltage (volt)
% 5: total current (amps)
% 6: thrust force (gram force)
% 7: CCV (rotation direction)
% 8: Temperature motor (deg C)
% 9: Temperature ESC (deg C)
100 5.95 5.95 11.3 0.2 12 0 24.7 28.3
200 16.19 16.18 11.2 0.8 112 0 24.7 28.2
300 24.77 24.76 11.2 2.2 270 0 24.7 28.8
400 31.39 31.42 11.0 4.7 440 0 23.9 29.5
500 36.94 36.98 11.2 9.0 640 0 25.1 30.0
550 38.70 38.70 11.3 10.5 700 0 25.8 31.4
600 40.72 40.56 11.0 12.5 770 0 28.4 32.4
650 41.95 42.14 10.7 14.6 840 0 29.1 35.4
700 43.73 43.73 11.1 18.5 890 0 33.1 37.1
750 44.79 44.83 10.8 20.2 960 0 35.0 37.9
800 45.53 45.56 11.8 22.3 1000 0 39.6 39.0

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.

Motortest gui.png

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.

Drone ctrl simulink.png

Simulink model of hexacopter.

Drone ctrl sim hex.png

Sim mechanics simulated hex-drone hoovering.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox