I want to do some trajectory tracking on a real robot, and I want to use MPC, so I found this gekko. I can make to simulations of my robot and stuff, but is it possible to use it real-time, as I see it take some time to calculate the optimal solution, and I am not quite sure coding wise how to do it, if you just take the first imput and give it to the real system and then update the state values with the sensor reading, and then use the m.solve() function again, and so on.
Thanks in advance
Yes, Gekko is certainly possible to do real-time control but you'll need to pay attention to a few things:
remote=True
), set up your own local server in Windows or Linux (remote=True server='http://10.0.0.10'
), or else solve locally on the embedded hardware (remote=False
). You set the remote
and server
when you create the gekko object (m=GEKKO(remote=False)
).There is a lot of real-time MPC code and an application with the Temperature Control Lab (TCLab) on the course for Machine Learning and Dynamic Optimization. Below is MPC in action.
Here is the device: