MPC and MHE implementation in Matlab using Casadi | Part 2

  Рет қаралды 17,250

Mohamed W. Mehrez

Mohamed W. Mehrez

Күн бұрын

Пікірлер: 112
@Toyotaman
@Toyotaman Жыл бұрын
Thanks for the excellent presentation! I have 3 questions: 1. How do we consider a control horizon constraint to speed up the MPC? I am specifically struggling with indexing the args.ubx and args.lbx related to it. 2. Is the sampling time of the controller the same as the simulator here? if not, how can we do sampling at say every 10 step of simulation. 3. I couldn't understand how do we index the args.ubg and lbg? I want to add a second obstacle but I don't know how should I address it with the args structure.
@MohamedWMehrez
@MohamedWMehrez Жыл бұрын
1- you can split the cost function loop into TWO for-loops (one for prediction and one for control) each with its own size. This way, you can have different prediction and control horizons. 2- yes 3- the indexing follows the order of how you defined your constraints. Keep in mind the number of sates (3 in the lecture example) and the prediction horizon N
@fakuiwang4749
@fakuiwang4749 2 жыл бұрын
Dear Dr Mehrez, thanks for your presentation, it was very useful for me. I have two questions I would like to ask. (1) In mul_shooting, x_next=X(:,k+1), I want to know how X updates the state in casadi program? I don't see any update of X in the while loop. (2) In part 2 video, How do I get the code for four robots moving around circles?
@MohamedWMehrez
@MohamedWMehrez 2 жыл бұрын
Hi, Thank you for your comment (1) only the first entry of X is updated in the while-loop by the robot current pose x0 (2) all codes are on the GitHub for the discussed examples. The link is in the video description.
@fakuiwang4749
@fakuiwang4749 2 жыл бұрын
@@MohamedWMehrez I just checked and GitHub doesn't have this part of the code. The simulation of the circular formation of four robots, followed by the verification experiment of unmanned vehicles.
@ernestoestremera5014
@ernestoestremera5014 2 жыл бұрын
Dr. Mohamed W. Mehrez, thank you for this excellent presentation and for providing us with an ideal material to learn about these topics. I have a doubt; from minute 33:20, you explain the vector P and comment that they are lucky because they have the same number of inputs as outputs. My question is about this, what happens if this condition does not occur? If I have one output and 2 inputs, or one output that is state variable 3 and the input directly affects state variable 2? How is this correctly defined in Casadi? I reiterate my congratulations and thanks for this material.
@MohamedWMehrez
@MohamedWMehrez 2 жыл бұрын
Thank you for your comment. If the dimensions of the input and the output mismatch, you can simply define the parameters vector P as a single row vector, then you arrange your measurements in this vector in whichever way that's most convenient to you. Just keep in mind that you need to propagate any changes in the rest of the code.
@ernestoestremera5014
@ernestoestremera5014 2 жыл бұрын
@@MohamedWMehrez Thank you very much for your response, we look forward to more videos like this one. Regards
@lukicaist
@lukicaist 6 ай бұрын
Great lecture, really helped me to start with NMPC. How familiar should I be with the theory of optimization behind the solver if I am doing optimal control?
@MohamedWMehrez
@MohamedWMehrez 6 ай бұрын
Thank you for your comment. You really just want to understand how to formulate your optimization problem and the associated constraints. Knowing how the optimizer works is a big plus, too.
@김성헌-m3o
@김성헌-m3o Жыл бұрын
Hello dr. Mehrez, Thank you for the nice lecture. It helped me alot even though I'm very new to MPC and also Casadi. I have one question, how can we update the position of obstacle if we say obstacle is not static. I tried to update the position of obstacle in the main loop, however, it seems that solver doesnt realized the new position of obstacle has arrived and it only considers initial position of obstacle during the whole simluation time. best regards
@MohamedWMehrez
@MohamedWMehrez Жыл бұрын
Hi, Thank you for your comment. In the case of an obstacle whose position is dynamic, you will need to treat its position (or potentially position prediction) as a parameter that you pass to the optimizer and then you build your constraint based on this parameter. This is similar to passing the initial position of the robot to the optimizer every time step. Hope this helps!
@김성헌-m3o
@김성헌-m3o Жыл бұрын
@@MohamedWMehrez Thank you for fast reply and clear answer, also it worked! I made larger size of P vector and I added trajectory of moving obstacles as well as initial position of X and reference point Xs . But I'm considering of combining many obstacles and multiple robots (with collision avoidance). In this case, the size of P vector will be keep increasing and it will be confusing to put all the parameters in a single vector. so Im wondering if there is any solution for this. ( I tried to make parameter vector P as a struct but it didnt go well) thank you for your concern best regards
@amalchebbi6984
@amalchebbi6984 Жыл бұрын
Thank you Dr. Mohamed for the excellent presentation. I have a question please, in my problem the measurement_rhs is depending on time like X*t+B, X and B are states to be estimated and t is time (known/given vector), how can I introduce it in Casadi? I tried to put it as in input or a measurement and it was not working. I am tying to do state estimation only using MHE. Thank you
@MohamedWMehrez
@MohamedWMehrez Жыл бұрын
Hi, In the prediction, just replace t in the model by k*sampling time.
@anandjv9783
@anandjv9783 3 жыл бұрын
Hey Dr.Mohamed, Thanks for the lecture series. Its very helpful for beginners and well explained. I followed your lecture on MPC implementation and borrowed some techniques from your presentation for a simple trajectory planning algorithm in which I have 8 states and 2 control inputs, with the states themselves being my measurements too. Now I would like to go a step further to combine the MPC with the MHE. I have a couple of questions related to this. 1. In your lecture on MHE, you include the multiple shooting constraints alone with the MHE problem formulation. The objective function for control is missing. Should I need to add them just as in the MPC implementation, for trajectory reference tracking . 2. If I would like to combine the two , would there be two separate objective functions and would there be an OCP solving twice for each time step, one for MPC and another for MHE. 3. Could you also give a few hints on how I can use the MHE output to MPC. Thanks a lot again for your workshop!! Regards, Anand
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Hi Anand, thank you for your comment. 1- In the lecture I implemented MHE offline separately from the MPC implementation; that's why I used a single OCP with the multiple shooting constraints (because it was MHE only). 2- Yes, exactly. 3- Every time step, you simply get your sensor measurements feed them into the MHE estimator (first OCP); the output of the estimator then becomes the MPC feedback (second OCP). All the best!
@anandjv9783
@anandjv9783 3 жыл бұрын
Thanks a lot for the quick response!
@wushuruwan1
@wushuruwan1 3 жыл бұрын
Dr. Mehrez, I immensely appreciate your insightful video lectures on these subjects. Can you please recommend a couple of good sources that explain Distributed MPC in a simpler manner? Thank you very much.
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Hi Ruwan, thank you for your comment. This paper is a good starting point for DMPC, just focus on the algorithm link.springer.com/chapter/10.1007/978-1-4471-2265-4_12
@wushuruwan1
@wushuruwan1 3 жыл бұрын
@@MohamedWMehrez Thank you very much for your generosity.
@dter706
@dter706 6 ай бұрын
Great video and impressive results with the distributed MPC! I have a question though, how much more difficult is it to use rectangular collision constraints around the obstacle instead of circular ones?
@dter706
@dter706 6 ай бұрын
I have a rectangular car that i want to drive around another rectangular object, what i tried to do was do a projection of all corner points on the y-axis since my car can not drive directly sideways and the smallest corner point of the obstacle should always be bigger than the biggest corner point of my car to avoid collision. Yet I tried using CasADi's mmin and mmax function but then the solver also runs extremely slow, and the car might never reach the target position.
@ivanbralic6242
@ivanbralic6242 4 жыл бұрын
dr. Mehrez, thank you for this presentation, it's a valuable material for learning. I have a question regarding MHE. I see you did not explicitly include arrival cost in your problem formulation which would be equivalent to saying that state at the timestep t-N of horizon is uniformly distributed. Usually, one can do better by including arrival cost with weighting matrix which is inverse of covariance matrix that's propagated by EKF, UKF or basically any kind of covariance propagation strategy for nonlinear systems. I'm curious why you didn't include arrival cost and what can one say about stability of estimator without explicit inclusion of arrival cost.
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
Hi Ivan, thank you for your comment. You're observation is completely true. For sure we can use an arrival cost to improve the estimate. I just wanted to show the basic idea of MHE similar to what I did in MPC in which I didn't use a terminal cost.
@huamax3825
@huamax3825 10 ай бұрын
Hi Ivan and Dr. Mehrez, sorry for disturbing you :). Would you mind recommending some good or basic papers illustrating the "arrival cost" concept to me? I am a beginner at MHE and get confused when reading papers about the "arrival cost". Thank you :)
@devyanivarshney1100
@devyanivarshney1100 5 жыл бұрын
Hello, Thank you for such a great workshop! Although I am a bit confused regarding the MHE formulation used to solve the problem. Can you give reference to how exactly this formulation has come in form? Is it purely based on least square sense or formulated through probabilistic settings?
@MohamedWMehrez
@MohamedWMehrez 5 жыл бұрын
Thank you! Glad that it was useful. Here is a great book on MPC and MHE; check the state estimation chapter (Chapter 4) in the book to look at a detailed formulation of MHE engineering.ucsb.edu/~jbraw/mpc/ Yes, MHE is based on least square formulation; nonetheless, if the process noise is Gaussian, tuning the MHE weighting matrices becomes easier as shown in the workshop.
@devyanivarshney1100
@devyanivarshney1100 5 жыл бұрын
Thank you for the reply again. However isn't arrival cost missing in the formulation ?
@MohamedWMehrez
@MohamedWMehrez 5 жыл бұрын
@@devyanivarshney1100 indeed you can add an arrival cost to the MHE formulation. It is similar to the terminal cost in MPC. However, I haven't used any in the workshop to make the presentation simpler on one hand and because MPC without terminal costs can guarantee closed loop stability when some conditions are satisfied. If you would like to learn more about that, here is one of the studies I did on MPC stability without terminal costs or constraints. ieeexplore.ieee.org/abstract/document/7312445/ Here is also a study I did one MHE where I Incorporated the arrival cost in the formulation link.springer.com/article/10.1007/s10846-016-0408-2
@devyanivarshney1100
@devyanivarshney1100 5 жыл бұрын
@@MohamedWMehrez Thank you again :)
@ritikaghosh3862
@ritikaghosh3862 11 ай бұрын
Hi, thank you for the videos, they are very helpful. Can we use MHE to update the system model that is used my the MPC ?
@MohamedWMehrez
@MohamedWMehrez 11 ай бұрын
Thank you for your comment. Sure you can do that.
@franciscogarcia9441
@franciscogarcia9441 Жыл бұрын
Hi, many thanks for your videos. Regarding N_MHE, the actual size of the optimization window is N_MHE + 1? As far as I understood, your sum has one extra step compared with for example Rao, C. V., & Rawlings, J. B. (2002). Constrained process monitoring: Moving‐horizon approach.
@Maverik800
@Maverik800 3 жыл бұрын
Hi, very nice videos! Help me a lot to understand the use of mpc and casadi for my work. I have only one question about the method: what changes in the algorithm if I want to implement the Direct Collocation method? Did you made another video for that or any example where I can take a look on? Thaks a lot for your answer!
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Thank you for your comment. There are examples on the collocation method on casadi website. Just go to the install page and download the examples package.
@SbAlmagro
@SbAlmagro 4 жыл бұрын
Dear Dr Mehrez, regarding speeding up the solver: 1) What is the recommended method for exporting the c code when the main program is working on python? Generate C code or C++ code? Then I should call again the generated code of the solver on python? 2) Is this a non-linear MPC? The code given could be adapted to a linearised model? or exist a method in Casadi to internally linearise the model? 3) Which other methods could I use for speeding up the MPC? Thank you very much for your guide.
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
Hi Sebastian, 1) I tried c-code generation using matlab on windows and I was calling the compiled c-code (.mex) from my matlab code. I guess this could be the case for Python, but I haven't tried it myself. I am also not sure about c++ code generation. Please refer to the website and the manual. 2) Yes, it is an NMPC. I personally prefer to use MPC whether the model is linear or nonlinear because the idea is exactly the same. Of course the code can be used for linear systems. Just remember that Ax+Bu is just a special case of f(x,u). 3) I guess code generation is your best method to speed things up. You can also make a pure c++ implementation. the c++ API is provided on Casadi website (not well documented unfortunately). You're welcome!
@heripurnawan5770
@heripurnawan5770 3 жыл бұрын
Dear Dr Mehrez. Thank you very much for your great presentation. If I want to combine MHE and MPC together in my simulation, I have a question related to past measurements over a window of size N_MHE (k-N_MHE). How can I obtain past measurements, so I can obtain estimated states for the feedback in MPC? Thank you.
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Thank you for your comment; to do this, you actually have to run your system in the open loop and buffer the measurements until you fill the 1st window of measurements on which you run the first MHE step.
@keeganmoraes9905
@keeganmoraes9905 2 жыл бұрын
I have a doubt regarding MHE if it estimates the path at t- N(MHE) how does it help in estimation of the path for MPC if it has already move through that path?
@MohamedWMehrez
@MohamedWMehrez 2 жыл бұрын
What i did in this lecture is what you may call offline estimation, i.e. i generated the sensor data and estimated the path from it. If you would like to integrate MHE and MPC, you would run MHE online, i.e. you apply it to the most recent window of measurement (as what happened in this lecture), but the estimated pose on the path is used as a feedback to the MPC controller.
@huamax3825
@huamax3825 10 ай бұрын
Those are really great slides especially the detailed presentation helps me a lot to understand
@shaguftaqueen5630
@shaguftaqueen5630 3 жыл бұрын
Hi Mohamed, Thank you very much for building my intuition on MPC, I'm very new to vehicle dynamics and control engineering, i have one general question, If we would like to take the kinematic bicycle model for the non-holonomic robot instead of differential drive robot , for example with state vector: {x, y, v, phi} and controls : {a , delta}, how would the RHS/ (model) in the code change, if you could share some thoughts on this it would be wonderful, :) Thanks and regards, Shagufta,
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Hi, thank you for your comment. You simply change the model. this means you would have a new state vector with 4 variables in this case and the r.h.s. would be what ever your new model is.
@shaguftaqueen5630
@shaguftaqueen5630 3 жыл бұрын
@@MohamedWMehrez Thank you very much Prof, i really appreciate your prompt reply, i just have one more question, can we add terminal cost function to this OCP? if yes, how do i go about it?
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Yes, you can... Just after the loop where you create obj, you can add an additional term for the terminal cost.
@shaguftaqueen5630
@shaguftaqueen5630 3 жыл бұрын
@@MohamedWMehrez i was about to lose my sleep tonight, i can't thank you enough, world needs ppl like you
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Thank you Shagufta 🌹
@dounia4146
@dounia4146 4 жыл бұрын
Hi Mohammed, Thank you very much for this video, May I ask you a question? If I have more than 2 measurements ( 3,...,9) and four controls, how P ( parameters in casadi) should be ( I mean the number of rows)? Best regards, Dounia.
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
Hi Dou, thank you for your comment. You can choose the number of rows as the maximum number between the states and controls. For example, if you have 4 states and 2 controls, you can choose the number of rows as 4. Then, for the part of the P matrix that corresponds to the states you will use all the rows and for the controls you will use only the first 2 rows. In your initialization for P you can then initialize the remaining rows in P that corresponds to controls by any dummy value, e.g. zeros. All the best!
@dounia4146
@dounia4146 4 жыл бұрын
@@MohamedWMehrez Thank you for your fast reply, I initialized P as a vector of one row (P = SX.sym('P', (N_MHE+1)*n_measurements + N_MHE*n_controls)); and it works fine. Thank you, Best regards, Dounia.
@hughwong1483
@hughwong1483 7 ай бұрын
I am interested in your great job about mhe and Mpc , but I major in drone. So would you mind sharing some information about the measurement model about quadcopter to make estimate the state, thank a lot,appreciate it.
@kaiscott8345
@kaiscott8345 Жыл бұрын
It seem like the code we panalize the cost funtion : u_tilde = P(:,N_MHE+ k); is worng? I think it would be : u_tilde = P(:,N_MHE+1+ k); Because if not, it will overwrite the fist panalize part : y_tilde = P(:,k),which k is 1~N_MHE+1 when we are trying to formulate the second panalize part. I mean : P(:,N_MHE+ 1) this term would be worng formulated.
@SagarVirk1996
@SagarVirk1996 3 жыл бұрын
Hey Dr. Mendez I was having trouble implementing the input rate of change constraint. As we never specify initial input, my rate of change of input always start with u2-u1 rather then u1-0
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
You can do that and in the following iteration you use the most recent input sent to the system. Always remember that the first input change rate is the difference between u1 and the most recent input applied.
@Gu1TaMastaJ
@Gu1TaMastaJ 5 жыл бұрын
Great talk! I am thinking of implementing a similar MPC+MHE combo for one of my projects. Out of curiosity, do you know if it is possible to somehow upload the MATLAB code with the solvers and Casadi packages onto a microcontroller? Or would the code have to be rewritten in C/C++?
@MohamedWMehrez
@MohamedWMehrez 5 жыл бұрын
for embedded implementation, you may consider acados. Check the details here github.com/acados/acados
@Gu1TaMastaJ
@Gu1TaMastaJ 5 жыл бұрын
@@MohamedWMehrez Hi again, I'm having some trouble implementing the acado libraries with my project. I want to the define the initial conditions for the OCP at time step using my sensor values as inputs. What would be the easiest way to go about this? Thanks.
@MohamedWMehrez
@MohamedWMehrez 5 жыл бұрын
Hi Josh, actually I haven't used acados before, so I am afraid I can't give you a proper advice here.
@osamahallom410
@osamahallom410 3 жыл бұрын
Salam Aleikum Mohamed, This is what i was looking for past 10 days in many research papers, you made it look so simple, i just loved it what if i need to consider the obstacles which are moving with time, how do i change the x and y position of obstacle in your code?, looking forward to hearing from you soon, best, Osama
@osamahallom410
@osamahallom410 3 жыл бұрын
Hello Professor, i derived a constant velocity model as (X_pred = X_current + DT * vel ) if i need to use this information in the MPC prediction horizon i should recursively keep updating the x and y position of obstacle in the for loop? please let me know if my understanding is right :) Code : for k = 1:N+1 g = [g ; -sqrt((X(1,k)-obs_x1)^2+(X(2,k)-obs_y1)^2) + (rob_diam/2 + obs_diam/2)]; obs_x1 = obs_x1 + T*obs_vel; obs_history(:,k) = obs_x1; end Regards, Osama
@MohamedWMehrez
@MohamedWMehrez 2 жыл бұрын
Thank you Osama for your comment. The way you are adding a dynamic obstacle seems correct to me. All the best!
@welidbenchouche
@welidbenchouche 4 жыл бұрын
Great workshop, thank you for sharing it, however, i have a hard time adding another obstacle, can you tell me where should i edit the code to accomplish this?
@welidbenchouche
@welidbenchouche 4 жыл бұрын
nevermind, i got it, i was missing the ubg and lbg size, i had to multiply it by 2, now i just need to edit the draw function to visualize it. i will try my best to do it,
@welidbenchouche
@welidbenchouche 4 жыл бұрын
got it, i just had to add the second obstacle to the draw function arguments and loop
@joyride6062
@joyride6062 3 жыл бұрын
@@welidbenchouche hey I am trying to do the same thing. Where did you multiply the size by 2, is it in the Sim_3_MPC_Robot_PS_obs_avoid_mul_sh.m file ?
@Toyotaman
@Toyotaman Жыл бұрын
Hi! I know how to add the second obstacle, however, I have a hard time adding the upper and lower bounds of the second obstacle in the args structure. could you please let me know how did you index it? thank you!
@faraivudzijena1825
@faraivudzijena1825 4 жыл бұрын
Hi Dr Mohamed. Thanks for the fantastic lecture and source code. Im using MHE to predict the state of charge of a battery and have an issue that I hope you can help with. I only wish to estimate the 3 states in my system of which I have the governing equations and the state transformation function "h" to obtain the predicted output that will be used to populate the objective function (y_tilde -h_x) over the prediction horizon. I have two problems. (1) My "h" function uses function inputs of (state and controls) to calculate the measurement_rhs. This affects the length of the for loop (y_tilde -h_x) and forces it to be k=1:NMHE and not k=1:NMHE+1 as you have in your code. If I use the loop length k=1:NMHE, I get a mismatch error when plotting my X_estimate vs time (t) as the length of time is 1 time step longer than the length of the matrix X_estimate. Any tips on how to How do I fix this ? Should I use the multiple shooting equality constraints "g" approach where the function "f" uses both the states and controls to calculate the f.value of state next ? (2) Can I still implement MHE using this code to obtain the only state estimates and not the estimates of the control inputs to the system i.e omitting (u_tilde - u) ? What should I be mindful of when implementing this ? Thanks in advance
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
Thanks Farai, here is my answer to your questions (1) This is a dimensions problem which you can fix by simply extending the time vector by one more time step or reduce the estimation vector by one estimate. (2) Of course you can. Just make sure that you have all the available data that will allow you to predict your output, i.e. h(x). All the best, Mohamed
@niravpatel2084
@niravpatel2084 4 жыл бұрын
Hi Mohamed, thank you for the video. I can understand the 3DOF problem which you have explained in the video. But, i have the project in which i have to implement the 6DOF nonlinear MPC controller for the floating cylindrical shape of underwater marine craft. so, how can i relate the problem you have explained to the 6DOF?
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
Just change the dynamics model to your 6 dof model.
@rhofranehassani9669
@rhofranehassani9669 3 жыл бұрын
Hi Dr.Mehrez, we have a project on multi-robot path-following with obstacle avoidance system, we've been asked to work with MPC and i wonder if you can give us an idea how to manipulate your code in order to use it for multi-agent system or if it's even possible. Thank you in advance.
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Hi, there are basically two approaches to apply MPC for multiple robots. First, a centralized approach where you combine all the vehicles models into one and add the proper constraints among them to address collision avoidance, etc. I this case you will need to run a single mpc instance which will generate the proper control action for all robots. Second, the distributed approach where you run MPC for each of the robots and communicate there future predictions and then add them to the constraints. You can find more details about the two approaches in the following papers. Just keep in mind that a centralized approach is suitable for smaller number of robots while the distributed one is suitable for a larger number of robots. (Centralized has a better performance, but again may not be feasible for a large number of robots) link.springer.com/article/10.1007%2Fs10846-016-0408-2 ieeexplore.ieee.org/abstract/document/8206360/ ieeexplore.ieee.org/abstract/document/6901011
@rhofranehassani9669
@rhofranehassani9669 3 жыл бұрын
@@MohamedWMehrez Thank you so much Sir for your response
@basimdahroug6950
@basimdahroug6950 4 жыл бұрын
Dr. Mehrez, a great thanks for that help. I wanted to ask you how can i estimate an angle from angular velocity using MHE. My measurements will be from an IMU sensor, and the control input it the angular velocity. If i do a direct integration thier will be a drift due to the accomulated noise. so i want to fuse both measurements for good estimation.
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
Hi Basim, thank you for your comment. IMU measurement will always be subject to drift. You will need to incorporate another sensor to substitute for that drift, for example a GPS or a Lidar.
@basimdahroug6950
@basimdahroug6950 4 жыл бұрын
Yes thats already what’s happening, is it possible to rely on the accelerometer to be the measurement ? One more question is how to get the values of the covariance matrix and the measurement matrix ( the mean values ) .. Thanks for your reply and your help
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
The accelerometer is not enough, because again it will be subject to a drift. This is not the state estimator problem. The estimation covariance matrix can be obtained using the method presented in this paper: Constrained State Estimstion gor Nonlinear Discrete-Time Systems: Stability and Moving Horizon Approximations
@nasatech86
@nasatech86 4 жыл бұрын
Hello, Thank you for the great workshop. Can I ask how one can add a rectangle object to the point stabilisation problem as a Path Constraint for obstacle avoidance?
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
Hi, thank you for your comment. Yes you can do that by using for example a higher order L-norm.
@nasatech86
@nasatech86 4 жыл бұрын
@@MohamedWMehrez Thank you for your prompt reply. I will look into this.
@SbAlmagro
@SbAlmagro 3 жыл бұрын
@@MohamedWMehrez Dear Dr. Mehrez, do you mind clarifying the "high order L-norm"? Higher than L2? How an area can be defined? Than you very much.
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
@@SbAlmagro Hi, defining higher L-norms should be the same as defining L2-norm. you simply change the power.
@krishnasatish3468
@krishnasatish3468 3 жыл бұрын
What happens when we have dynamic obstacles instead of static obstacles, is there a way to incorporate the moving obstacles in MPC ? Thanks in advance,
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Hi, Of course there is a way for that. you simply add the constraints such that the prediction of the robot avoid the prediction of the obstacle at the respective time steps.
@rihabbouafia1786
@rihabbouafia1786 5 жыл бұрын
Hi, Mohamed W. Mehrez , I have tried to implement your code but it always appears the error of ( "Undefined function or variable 'shift'. Error in exemple1 (line 124) [t0, x0, u0] = shift(T, t0, x0, u,f); % get the initialization of the next optimization step" ) Do you know how to fix it? thx
@MohamedWMehrez
@MohamedWMehrez 5 жыл бұрын
This function is already provided in the workshop code; the code is referenced in the video description.
@rihabbouafia1786
@rihabbouafia1786 5 жыл бұрын
Yes I realized after I asked you. Thank you very much
@SuperSuperhugh
@SuperSuperhugh 4 жыл бұрын
Hi. MHE is used to estimate the state, but it will fail to estimate the theta angle when the linear speed is zero. The question is how can I overcome this in robot control practice. Thank you.
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
It's not the MHE problem. It's the question of observability given the measurement and motion model. You may fix the problem by using a sensor that measures the orientation directly, e.g. a compass.
@SuperSuperhugh
@SuperSuperhugh 4 жыл бұрын
@@MohamedWMehrez Thank you. You work is so great.
@MohamedWMehrez
@MohamedWMehrez 4 жыл бұрын
You're welcome! You can cite any of my related work here scholar.google.com/citations?user=aRNeH4QAAAAJ&hl=en
@keeganmoraes9905
@keeganmoraes9905 2 жыл бұрын
I also tried to add a road set up for which i tried to add constraints and also had to add if conditions. However sx cannot be converted to logical and the if statement also returns the data type in sx, is there any way to convert sx to an integer?
@MohamedWMehrez
@MohamedWMehrez 2 жыл бұрын
I think there is something about this in Casadi manual.
@shanshanbond7040
@shanshanbond7040 6 ай бұрын
legendary
@muhammadadeel1150
@muhammadadeel1150 4 жыл бұрын
Could you please describe about "h"
@fetullahatas3927
@fetullahatas3927 3 жыл бұрын
can we set dynamic obstacle as constrains and if yes how
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
Yes you can. If you have the prediction of the dynamic obstacles motion then you simply constraint the motion of the robot by the motion of the obstacles. This means that for every time step in robot's prediction you constraint it to be outside the obstacle boundaries at the corresponding time step from the obstacle predicted motion.
@fetullahatas3927
@fetullahatas3927 3 жыл бұрын
@@MohamedWMehrez But f I add a new constrain at each time step, would not all of that constraints pile up and making the system too heavy ?
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
@@fetullahatas3927 it will be a little harder to solve than the static obstacle case discussed in the workshop, but will be still feasible in a reasonable amount of time. Remember that in the static obstacle case, we constrained the robot at all the prediction steps but to a static boundary (i.e. the static obstacle).
@fetullahatas3927
@fetullahatas3927 3 жыл бұрын
@@MohamedWMehrez Thank you for your reply. I think if there is a online way to update/remove/add the constraints added to optimization problem it can be solved. Are you aware that it is possible to update/remove the constraints from the problem on the fly ?
@MohamedWMehrez
@MohamedWMehrez 3 жыл бұрын
@@fetullahatas3927 of course this is possible and it can be done similar to the trajectory tracking case discussed in the workshop; therein, the reference was updated online ever time step.
MPC and MHE implementation in Matlab using Casadi | Part 1
1:43:40
Mohamed W. Mehrez
Рет қаралды 65 М.
Part 3 | MPC for trajectory tracking
20:52
Mohamed W. Mehrez
Рет қаралды 22 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 109 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 33 МЛН
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 17 МЛН
Nonlinear MPC tutorial with CasADi 3.5
19:07
Joris Gillis
Рет қаралды 20 М.
Part 1 (Cont'd) | MPC Model Simulation using  Runge Kutta Method
12:52
Mohamed W. Mehrez
Рет қаралды 8 М.
Data-driven MPC: From linear to nonlinear systems with guarantees
1:06:28
MPC from Basics to Learning-based Design (1/2)
58:26
Alberto Bemporad
Рет қаралды 27 М.
Alberto Bemporad | Embedded Model Predictive Control
58:33
Michigan Engineering
Рет қаралды 44 М.
Model Predictive Control - Part 1: Introduction to MPC (Lasse Peters)
42:18
Model Predictive Control in MATLAB and Excel
18:46
APMonitor.com
Рет қаралды 45 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 109 МЛН