torcs - 1.2.2

Track related tools for robots.
[Tools for robots.]


Detailed Description

All the accesses to the track structure, car position...


Functions

tdble RtTrackGetWidth (tTrackSeg *seg, tdble toStart)
 Get the track width at the specified point.

void RtTrackLocal2Global (tTrkLocPos *p, tdble *X, tdble *Y, int flag)
 Convert a Local position (segment, toRight, toStart).

void RtTrackGlobal2Local (tTrackSeg *segment, tdble X, tdble Y, tTrkLocPos *p, int type)
 Convert a Global (segment, X, Y) position into a Local one (segment, toRight, toStart).

tdble RtTrackHeightL (tTrkLocPos *p)
 Returns the absolute height in meters of the road at the Local position p.

tdble RtTrackHeightG (tTrackSeg *seg, tdble X, tdble Y)
 Returns the absolute height in meters of the road at the Global position (segment, X, Y).

void RtTrackSideNormalG (tTrackSeg *seg, tdble X, tdble Y, int side, t3Dd *norm)
 Give the normal vector of the border of the track including the sides.

tdble RtTrackSideTgAngleL (tTrkLocPos *p)
 Used to get the tangent angle for a track position The angle is given in radian.

void RtTrackSurfaceNormalL (tTrkLocPos *p, t3Dd *norm)
 Used to get the normal vector of the road (pointing upward).

tdble RtGetDistFromStart (tCarElt *car)
 Get the distance from the start lane.

tdble RtGetDistFromStart2 (tTrkLocPos *p)
 Get the distance from the start lane.

int RtDistToPit (struct CarElt *car, tTrack *track, tdble *dL, tdble *dW)
 Get the distance to the pit stop.


Function Documentation

int RtDistToPit struct CarElt car,
tTrack track,
tdble dL,
tdble dW
 

Get the distance to the pit stop.

Parameters:
car The concerned car.
track The current Track
dL Length to the pits
dW Width to the pits
Returns:
0
Note:
dW > 0 if the pit is on the right

Here is the call graph for this function:

tdble RtGetDistFromStart tCarElt car  ) 
 

Get the distance from the start lane.

Parameters:
car the concerned car.
Returns:
The distance between the start lane and the car.

tdble RtGetDistFromStart2 tTrkLocPos p  ) 
 

Get the distance from the start lane.

Parameters:
p Local position
Returns:
The distance between the start lane and the car.

tdble RtTrackGetWidth tTrackSeg seg,
tdble  toStart
 

Get the track width at the specified point.

Parameters:
seg Segment
toStart Distance from the beginning of the segment.
The units are:
  • meters for straights
  • radians for turns
Returns:
Width of the track at this point.
Note:
The Pit lane and the track have different width, and the side segments have variable width.

void RtTrackGlobal2Local tTrackSeg segment,
tdble  X,
tdble  Y,
tTrkLocPos p,
int  type
 

Convert a Global (segment, X, Y) position into a Local one (segment, toRight, toStart).

The segment in the Global position is used to start the search of a good segment in term of toStart value. The segments are scanned in order to find a toStart value between 0 and the length of the segment for straights or the arc of the curve. The sides parameters is to indicate wether to use the track sides (1) or not (0) in the toRight computation.

Parameters:
segment Current segment
X Current X position
Y Current Y position
p Returned local position
type Type of local position desired:
  • TR_LPOS_MAIN relative to the main segment
  • TR_LPOS_SEGMENT if the point is on a side, relative to this side
  • TR_LPOS_TRACK local pos includes all the track width

Here is the call graph for this function:

tdble RtTrackHeightG tTrackSeg seg,
tdble  X,
tdble  Y
 

Returns the absolute height in meters of the road at the Global position (segment, X, Y).

Parameters:
seg Segment
X Global X position
Y Global Y position
Returns:
Height in meters

Here is the call graph for this function:

tdble RtTrackHeightL tTrkLocPos p  ) 
 

Returns the absolute height in meters of the road at the Local position p.

If the point lies outside the track (and sides) the height is computed using the tangent to the banking of the segment (or side).

|                + Point given
|               .^
|              . |
|             .  |
|            .   |
|           /    | heigth
|          /     |
|   ______/      v
|   ^    ^^  ^
|   |    ||  |
|    track side
    
Parameters:
p Local position
Returns:
Height in meters

Here is the call graph for this function:

void RtTrackLocal2Global tTrkLocPos p,
tdble X,
tdble Y,
int  flag
 

Convert a Local position (segment, toRight, toStart).

into a Global one (X, Y) The ToStart position refers to the current segment, the function will not search for next segment if toStart is greater than the segment length. toStart represent an angle in radian for curves and a length in meters for straights.

Parameters:
p Local position
X returned X position
Y returned Y position
flag Local position use:
  • TR_TOMIDDLE the toMiddle field is used
  • TR_TORIGHT the toRight field is used
  • TR_TOLEFT the toLeft field is used

void RtTrackSideNormalG tTrackSeg seg,
tdble  X,
tdble  Y,
int  side,
t3Dd norm
 

Give the normal vector of the border of the track including the sides.

The side parameter is used to indicate the right (TR_RGT) of the left (TR_LFT) side to consider. The Global position given (segment, X, Y) is used to project the point on the border, it is not necessary to give a point directly on the border itself. The vector is normalized.

Parameters:
seg Current segment
X Global X position
Y Global Y position
side Side where the normal is wanted
  • TR_LFT for left side
  • TR_RGT for right side
norm Returned normalized side normal vector
Todo:
RtTrackSideNormalG: Give the correct normal for variable width sides.

tdble RtTrackSideTgAngleL tTrkLocPos p  ) 
 

Used to get the tangent angle for a track position The angle is given in radian.

the angle 0 is parallel to the first segment start.

Parameters:
p Local position
Returns:
Tagent angle in radian.
Note:
For side segment, the track side is used for the tangent.

void RtTrackSurfaceNormalL tTrkLocPos p,
t3Dd norm
 

Used to get the normal vector of the road (pointing upward).

Local coordinates are used to locate the point where to get the road normal vector. The vector is normalized.

Parameters:
p Local position
norm Returned normalized road normal vector

Here is the call graph for this function:


Generated at Thu Feb 26 21:54:19 2004 for torcs by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-1999
TORCS © Eric Espié 1999, 2002.