Giter Club home page Giter Club logo

Comments (19)

zanellia avatar zanellia commented on July 24, 2024 1

Ahh, I thought using the C interface will be a faster way to implement as Python does not comes into the picture. Although I dont have experience with Simulink Coder but I feel using the C interface by calling it in a s-function can work, unless I am really missing out on something which I am not aware of.

This approach is definitely possible and will allow you in principle to use Simulink Coder to deploy on embedded platforms like dSPACE or Beckhoff. In the not-so-long run, we will support automatic generation of the S-Function from Python/MATLAB.

from hpipm.

giaf avatar giaf commented on July 24, 2024

Hi, there is a matlab interfaced (which is currently based on the python interface) to interactively use the solver from matlab.

There is not a simulink interface yet, but maybe @zanellia may give you some suggestion to get started with that.

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

Thanks @giaf.

Hi @zanellia, it will be great if you can provide me some suggestions regarding using hpipm in Simulink.

from hpipm.

zanellia avatar zanellia commented on July 24, 2024

Hey @PranjaLBiswas27, thanks for your interest in HPIPM! A Simulink interface could be indeed a useful bit to be added to the codebase. Can you give us a bit more details about what are your needs? I haven't put any concrete thought into how to build such an interface, but I guess in principle you could call the MATLAB interface from Simulink?

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

Hi @zanellia,

Thanks for getting back to me. To be honest I am really trying to figure out what my needs are and thus the solver I require. As of now my requirement is to implement MPCC, for which @alexliniger from ETH has referenced this repository. So I was wondering if HPIPM works similarly to quadprog or mpcqp in MATLAB, at least in terms of using it within a MATLAB code and not how it solves the QP. Also my initial idea was to use it within a s-function or MATLAB function itself if possible. What do you think?

Kind Regards
Pranjal Biswas

from hpipm.

zanellia avatar zanellia commented on July 24, 2024

@PranjaLBiswas27 if performance/embeddability (QP solutions will be very fast, but you might loose some performance with the interaction between Simulink-MATLAB and the HPIPM shared library) are not the main focus, calling the MATLAB interface from Simulink might be the quickest/easiest solution. I can assist you with this. Otherwise we need to set up something a bit more structured.

from hpipm.

zanellia avatar zanellia commented on July 24, 2024

Just to be more specific, do you need to run on anything like dSPACE or Beckhoff systems?

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

@zanellia, thanks. Yes, I do think I will require to generate C-code of Simulink model using the code builder that is provided with MATLAB to be able to implement in real time in a HIL setup. This might require me to work with d-space but I am not sure as of now.

Also, for simulation purposes the performance is not a consideration but it is important while running real-time though. What exactly do you mean by a more structured approach, like making a Simulink block all-together?

from hpipm.

zanellia avatar zanellia commented on July 24, 2024

The MATLAB interface runs MATLAB and Python code that, most likely, you don't want to deploy on the embedded unit. In order to go embedded we would need to compile everything (both HPIPM and the calls to the C API) in a shared library and an S-Function that you can also crosscompile.

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

Sorry if I am a bit naive, but HIL does not necessarily mean emebedded?

Also, is it possible to use hpipm within a s-function and generate C code using the code builder? Will it lead to any issues considering hpipm runs python code?

from hpipm.

zanellia avatar zanellia commented on July 24, 2024

If you want to use Simulink Coder, I would be surprised if you could generate C code from a MATLAB function that calls the Python interpreter. I can spend some time to look into this in the next days, a Simulink/MATLAB/Python to embedded interface is anyway something useful. @giaf Do you think something like what we did in acados with templated C code would be a solution?

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

@zanellia, is there a C version also of hpipm? In that case maybe it will then be possible to use the Simulink coder?

from hpipm.

zanellia avatar zanellia commented on July 24, 2024

Yes, of course :) If you are willing to use the C interface you can have a look at the C examples: https://github.com/giaf/hpipm/tree/master/examples/c. Ideally this code could be generated directly from from MATLAB/Simulink/Python. That's the slightly longer term solution I would think about.

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

Ahh, I thought using the C interface will be a faster way to implement as Python does not comes into the picture. Although I dont have experience with Simulink Coder but I feel using the C interface by calling it in a s-function can work, unless I am really missing out on something which I am not aware of.

Other than that anyway my main concern is being able to use hpipm irrespective of C or python interpreter in Simulink. What will you suggest to do considering the following points:

  1. I am a novice :)
  2. Would like to go for the approach (C or Python) which ever is relatively simpler.
  3. Be able to generate C-code of my Simulink model while being able to use hpipm.

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

Thanks for the clarification. Also, looking forward to the automatic generation of the s-function, it will be really handy. Is there any expected date for it?

from hpipm.

giaf avatar giaf commented on July 24, 2024

@zanellia any new with a s-function prototype?

from hpipm.

zanellia avatar zanellia commented on July 24, 2024

@PranjaLBiswas27, @giaf sorry for the loose response. I am working on it on this branch: https://github.com/zanellia/hpipm/tree/simulink_interface/interfaces/simulink - it's work in progress.

from hpipm.

PranjalBiswas avatar PranjalBiswas commented on July 24, 2024

@zanellia do you already have the Simulink interface working?

from hpipm.

giaf avatar giaf commented on July 24, 2024

@zanellia is currently on holiday, but back on the Simulink interface in one week from now :) Soon ready!

from hpipm.

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.