Great to have some one working on AI again! I'll try to answer your questions as best I can.
vicovermeer Wrote:What coordinates are you using and in what format are the tracks described?
According to Joe, there are a number of coordinate systems used in vdrift. I have mainly dealt with 2 of them when developing the AI driver. The 1st one is used by vamos. The positions in this coordinate system is represented by class Vamos_Geometry::Three_Vector (defined in include/vamos/geometry/Three_Vector.h). The other is used by vdrift track. Positions are represented by class VERTEX (defined in include/3dmath.h). To transform between these 2 coordinate systems, use the following (assumeing v1 is a Three_Vector object, v2 is a VERTEX object),
v1[0] = v2.x;
v1[2] = v2.y;
v1[1] = -v2.z;
Vdrift track is defined in include/track.h. Each track contains a number of roads. Each road contains a sequence of Bezier patch. Bezier patch is the basic component of the track. Track data is defined in data/tracks/<track>/roads.trk. Following is the format of this file,
<number_of_roads>
<number_of_Bezier_patches_for_the_1st_road>
Control point coordinates of Bezier patch 1 (total 16 points)
Control point coordinates of Bezier patch 2 (total 16 points)
.
.
.
.
<number_of_Bezier_patches_for_the_2nd_road>
Control point coordinates of Bezier patch 1 (total 16 points)
Control point coordinates of Bezier patch 2 (total 16 points)
.
.
.
.
and so on
vicovermeer Wrote:In what files (functions) do we find the physical ODE model? Is a description (paper or thesis) available?
If I'm not wrong, Vdrift uses Bullet now instead of ODE. Joe probably can answer this question better.
vicovermeer Wrote: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?
The cars in vdrift are represented by a Vamos_Body::Car object. As long as you have a reference/pointer to this object, you can get all the realtime info such as position, velocity, angles, etc, as well as setting the control inputs. For example, assuming you have a pointer *car points to your AI controled car, call car->chassis().cm_velocity() to get the velocity vector. Calling car->chassis().position() will get the position vector. Similarly, calling car->brake(brake_value, 0.0) and car->gas(gas_value, 0.0) to set the brake and gas input respectively.
Hope I'm making sense with the above. Let me know if you need more info. I'm sure Joe or thelusiv can also give some input if you need more help.