Skip to content
Sohan Rudra edited this page Nov 4, 2018 · 9 revisions

Welcome to the MADRaS wiki!

Introduction

MADRaS is a python project built on top of TORCS and gym_torcs, to provide platform for Reinforcement Learning with TORCS. TORCS is a widely used simulator for autonomous driving research. TORCS consists built-in AI cars and scr_server type cars. The scr_server are server cars which can be controlled by creating a custom client. We use snakeoil client for all our client usages in the codebase, for different purposes, the drive function(function which controls the steer, acceleration and brake values of the client) is only changed. The actions of any snakeoil client are: steer, acceleration, brake and the observations which it receives from the car server are : angle, curLapTime, damage, distFromStart, distRaced, focus, fuel, gear, lastLapTime, opponents, racePos, rpm, speedX, speedY, speedZ, track, trackPos, wheelSpinVel, z.

Details of scr_Server can be found here.

Class diagram

class_dig

Major Features

  1. MADRaS provides two type of controllers for the server cars: Behavior Reflex controller and PID controller.

Behavior Reflex maps the sensor values directly to the actions(steer, acceleration and brake), in an end-to-end fashion.

PID controller on the other hand outputs higher level decision variables : The Lane to stay in and the target velocity of the vehicle.

Examples of usage of the two controllers are in the folder named example_controllers.

  1. Traffic Simulation: Various agents have been derived from snakeoil’s drive function. (Constant velocity, randomly braking, lane changing). These traffic agents can be used to create dense traffic scenes, an example of the same is illustrated in example_usage.py

  2. MADRaS provides a full gym-env(Madras-v0) compatible with both openai/baselines and rll/rllab (currently this has not been tested with the full array of available algorithms).

Installation

Installation prerequisities

  • TORCS
git clone https://github.com/madras-simulator/TORCS.git
  • plib
  • Install Dependencies
sudo apt-get install libalut-dev 
sudo apt-get install libvorbis-dev 
sudo apt-get install libxrandr2 libxrandr-dev 
sudo apt-get install zlib1g-dev 
sudo apt-get install libpng-dev 
sudo apt-get install libplib-dev libplib1 
sudo apt-get install python-tk
sudo apt-get install xautomation
  • Installling plib (follow instructions on the plib page)
  • Installing TORCS
cd TORCS/
./configure --prefix=$HOME/usr/local
make && make install
make datainstall
export PATH=$HOME/usr/local/bin:$PATH
export LD_LIBRARY_PATH=$HOME/usr/local/lib:$LD_LIBRARY_PATH
  • test if torcs is running by typing torcs in a new terminal window
  • test if scr client is installed or not.
    • open TORCS, navigate to configure race (race->quickrace->configure race -> select drivers)
    • check the Not-Selected list for scr-serverx where x will range in [1,9]

Tested on ubuntu-16.04 & ubuntu-18.04

Installation MADRaS

# if req an env can also be created
git clone https://github.com/madras-simulator/MADRaS
cd MADRaS/
pip3 install -e .