Coder Social home page Coder Social logo

Matlab interface about pinocchio HOT 12 CLOSED

stack-of-tasks avatar stack-of-tasks commented on August 20, 2024
Matlab interface

from pinocchio.

Comments (12)

cmastalli avatar cmastalli commented on August 20, 2024 1

I would like to add a comment to this discussion line. Indeed it's very tricky to bind Eigen data with Numpy. During the period at IIT, I used SWIG to bind Eigen data. Basically you need to write an interface file, this file can be re-used for any project. Here you find the file:
https://github.com/robot-locomotion/dwl/blob/master/swig/eigen.i

from pinocchio.

aelkhour avatar aelkhour commented on August 20, 2024

I have a question related to this issue:

There seems to be an ongoing effort to provide Matlab support in swig. Did you give any thought to using swig for the python interface generation?

from pinocchio.

nmansard avatar nmansard commented on August 20, 2024

Hello,
Yes indeed. I lightly benchmarked several python interface systems in terms of ease of use and efficiency. Boost seemed to be the best option.
The binding of eigen and mummy is indeed quite tricky. I would be a priori very reluctant to spend time doing it a second time.
On the other hand, matlab interfaces are very light to implement. Do you really thing that swing would help, if not for capitalising on the python bindings?
N
Le 16 oct. 2015 19:14, Antonio El Khoury [email protected] a écrit :I have a question related to this issue:

There seems to be an ongoing effort to provide Matlab support in swig. Did you give any thought to using swig for the python interface generation?

—Reply to this email directly or view it on GitHub.

from pinocchio.

aelkhour avatar aelkhour commented on August 20, 2024

A couple of questions:

  • What is mummy?
  • Is Eigen memory alignment the only tricky part or did you encounter other problems?

I am neither familiar with matlab interfaces nor with swig (at least not yet), and I am quite happy with the current state of the python bindings. So I would give swig a try only if it would make writing matlab interfaces faster than doing a raw binding (through mexFunction I guess).

from pinocchio.

jcarpent avatar jcarpent commented on August 20, 2024

One quick answer: mummy is in fact numpy.

from pinocchio.

nmansard avatar nmansard commented on August 20, 2024

Mummy is indeed the best my phone could propose to correct Numpy, as already corrected by Justin. Sorry for the typo.

The tricky part in boost::python was the memory alignment (or more exactly, the memory allocation of Eigen memory by boost::python, that does not respect Eigen alignment). The tricky part in general is to bind Eigen data in C with Numpy data in Python. It would be more straightforward to wrap Eigen data in Python. Wrapping is for example what is done for Pinocchio::Model or Pinocchio::Force classes: you are not using a Python object to make the equivalence with the C object, but directly manipulating the C object in Python.

I think binding Eigen with Numpy provides better functionalities in the end, however is more difficult to implement. For what I benchmarked initially, it seems equality tricky with the various Python wrapping/binding frameworks.

Again in my opinion, wrapping is much easier in Matlab, because Matlab is not strongly typed. Programming the matlab bindings could be done with much effort with the native MEX system of Matlab.

from pinocchio.

aelkhour avatar aelkhour commented on August 20, 2024

Thanks for the clarification, I will give the matlab MEX a try.

from pinocchio.

jcarpent avatar jcarpent commented on August 20, 2024

Have you implemented any Matlab interface? If not, are you still interested by such feature?

from pinocchio.

aelkhour avatar aelkhour commented on August 20, 2024

Sadly I haven't had the time to implement anything, but we are still clearly interested in such a feature.

from pinocchio.

traversaro avatar traversaro commented on August 20, 2024

If anyone ever needs that, a possible strategy to test is to use the Pinocchio Python bindings in MATLAB. Recent version of MATLAB have quite advanced Python interoperability features, see https://www.mathworks.com/help/matlab/call-python-libraries.html, ami-iit/bipedal-locomotion-framework#53 (comment) and robotology/robotology-superbuild#760 .

from pinocchio.

jcarpent avatar jcarpent commented on August 20, 2024

Fantastic. I didn't know that.
We may give it a try once. @proyan Would you may give it a try?

@traversaro What is your feedback on it?

from pinocchio.

traversaro avatar traversaro commented on August 20, 2024

@traversaro What is your feedback on it?

We only tried it for some examples for now (see ami-iit/bipedal-locomotion-framework#53 (comment)) but it seems quite promising, but to be honest we never had any serious use of it (like, a student that did all the computation for a paper/thesis in it). To quickly test it, if you have access a possible option is to install pinocchio via conda in MATLAB Online. We have a simple script in https://github.com/robotology/robotology-superbuild/blob/0f82a33dca1fe46111945e09382df26e39c0efb5/doc/matlab-one-line-install.md#installation-on-matlab-online for installing conda packages in MATLAB Online with a few commands.
To use the script with Python Pinocchio bindings, probably it would be sufficient to:

from pinocchio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.