System Identification and Control Design


In [1]:
%load_ext autoreload
%autoreload 2c
import px4tools
import px4tools.logsysid
import pandas
import control
import json
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
data = px4tools.process_data(pandas.read_csv('./sess052/log001.csv'))

In [3]:
gains, design_data = px4tools.logsysid.control_design(data[20:80],
    do_plot=True)
print(json.dumps(gains, indent=4))


fit quality 88.29 %
fit quality 87.12 %
/home/jgoppert/anaconda3/lib/python3.5/site-packages/matplotlib/pyplot.py:524: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).
  max_open_warning, RuntimeWarning)
{
    "MC_ROLL_P": 8.908,
    "MC_ROLLRATE_P": 0.099,
    "MC_ROLLRATE_I": 0.098,
    "MC_ROLLRATE_D": 0.002,
    "MC_PITCH_P": 9.412,
    "MC_PITCHRATE_P": 0.101,
    "MC_PITCHRATE_I": 0.099,
    "MC_PITCHRATE_D": 0.003
}
<matplotlib.figure.Figure at 0x7fad9636fb00>
<matplotlib.figure.Figure at 0x7fad9606e748>
<matplotlib.figure.Figure at 0x7fad99d79390>
<matplotlib.figure.Figure at 0x7fad965247b8>
<matplotlib.figure.Figure at 0x7fad960dc0b8>
<matplotlib.figure.Figure at 0x7fad95caceb8>
<matplotlib.figure.Figure at 0x7fad9650fcc0>
<matplotlib.figure.Figure at 0x7fad9644e710>

In [4]:
gains


Out[4]:
OrderedDict([('MC_ROLL_P', 8.9079999999999995),
             ('MC_ROLLRATE_P', 0.099000000000000005),
             ('MC_ROLLRATE_I', 0.098000000000000004),
             ('MC_ROLLRATE_D', 0.002),
             ('MC_PITCH_P', 9.4120000000000008),
             ('MC_PITCHRATE_P', 0.10100000000000001),
             ('MC_PITCHRATE_I', 0.099000000000000005),
             ('MC_PITCHRATE_D', 0.0030000000000000001)])