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

Sysid and control design using ulog #26

Open
mzahana opened this issue Jan 2, 2018 · 11 comments
Open

Sysid and control design using ulog #26

mzahana opened this issue Jan 2, 2018 · 11 comments

Comments

@mzahana
Copy link

mzahana commented Jan 2, 2018

Hi @jgoppert

Can ulog files be used in the sysid and control design instead of px4log? If yes, what is the procedure to do it?

Thanks.

@jannsta1
Copy link

Hi @mzahana,

You could try using this repo instead: https://github.com/dronecrew/ulog_tools.

I would also be interested in seeing a best practices procedure for this - e.g. how to set the parameters and if logfiles with particular flight manoeuvres produce better results.

@mzahana
Copy link
Author

mzahana commented Jan 21, 2018

@jannsta1 Thanks for pointing me out to that repo. I will try it and provide my feedback.

@mzahana
Copy link
Author

mzahana commented Jan 22, 2018

I am getting the following error.

AttributeError: module 'scipy.linalg' has no attribute 'solve_lyapunov'

I am using

  • anaconda 3
  • Python 3.6.3

Any idea how to fix this?

EDIT:

doing conda list | grep scipy gives

scipy                     1.0.0            py36h1de22e9_0    anaconda

@mzahana
Copy link
Author

mzahana commented Jan 22, 2018

Ok. I got it working by installing an earlier version of scipy=0.19.1

@jannsta1
Copy link

Glad you got it working @mzahana. Would be interested to know if you do manage to get some good results from the package? By naively running I don't seem to get a particularly good tune, especially in yaw and pitch fails entirely! Planning to play around with the matlab toolbox a bit so I understand the parameters better and then coming back to it.

@mzahana
Copy link
Author

mzahana commented Jan 25, 2018

Same here. I am not getting good identification of the control gains and I fall back to old set of gains that work much better. I will study more how this can be improved. It also would be good to know what you exactly plan to use (algortihms) to solve this issue.

@DanAbara
Copy link

DanAbara commented Aug 1, 2019

@mzahana and @jannsta1 I have also used the repo suggested on this thread, however I get the following error when I run the module to obtain the sample frequency:
KeyError Traceback (most recent call last)
in
6 comb = ut.sysid.prepare_data('log_48.ulg')
7
----> 8 sf = ut.ulog.sample_frequency(log)

~.conda\envs\ut_env\lib\site-packages\ulog_tools_ulog.py in sample_frequency(data)
28 def sample_frequency(data):
29 """Compute sampling frequency"""
---> 30 return 1.0e6 / np.diff(data['f_timestamp']).mean()

KeyError: 'f_timestamp'

I have scipy=0.19 so that is probably not the problem. Any suggestions would be greatly appreciated. I struggled with the px4tools and got stuck so decided to try the ulog_tools repo. Thanks in advance.

@DanAbara
Copy link

DanAbara commented Aug 2, 2019

Update:
@mzahana and @jannsta1
So I sorted it out and its all working now. I have another question though, how can I export data to csv. For instance, if I use the prepare_data module in the '_sysid.py' file, I obtain a data structure which holds the re-sampled input/output data in a tabular form. I plan to export this to a csv and perform identification in matlab, to see how that goes, but I have little or no idea how to do that. I'm quite new to python, just learning the ropes. Any advice to ease my struggle will be helpful.

Thank you.

@jannsta1
Copy link

jannsta1 commented Aug 2, 2019

From what I remember it's a pandas data frame which has a built in to_csv() method. I think there are also libraries that convert .ulg files directly into MATLAB data structures.

@DanAbara
Copy link

DanAbara commented Aug 3, 2019

@jannsta1 if i understand correctly, you're saying the output data structure of the resampled data is a pandas data frame with a built in to_csv() method (don't know what that means though I'll look it up), so that means there should be some way to open it as a csv or convert it to csv etc right? Thanks by the way for responding.

Update:
So I managed to get it sorted as well. Thank you very much @jannsta1. Best wishes.

@DanAbara
Copy link

DanAbara commented Aug 5, 2019

@jgoppert , @jannsta1 and @mzahana have to trouble you guys again. I have a question about the sysid process in the ulog_tools package.

Why is the output signal (angular velocity) differentiated to get accelerations before the sys id?

Why is the signal not used directly?

Thank you

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

3 participants