Menu

Embedded implementation of GRAMPC

Karthik
2024-08-26
2024-10-19
  • Karthik

    Karthik - 2024-08-26

    Hi,

    I am a PhD student in optimization based control and would like to
    evaluate GRAMPC for implementing NMPC. I had setup the tool in my PC
    and able to run few examples. I had gone through documentation and some
    published papers also and tried PYGRAMPC also. I would like to know the
    compilation steps of GRAMPC for a RISC-V micro-controller. I understand
    its already implemented for dSpace, RH850 etc. Is there any tutorial
    for implementation on embedded controller (similar to the PC
    implementation as mentioned in the documentation ) ? Any help will be
    much appreciated.

    Thanks and Regards
    Karthik R

     

    Last edit: Andreas Völz 2024-08-27
  • Andreas Völz

    Andreas Völz - 2024-08-27

    Dear Karthik,

    since there exist so many different microcontrollers, it is impossible for us to provide examples or tutorials for each of them. The manufacturer of your controller probably provides some minimal examples for running own programs on the controller. I would take these as starting points and then integrate GRAMPC. If you need more help, then you should at least share such a minimal example.

    Best regards,
    Andreas Völz

     
  • Karthik

    Karthik - 2024-09-10

    Dear @avoelz,

    Thanks for the response and Sorry I missed it. I am able to build the program without any errors but with following warnings. Hope its not a major issue.

    ...\src\grampc\include/f2cmod.h:90:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
    typedef int / Unknown procedure type /(U_fp)();
    ^~~~~~~
    ...\src\grampc\include/f2cmod.h:91:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
    typedef /
    Subroutine / int(S_fp)();

    I need to see the performance in hardware. I will get back in-case any issue is there. Thanks once again for the response.

    Thanks n Regards,
    Karthik R

     
  • Andreas Völz

    Andreas Völz - 2024-09-10

    Dear Karthik,

    I guess that you can ignore the warnings. After all, this file is only relevant for the RODAS integrator and it is not very likely that you will use RODAS in an embedded MPC application.

    Best regards,
    Andreas Völz

     
  • Karthik

    Karthik - 2024-10-02

    Dear @avoelz,

    While going through one of the published papers from your team (https://ieeexplore.ieee.org/document/9867380), there is a reference to the usage of NMPC with state dependent mass matrix in system dynamics as given below.

    A. Volz and K. Graichen, “Gradient-based nonlinear model predictive control for systems with state-dependent mass matrix,” in Proc. of the Conference on Decision and Control (CDC), 2021, pp. 1012–1017.

    Whether GRAMPC can solve such problems ?

    Thanks n Regards,
    Karthik R

     
    • Andreas Völz

      Andreas Völz - 2024-10-02

      Dear Karthik,

      for this paper I had reimplemented the core algorithm of GRAMPC in C++ in order to keep it as simple as possible and to tailor it to the special case of rigid body dynamics. In principle it would also be possible to implement the same algorithm within GRAMPC but it would be quite a lot of effort and I doubt that enough people would use this special variant to justify the effort.

      However, GRAMPC can still be used for MPC of systems with rigid body dynamics. It just requires using forward dynamics (e.g. using ABA) instead of inverse dynamics (e.g. using RNEA).

      Best regards,
      Andreas Völz

       
  • Karthik

    Karthik - 2024-10-16

    Dear @avoelz

    Thanks for the reply. It took some time to go through basics of RNEA and ABA.. Can you please clarify the following

    a) I was thinking whether the same will be applicable for a rocket example with depleting mass ?. So GRAMPC is not applicable here too ? Sorry for the confusion.

    b) Also even if we use ABA, GRAMPC software may be of less help for the manipulator dynamics case and its better to code from scratch ?

    c) For kinematics solving, GRAMPC will suffice ryt

     Please correct if wrong.
    

    Thanks and Regards
    Karthik R

     
    • Andreas Völz

      Andreas Völz - 2024-10-17

      Dear Karthik,

      was thinking whether the same will be applicable for a rocket example with depleting mass ?. So GRAMPC is not applicable here too ? Sorry for the confusion.

      If the dynamics can be formulated as ordinary differential equation or index-1 differential algebraic equation, GRAMPC should be applicable. For most systems this is probably the case. However, I can't tell for sure without more details about the actual system.

      Also even if we use ABA, GRAMPC software may be of less help for the manipulator dynamics case and its better to code from scratch ?

      You can definitely do MPC for robot manipulators with GRAMPC. You need the forward dynamics which can either be computed in a symbolic manner, numerically using ABA or a combination of RNEA, CRBA and Cholesky decomposition. In addition you need the partial derivatives. It is some work, but it is possible. The point of the previously mentioned paper was that a tailored numerical solution can improve the efficiency.

      For kinematics solving, GRAMPC will suffice ryt

      I don't know what you mean by "kinematics solving", but if you mean MPC without rigid body dynamics and using forward kinematics in cost functions and constraints, this is something that can be solved quite efficiently in GRAMPC.

      Still, rigid body dynamics is also possible in GRAMPC. It's just that a general purpose solver is usually not as efficient as an implementation that is tailored to one specific problem. However, that does not mean that you should implement your own solver for each problem. We work with the general purpose solver unless there is a very good reason for implementing it from scratch.

      Best regards,
      Andreas Völz

      PS: If you cannot share more details about your specific problem in a public discussion board, then you can also contact me by email. If you want, we can schedule an online meeting and then discuss the details of your system.

       
  • Karthik

    Karthik - 2024-10-19

    Dear @avoelz,

    Thanks a lot for the clarification and detailed explanation.

    1) If the dynamics can be formulated as ordinary differential equation or index-1 differential algebraic equation, GRAMPC should be applicable. For most systems this is probably the case. However, I can't tell for sure without more details about the actual system.

    Reply :- Understood.

    2) You can definitely do MPC for robot manipulators with GRAMPC. You need the forward dynamics which can either be computed in a symbolic manner, numerically using ABA or a combination of RNEA, CRBA and Cholesky decomposition. In addition you need the partial derivatives. It is some work, but it is possible. The point of the previously mentioned paper was that a tailored numerical solution can improve the efficiency.

    Reply :- I understood the significance from the solver's point of view. Need little more help to clarify the doubt regarding the rigid body algorithms mentioned. I shall contact you by email.

    3) I don't know what you mean by "kinematics solving", but if you mean MPC without rigid body dynamics and using forward kinematics in cost functions and constraints, this is something that can be solved quite efficiently in GRAMPC.

    Reply :- Yes. I meant this only. Was planning to implement simple kinematics solver using GRAMPC and then move towards dynamics.

    Sure. I shall contact you by mail. I think we can close the thread as of now. Thanks once again for the great support.

    Thanks n Regards,
    Karthik R

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.