A Modular Parametric Architecture for the TORCS Racing

  • Slides: 24
Download presentation
A Modular Parametric Architecture for the TORCS Racing Engine E. Onieva, D. A. Pelta,

A Modular Parametric Architecture for the TORCS Racing Engine E. Onieva, D. A. Pelta, J. Alonso, V. Milanés, J. Pérez Presented by Volkinshtein Galina

Introduction q The authors present their approach to TORCS Car Racing Competition 2009 that

Introduction q The authors present their approach to TORCS Car Racing Competition 2009 that is based on a complete modular architecture capable of driving automatically a car along a track with or without opponents. q The goal: 1. to design, implement and test a complete architecture enabling automatic driving in racing situations. 2. to better understand how to construct efficient and simple to understand controllers for car bots. 9/16/2020

Control architecture Five basic modules: n n n Gear control Low level throttle and

Control architecture Five basic modules: n n n Gear control Low level throttle and brake control to keep or reach certain target speed Target speed determination (TSK fuzzy controller infers the target speed value by means of a reduced set of simple fuzzy rules) Steering wheel control Opponents modifier (analyzes the opponents’ positions and applies modifications over the steering, throttle and brake values in order to avoid collisions and overtake other drivers) Main idea: Small set of simple and interpretable modules whose interactions lead to a good driving 3 9/16/2020

The TORCS Simulator n n n Specifically devised to make it as easy as

The TORCS Simulator n n n Specifically devised to make it as easy as possible to develop your own controller Controllers are implemented as separated software modules, so you can develop a new controller and plug it into the game Competitors are provided with a specific software interface developed on a client/server basis where the designed controllers run as external programs and communicate with a customized version of TORCS through UDP connections. 9/16/2020

Sensors information: n n n n Surrounding environment Current game state e. g. Angle

Sensors information: n n n n Surrounding environment Current game state e. g. Angle between the car direction and the track axis Damage Distance from the start Distance covered from the beginning of the race Fuel Gear: -1 is reverse, 0 is neutral, and the gear from 1 to 6 etc. How it works: The controller obtains the sensors values from the server and then infer output commands to carry out the driving of the simulated car by means of the effectors of the car. 9/16/2020

Effectors: Represent what action the client bot can perform and , therefore, how it

Effectors: Represent what action the client bot can perform and , therefore, how it can affect the current game state. • • Accel, brake and steer effectors represent some control actions on the car. Meta is used to affect the status of the game and was introduced with the purpose of restarting the current race. 9/16/2020

Parameterized Control Architecture The basic architecture is composed by 5 modules. n The motivation

Parameterized Control Architecture The basic architecture is composed by 5 modules. n The motivation is to create simple controllers for each one of the modules of the architecture, looking for the best configuration possible. Modules functionalities: n 1) The Gear Control module is in charge of shifting between gears. 2) The Desired Speed Module assigns the allowed speed for a certain track segment. 3) The Low Level Gas & Brake Control Module is in charge of following the indications of the desired speed module. That is, to reach or keep a certain speed by means of the use of gas and brake pedals. 4) The Steering Wheel Control is in charge of controlling the car direction. 5) The Opponents Modifier Module works when opponents are present. It will apply changes over the steering, gas and brake values to adapt the driving in presence of other cars, trying to avoid collisions and overtake other opponents. 9/16/2020

Scheme of the Control Architecture This architecture allows us : n to change easily

Scheme of the Control Architecture This architecture allows us : n to change easily each module n to test the suitability of the interactions between all modules n to carry out the handling of the vehicle and measuring its performance based in two features: dist. Raced and damage It is important to note that modules 1 to 4 are enough to implement a car control able to drive alone in a track; the fifth module adds features to deal with opponents. 9/16/2020

Gear Control Rpm high -> increase gear n Rpm low -> decrease gear n

Gear Control Rpm high -> increase gear n Rpm low -> decrease gear n Stuck? n While (|angle| > π/6) increase Stuck counter n If Stuck =25 Reverse gear n Until(angle x track. Pos > 0) or n time (front > 10 and |angle| < π/2) n Then Reverse -> first gear 9/16/2020

Desired Speed Module calculates the Target n n n n Speed value at a

Desired Speed Module calculates the Target n n n n Speed value at a certain time step The controller is based on a computational model of a fuzzy coprocessor named ORBEX that implements fuzzy system with singleton shapes in output variables(singletons - consequents of fuzzy rules). Car is inside the track axis -> Track information -> Target Speed 3 of the 19 track sensors are used: Front: the front distance to the track axis. Max 10: maximum value between the track sensors at ± 10 degrees. Max 20: maximum value between the track sensors at ± 20 degrees. The inputs are codified with three trapezoidal membership functions - {Low, Medium, High}. 9/16/2020

Car is inside the track n 7 rules -> Target Speed R 1: Front

Car is inside the track n 7 rules -> Target Speed R 1: Front is High -> TS 1 n R 2: Front is Medium -> TS 2 n R 3: Front is Low and Max 10 is High -> TS 3 n R 4: Front is Low and Max 10 is Medium -> TS 4 n R 5: Front is Low and Max 10 is Low and Max 20 is High -> TS 5 n R 6: Front is Low and Max 10 is Low and Max 20 is Medium ->TS 6 n R 7: Front is Low and Max 10 is Low and Max 20 is Low -> TS 7 TSi = {200, 175, 150, 125, 100, 75, 50}, i = 1. . . 7 discrete value (singleton shape) associated as consequent of the ith rule. An exception to this fuzzy system Front = 100 -> Target. Speed = 300. n 9/16/2020

Outside -> use Track. Pos and Angle variables n Codifying: n Track. Pos <

Outside -> use Track. Pos and Angle variables n Codifying: n Track. Pos < − 1 = Left Track. Pos > 1 = Right Angle : {Left, Center, Right} n n n 5 additional rules -> Target Speed R 8: Angle is Center -> TS 8 n R 9: Angle is Left and Track. Pos is Left -> TS 9 n R 10: Angle is Left and Track. Pos is Right -> TS 10 n R 11: Angle is Right and Track. Pos is Left -> TS 10 n R 12: Angle is Right and Track. Pos is Right -> TS 9 TSi = {125, 100, 50}, i = 8, . . . , 10 n 9/16/2020

Low Level Gas & Brake Control n n n Returns single Accel. Brake signal

Low Level Gas & Brake Control n n n Returns single Accel. Brake signal : reverse gear -> Accel. Brake = ABreverse = 1 otherwise -> Accel. Brake = f (speed − Targetspeed) f (Diff) = 2 /(1 + e^Diff) AB AB ABS filter: Accel. Brake < 1 -> Brake signal -> Accel. Brake = Accel. Brake − (speed − speed if (speed − speed ) > 1. 5 wheels − 1. 5) / 5 wheels 9/16/2020

Low Level Steering Control - 3 cases n 1) Inside the track axis ,

Low Level Steering Control - 3 cases n 1) Inside the track axis , not in reverse gear: n 9 Track sensors from -40 to 40 degrees Output: weighted average from sensors’ values x correction factor Define: If T 0 = 100 then F 0 = 0. 2 else F 0 = 1 wt = t/20 , t = − 40, . . . , 40 weight of sensor value n n 2) Reverse gear: n F Reverse (angle) = −angle / steer lock 3) Outside of the track axis : F (angle, track. Pos) = (angle − track. Pos x 5. 0)/steer = 0. 785398 – full steering turn n outside. Straight lock 9/16/2020

Opponents Modifier Avoid collision -> modify gas and brake n Opponents sensors from-40 to

Opponents Modifier Avoid collision -> modify gas and brake n Opponents sensors from-40 to 40 degrees n Speed > 70 km/h & distance < min dist -> brake with const value = -0. 5 Brake if (Opponents±degrees < Tol brake±degrees ) is true for degrees = {40, 30, 10, 0} Overtake? -> modify steering § Opponents sensors from-100 to 100 degrees Increment steering of ±Incovertakedegrees if : (Opponents±degrees < Tolovertake±degrees) is true for degrees = {0 , . . . , 90 , 100} 9/16/2020

