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

Create a logging tool using matio #69

Closed
S-Dafarra opened this issue Jul 10, 2020 · 20 comments
Closed

Create a logging tool using matio #69

S-Dafarra opened this issue Jul 10, 2020 · 20 comments
Assignees

Comments

@S-Dafarra
Copy link
Member

I would like to have a logging library in the framework. I would need to log some rotation matrices from the MasImuTest I am currently developing. As far as I know, both @GiulioRomualdi, @prashanthr05 and @kouroshD developed a logger for different purposes. It would be better to unify these tools in a single library in this repo. Ideally, we should be able to save data to a mat file.

Any idea?

@S-Dafarra S-Dafarra added this to the Iteration 47 - Hot restart milestone Jul 10, 2020
@S-Dafarra S-Dafarra self-assigned this Jul 10, 2020
@traversaro
Copy link
Collaborator

I would separate "logging vector/matrix data" and "logging text". I guess this issue is about the first, and not about the second. MatLogger2 is nice, but probably would require some work to be supported on Windows (and macOS?) and there is still the licensing issue (see ADVRHumanoids/MatLogger2#3). I can ping the MatLogger2's dev on the license issue that is I am afraid the more critical, but if we want to move fast at least initially rolling out our own simple solution (perhaps using existing libraries for the actual dumping of data to files such as matio/Eigen-matio or something for csv) may be the way to go.

@S-Dafarra
Copy link
Member Author

S-Dafarra commented Jul 10, 2020

I would separate "logging vector/matrix data" and "logging text". I guess this issue is about the first, and not about the second.

Yes, I was not precise. It is about logging data.

MatLogger2 is nice, but probably would require some work to be supported on Windows (and macOS?) and there is still the licensing issue (see ADVRHumanoids/MatLogger2#3). I can ping the MatLogger2's dev on the license issue that is I am afraid the more critical, but if we want to move fast at least initially rolling out our own simple solution (perhaps using existing libraries for the actual dumping of data to files such as matio/Eigen-matio or something for csv) may be the way to go.

Ok, if MatLogger2 is a problem, then matio/Eigen-matio can be an option. As far as I can see, Eigen-matio seems to be pretty simple and a good example from which to start. At this point then, if we create a clean interface toward matio, does it make sense to incorporate it in the framework or it would be better to keep it as a separate repo?

@GiulioRomualdi
Copy link
Member

GiulioRomualdi commented Jul 10, 2020

Back in time, I developed a frontend for using MatLogger with yarp ports https://github.com/GiulioRomualdi/YarpMatLogger.
As regards eigen-matio I also implemented this simple cmake machinery to simplify the usage with other libraries/applications GiulioRomualdi/eigen-matio@5623ca4 (e.g. find_package() stuff)

@S-Dafarra
Copy link
Member Author

Back in time, I developed a frontend for using MatLogger with yarp ports https://github.com/GiulioRomualdi/YarpMatLogger.
As regards eigen-matio I also implemented this simple cmake machinery to simplify the usage with other libraries/applications GiulioRomualdi/eigen-matio@5623ca4 (e.g. find_package() stuff)

For the time being, I would avoid being bound to Yarp. In addition, as mentioned above MatLogger2 is not an easy dependency.

The interface to matio is definitely interesting. As @GiulioRomualdi and @traversaro know already, it seems that CMake support in matio is a little complicated (tbeu/matio#53 and tbeu/matio#107), hence

I also implemented this simple cmake machinery to simplify the usage with other libraries/applications GiulioRomualdi/eigen-matio@5623ca4 (e.g. find_package() stuff)

is tempting. But then, how do we proceed. We keep working on https://github.com/GiulioRomualdi/eigen-matio/tree/install_package or we move this somewhere else as we did for osqp-eigen? A third option may also to move this interface in the framework. What would you prefer?

@GiulioRomualdi
Copy link
Member

GiulioRomualdi commented Jul 10, 2020

As @GiulioRomualdi and @traversaro know already, it seems that CMake support in matio is a little complicated

Actually matio can be installed with apt-get on ubuntu, with brew on macOS and on windows with vcpkg.
For eigen-matio I think it's a different story

But then, how do we proceed. We keep working on https://github.com/GiulioRomualdi/eigen-matio/tree/install_package or we move this somewhere else as we did for osqp-eigen? A third option may also to move this interface in the framework. What would you prefer?

I think we can move it in dic organization. By the way I don't know if it is still working 😃

@S-Dafarra
Copy link
Member Author

S-Dafarra commented Jul 10, 2020

As @GiulioRomualdi and @traversaro know already, it seems that CMake support in matio is a little complicated

Actually matio can be installed with apt-get on ubuntu, with brew on macOS and on windows with vcpkg.
For eigen-matio I think it's a different story

Ah, that's another story 😁 Thanks for pointing out. Probably, at this stage, given that this may be useful for projects outside the bipedal locomotion scope, it may make sense to open a separate repository using what we have as a starting point. Later on, we can think of some cool features to add.

@prashanthr05
Copy link
Collaborator

In the past, I tried using matio by installing from apt in a very naive and minimal implementation https://github.com/dic-iit/element_floating-base-estimation/blob/humest/benchmark/estimators/code/benchmark/base-estimator/include/MatHandler.hpp

However, https://github.com/GiulioRomualdi/eigen-matio/tree/install_package seems nice.

@S-Dafarra
Copy link
Member Author

S-Dafarra commented Jul 13, 2020

In the past, I tried using matio by installing from apt in a very naive and minimal implementation https://github.com/dic-iit/element_floating-base-estimation/blob/humest/benchmark/estimators/code/benchmark/base-estimator/include/MatHandler.hpp

However, https://github.com/GiulioRomualdi/eigen-matio/tree/install_package seems nice.

I used matio too back in time. As far as I remember, the problems were mainly related to the fact that memory is dealt in C style and you have to free variables manually, plus the documentation is not the best. Indeed, I was thinking of using/creating something that could hide the matio complexity.

@prashanthr05
Copy link
Collaborator

I used matio too back in time. As far as I remember, the problems were mainly related to the fact that memory is dealt in C style and you have to free variables manually, plus the documentation is not the best.

I agree. It becomes a bit cumbersome to use the library directly. Also, readability (motivation to read code) reduces with that kind of complexity :D

@S-Dafarra
Copy link
Member Author

@S-Dafarra
Copy link
Member Author

S-Dafarra commented Jul 22, 2020

After working a little bit on https://github.com/dic-iit/eigen-matio/tree/initial_refactory I quickly realized that the refactory was touching most of the available code. Since:

  • eigen-matio is basically a single header file and a CMakelists.txt
  • I basically started changing more than half of the code,
  • It does not support vector of matrices or structs,

I decided to start a new project defining a c++ interface to matio. It is still a WIP. The code is available at https://github.com/dic-iit/matio-cpp

@GiulioRomualdi
Copy link
Member

I decided to start a new project defining a c++ interface to matio. It is still a WIP. The code is available at https://github.com/dic-iit/matio-cpp

I think that the code is private. I don't have the access for it

@S-Dafarra
Copy link
Member Author

I decided to start a new project defining a c++ interface to matio. It is still a WIP. The code is available at https://github.com/dic-iit/matio-cpp

I think that the code is private. I don't have the access for it

I decided to keep it private before it is finished, but I should grant you access. Let me fix it.

@S-Dafarra
Copy link
Member Author

I decided to start a new project defining a c++ interface to matio. It is still a WIP. The code is available at https://github.com/dic-iit/matio-cpp

I think that the code is private. I don't have the access for it

I should have granted you access. In any case, I am working on the branch https://github.com/dic-iit/matio-cpp/tree/firstVersion.

I will open a PR when I am going to have something useful.

@S-Dafarra S-Dafarra changed the title Add a logging class to the framework Create a logging tool using matio Aug 26, 2020
@S-Dafarra
Copy link
Member Author

The first PR is ami-iit/matio-cpp#1. It is still a WIP, but I thought it was starting to be something worth reviewing.

@S-Dafarra
Copy link
Member Author

The first PR got merged. Working on a follow-up.

@S-Dafarra
Copy link
Member Author

I opened a second PR: ami-iit/matio-cpp#7. This one deals with multidimensional arrays.

@S-Dafarra
Copy link
Member Author

Here the third PR: ami-iit/matio-cpp#8. This was a necessary step to handle matio pointers correctly when using files, structs, or cell arrays.

@DanielePucci
Copy link
Member

CC @dic-iit/dynamic-interaction-control

@S-Dafarra
Copy link
Member Author

The almost-final version is in the improvements branch. I have more or less implemented all the features I wanted:

  • handling of files
  • handling of elements, vectors, and arrays
  • handling of cell arrays
  • handling of structs and struct arrays.

At the moment, several PRs are on the line. One is open (ami-iit/matio-cpp#15), other 3 are waiting. I think we can close this issue in the meantime.

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

5 participants