Coupling optimal control software to VDrift
Hi there!
Let me start by describing who we are and what we want to do, before I actually pose my questions...
We are mathematicians from the University of Heidelberg, Germany. We are interested in optimal control algorithms, and in particular in discrete decisions, such as gear choices. So far we optimized the driving on an elliptic track and visualized the results with Povray.
Right now we are thinking about a coupling between the state-of-the-art optimization algorithms we develop and an open source race simulator such as VDrift. If this works one might compare the different AI robots VDrift already has with a provably optimal solution. And we would have a brilliant way to visualize the results of our optimization algorithms.
Well, there are several things we want to do on the long run.
1. The first step will be to adapt the physical model we currently use to the one in VDrift / vamos. And to select a specific track, use an appropriate coordinate system for it and calculate (in our software) an offline solution. Offline means that there is no feedback from the system (= VDrift). This calculated solution would then be used for a simulation inside VDrift (will probably crash in the first curve because of a slight model mismatch or different integration...).
2. In a next step we might try to get more robust solutions, taking a certain model mismatch into account from a mathematical point of view. This would lead to a slightly less performant, but eventually working driving behavior.
3. The next step would be to include feedback information from VDrift (we call that Nonlinear Model Predictive Control). Here we would have two integrators run at the same time, on one hand Muscod which is using information obtained from VDrift (current position, velocity, ...) to calculate FASTLY a new optimal control. And on the other side VDrift which runs just as usual, but provides feedback information every 4 (or 20 or whatever) msecs and gets a new control input.
We typically apply this procedure to real-world systems (like a distillation column, car engines, harvesters, you name it). Here we would simply consider VDrift to be the real world and our ODE model of an inprecise mathematical model for it.
Well, this is the basic idea. So what do we need (besides understanding the physics and coordinates you use)? Well, in the first two steps simply a way to alter the controls (and also to obtain the trajectory in a written file or something for a posteriori analysis).
For the third step, which is still a little bit ahead so we shouldnt worry too much about it now, we will need a communication between two programs running at the same time (NMPC optimizer and VDrift). We thought about using pipes for this. The data is the same as before, controls in, trajectory data out.
The main points to start with are (and here are finally my questions):
What coordinates are you using and in what format are the tracks described?
In what files (functions) do we find the physical ODE model? Is a description (paper or thesis) available?
Is there already an interface function to set/get controls and to get the output of your integrator? Or: in what files / module / class should we integrate it?
- Where in the code do we have for interfaces we might
use? We want out (if possible in realtime)
* position
* velocity
* relevant angles
* ...
and would like to put in something like
* gear
* acceleration
* brakes
* steering angle
that would be given to the vamos engine. Do such interfaces exist? How much work would it be (for us) to include them?
I would be very grateful if someone (rookie1?) might help us out with these basic questions. I estimate that VDrift might also profit very much from this: although Muscod is a proprietory software of the University of Heidelberg and can thus not be included in VDrift, we hopefully get some nice results analyzing existing algorithms and enhancing them. Plus that the created interfaces will then also work for other (possibly open source) external optimization codes. And VDrift could get a lot of free advertisement, as well.
Thanks a lot, best regards,
Sebastian Sager
|