EXPERIMENTATION AND RESULTS n n Distance Raced vs. 2008 results TIME Tracks used to

EXPERIMENTATION AND RESULTS n n Distance Raced vs. 2008 results TIME Tracks used to evaluate the controller COMPARATIVE RESULTS IN DISTANCE RACED IN 200 S OF SIMULATED TIME Also tested with several opponents and got good results both in overtaking and avoiding collisions. 9/16/2020

First Full Race in the 2009 Simulated Car Racing Championship n Teams will be

First Full Race in the 2009 Simulated Car Racing Championship n Teams will be allowed to update their driver during championship, by submitting a different driver to each leg. n Competition : warm-up and actual race. n Warm-up: n Each driver will race alone for 10000 game tics, approximately 3 minutes and 20 seconds of actual game time. The eight drivers that will cover the more distance will qualify for the second stage. n n The second stage: n The eight drivers will race together. Each race consists of ten trials. The goal of each trial is to complete three laps from a randomly generated starting grid. n n 9/16/2020

Scoring n F 1 system: n 10 points to the first controller that completed

Scoring n F 1 system: n 10 points to the first controller that completed the three laps, 8 points to the second one, 6 to the third one, 5 to the fourth, 4 to the fifth one, 3 to the sixth, 2 to the seventh, and 1 to the eighth. The driver performing the fastest lap in the race will get two additional points. The driver completing the race with the smallest amount of damage will receive two extra points. Final score : median of the 10 scores. n n n 9/16/2020

Evaluation n main measure - distance raced important - the damage obtained. n Last

Evaluation n main measure - distance raced important - the damage obtained. n Last year’s competition rules: n Two stages : n n the distance raced in 200 s a tournament with several controllers in direct competence with unknown time n Consider: n Controller able to run a certain distance in 200 s with a certain total damage maybe not able to finish a longer race because the damage obtained in more race time reach the maximum and the car would be retired from the race(finishing in the last position). 9/16/2020

CEC on May 18 -21, 2009 n n n Including us, 6 racing teams

CEC on May 18 -21, 2009 n n n Including us, 6 racing teams participated. Champ. CIG 2008 - the champion of the previous edition at CIG. warm-up stage: three different unknown tracks. The developed controller (called Onieva & Pelta) classified in third, second and fourth position, respectively. 20 9/16/2020

The race Tracks : Michigan, Alpine 2 and Corkscrew n Onieva & Pelta obtained

The race Tracks : Michigan, Alpine 2 and Corkscrew n Onieva & Pelta obtained the second place. 9/16/2020

CONCLUSIONS Complete modular architecture oriented: 1)driving a car along a track. 2)module to avoid

CONCLUSIONS Complete modular architecture oriented: 1)driving a car along a track. 2)module to avoid collisions and overtake possible opponents n One of the main advantages : each module is in charge of managing one basic aspect of the driving. n Basic modules manage the car’s actuators (accelerator, brake, gear and steering) n Two more complex modules : • A simple TSK fuzzy controller -> target speed. • Modifications over the actuators -> overtake and avoid collision. n Very good results considering that many of the features / parameters n are hand-tuned. 9/16/2020

FUTURE WORK n n n The modularity of the architecture ->improvement of the controller.

FUTURE WORK n n n The modularity of the architecture ->improvement of the controller. For example, the car skids and lose the control when it go out of the track axis on sand. Solve : add a filter over the throttle signal. Many parameters(as increments applied in presence of other cars) are constants -> make them change as a function of the current speed. This may lead to the construction of “driving maps” oriented to, for example, reduce consumption, avoid high damage, etc. Consider : TSK controller is a suitable module to be improved by evolutionary techniques. 9/16/2020

Questions? 9/16/2020

Questions? 9/16/2020