Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'System Identification and Control Design' example running error too #31

Open
CornerOfSkyline opened this issue Mar 29, 2018 · 5 comments

Comments

@CornerOfSkyline
Copy link

CornerOfSkyline commented Mar 29, 2018

When i run the System Identification and Control Design example , in step 3 i got this error. How can i fix it? @jgoppert

/home/user/anaconda3/lib/python3.6/site-packages/control/freqplot.py:153: MatplotlibDeprecationWarning: pyplot.hold is deprecated.
    Future behavior will be consistent with the long-time default:
    plot commands add elements without first clearing the
    Axes and/or Figure.
  plt.hold(True);
/home/user/anaconda3/lib/python3.6/site-packages/matplotlib/__init__.py:805: MatplotlibDeprecationWarning: axes.hold is deprecated. Please remove it from your matplotlibrc and/or style files.
  mplDeprecation)
/home/user/anaconda3/lib/python3.6/site-packages/matplotlib/rcsetup.py:155: MatplotlibDeprecationWarning: axes.hold is deprecated, will be removed in 3.0
  mplDeprecation)
/home/user/anaconda3/lib/python3.6/site-packages/control/freqplot.py:163: MatplotlibDeprecationWarning: pyplot.hold is deprecated.
    Future behavior will be consistent with the long-time default:
    plot commands add elements without first clearing the
    Axes and/or Figure.
  plt.hold(True);
/home/user/anaconda3/lib/python3.6/site-packages/matplotlib/cbook/deprecation.py:106: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  warnings.warn(message, mplDeprecation, stacklevel=1)

margins (1.6063530208385868, 53.69495402420043, 31.494696420182457, 92.34314850122355)
margins (3.865272625550007, 67.586291048282, 9.166550830029614, 48.26946306098183)
      fun: 234778.47387434263
 hess_inv: <2x2 LbfgsInvHessProduct with dtype=float64>
      jac: array([-1.61817297e+00,  1.64574164e+05])
  message: b'ABNORMAL_TERMINATION_IN_LNSRCH'
     nfev: 351
      nit: 16
   status: 2
  success: False
        x: array([1.88306637e+02, 4.49999996e-02])

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-6-e515a7be8a66> in <module>()
      1 gains, design_data = px4tools.logsysid.control_design(data[20:80],
----> 2     do_plot=True)
      3 print(json.dumps(gains, indent=4))

~/anaconda3/lib/python3.6/site-packages/px4tools/logsysid.py in control_design(raw_data, do_plot, rolling_mean_window, verbose)
    388         'pitch rate', pitch_acc, data.ATTC_Pitch,
    389         rolling_mean_window=rolling_mean_window,
--> 390         do_plot=do_plot, d_tc=d_tc, verbose=verbose)
    391 
    392     K_pitch, G_pitch, G_cl_pitch = pid_design(

~/anaconda3/lib/python3.6/site-packages/px4tools/logsysid.py in attitude_control_design(name, y, u, rolling_mean_window, do_plot, verbose, d_tc)
    327 
    328     G_ol, delay, k = attitude_sysid(
--> 329         y_debiased, u_debiased, verbose)
    330 
    331     K, G_ol_rate, G_cl_rate = pid_design(

~/anaconda3/lib/python3.6/site-packages/px4tools/logsysid.py in attitude_sysid(y_acc, u_mix, verbose)
    228     if verbose:
    229         print('solving for plant model ', end='')
--> 230     k, delay = delay_and_gain_sysid(y_acc, u_mix, verbose)
    231     if verbose:
    232         print('done')

~/anaconda3/lib/python3.6/site-packages/px4tools/logsysid.py in delay_and_gain_sysid(y, u, verbose)
     86     if res['success'] != True:
     87         print(res)
---> 88         raise RuntimeError('optimization failed')
     89     elif verbose:
     90         print(res)

RuntimeError: optimization failed


@hmchung
Copy link

hmchung commented Oct 31, 2018

@CornerOfSkyline , any luck? I am also having the same issue...

@frontw
Copy link

frontw commented Oct 2, 2019

+1

@jgoppert
Copy link
Member

jgoppert commented Oct 2, 2019

I haven't run the example recently. It looks like the optimizer is diverging. The goal is to minimize the rms error by changing the two parameters, delay and gain. Maybe try plotting the two functions to see what is happening.

@jgoppert
Copy link
Member

jgoppert commented Oct 2, 2019

This repo is more recent: https://github.com/dronecrew/ulog_tools

@frontw
Copy link

frontw commented Oct 2, 2019

This repo is more recent: https://github.com/dronecrew/ulog_tools

Thanks! Will try (after making new high-rate logs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants