nicolapiccinelli / libmpc

libmpc++ is a C++ header-only library to solve linear and non-linear MPC
https://altairlab.gitlab.io/optcontrol/libmpc/
MIT License
137 stars 21 forks source link

Is this lab able to support output reference has ten sets of different value in each steps? If so, which file should I refer to? Thanks #5

Closed ZhYGu closed 1 year ago

ZhYGu commented 2 years ago

I'd like to make a path planning with your lib. However, in your examples, it only has a constant output reference. However in my case, each step should has differenct values for output. Could you please help me to figure out how to do it?

ZhYGu commented 2 years ago

For example, I have a desired path for each step as [x y z]T, and for each step it is differenct, I want the output in each prediction horizon approach to the desired output value. So the output value is not constant, how can I set the output reference and how to edit the constrain or objective function? Is there any option I can choose to realize it?

ZhYGu commented 2 years ago

@nicolapiccinelli

nicolapiccinelli commented 2 years ago

Hi @ZhYGu are you talking about the linear MPC module? If so, I can add it or if you wish you can open a pull on this and contribute to the lib.

ZhYGu commented 2 years ago

Yes, I am talking about LMPC. I am not sure how to input the different output references. I have not used osqp before, so it may be difficult for me to add it to this lib. However, I found in the problembuilder, it says varied reference is possible. Could you tell me when the changing references are doable? Thanks.

获取 Outlook for iOS

发件人: Nicola Piccinelli @.> 发送时间: Thursday, November 10, 2022 4:00:50 AM 收件人: nicolapiccinelli/libmpc @.> 抄送: Z. Gu @.>; Mention @.> 主题: Re: [nicolapiccinelli/libmpc] Is this lab able to support output reference has ten sets of different value in each steps? If so, which file should I refer to? Thanks (Issue #5)  

Hi @ZhYGu are you talking about the linear MPC module? If so, I can add it or if you wish you can open a pull on this and contribute to the lib. ― Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ZhYGu commented 2 years ago

Also, for the result, I found in your version only the first input will be returned. Is there any way I can get the result for each prediction horizons?

获取 Outlook for iOS

发件人: Nicola Piccinelli @.> 发送时间: Thursday, November 10, 2022 4:00:50 AM 收件人: nicolapiccinelli/libmpc @.> 抄送: Z. Gu @.>; Mention @.> 主题: Re: [nicolapiccinelli/libmpc] Is this lab able to support output reference has ten sets of different value in each steps? If so, which file should I refer to? Thanks (Issue #5)  

Hi @ZhYGu are you talking about the linear MPC module? If so, I can add it or if you wish you can open a pull on this and contribute to the lib. ― Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

nicolapiccinelli commented 2 years ago

I will answer both your questions here:

  1. Regarding the possibility of having different reference at each prediction horizon there is not a limit in the solver. As it is now it's just a matter of adding a new API in the LMPC class and then rework a bit the internal mechanism to provide the full reference to the optimizer instead of just copying the reference to all steps.
  2. In this case I would have a new API to retrive the optimal sequence, since generally in the MPC we apply just the first optimal command in the sequence. Anyway, this could be useful in some cases.

Now the options are: I can take in charge of adding these functionalities to the current code base but it will take about 1 week, or if you feel confident enough you can take in charge of doing that (maybe just one of them) and then we can review your solution

nicolapiccinelli commented 1 year ago

@ZhYGu I’m working on the first point, probably tomorrow I will give a look into the retrieval of the optimal sequence. Unfortunately, there will be breaking changes in the LMPC api.

ZhYGu commented 1 year ago

P {margin-top:0;margin-bottom:0;}

Thank you so much!

发件人: Nicola Piccinelli @.> 发送时间: 2022年11月12日 3:19 收件人: nicolapiccinelli/libmpc @.> 抄送: Z. Gu @.>; Mention @.> 主题: Re: [nicolapiccinelli/libmpc] Is this lab able to support output reference has ten sets of different value in each steps? If so, which file should I refer to? Thanks (Issue #5)  

@ZhYGu I’m working on the first point, probably tomorrow I will give a look into the retrieval of the optimal sequence. Unfortunately, there will be breaking changes in the LMPC api. ― Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

nicolapiccinelli commented 1 year ago

@ZhYGu version 0.1.0 released, cheers!

ZhYGu commented 1 year ago

!thats great

获取 Outlook for iOS

发件人: Nicola Piccinelli @.> 发送时间: Saturday, November 12, 2022 1:34:05 PM 收件人: nicolapiccinelli/libmpc @.> 抄送: Z. Gu @.>; Mention @.> 主题: Re: [nicolapiccinelli/libmpc] Is this lab able to support output reference has ten sets of different value in each steps? If so, which file should I refer to? Thanks (Issue #5)  

@ZhYGu version 0.1.0 released, cheers! ― Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>