Coder Social home page Coder Social logo

masskro0 / urban-test-generator-fuel-scoring-function Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.33 GB

Automatically generate urban-like test cases and evaluate the fuel-inefficiency of any driving behaviour.

Python 46.29% Lua 40.60% C# 13.00% PowerShell 0.11%
autonomous-vehicles autonomous-driving python beamng fuel-efficiency test-case-generation testing-tools test-oracles scoring-functions test-suite

urban-test-generator-fuel-scoring-function's Introduction

Paper

You can find my bachelor thesis related to this repository here.

Prerequisites

Download Tortoise SVN from here.

Usage of this project requires BeamNG.research to be installed. A copy can be downloaded from here. Use SVN to download BeamNG.research and make sure to download revision 35. Once downloaded and extracted, it is mandatory to set the environment variable BNG_HOME to the trunk folder.

Additionally, download the Python version 3.7.0 (not tested with other versions) from here and make sure that Powershell uses the correct version. You can check it with python --version .

Installation

Clone the repository: git clone https://github.com/masskro0/Urban-Test-Generator-Fuel-Scoring-Function

After extracting, right-click on setup.ps1 and choose Run with Powershell. This creates the virtual environment and installs the required packages automatically. You will be asked whether you want to install the additional packages which are needed for the traffic lights evaluation experiment (optional and not needed for test generation). You can either install them [Y] or not [N].

This script will also run setup.py which creates folders and moves files to the correct directories. This requires to set the BNG_HOME environment variable as well as using BeamNGpy 1.15.

Usage

Once installed, you can run main.py which will generate test cases and run them inside BeamNG.research. You can configure the test generator with variables provided in main.py. urban_test_generator.py is the test generator itself.

To run the fuel-inefficiency experiment, simply run main() in evaluation\fuel_inefficiency\main.py and wait until it completes.

For the traffic lights experiments, there are several options. The function create_tests() will generate new test cases and moves them to all experiment folders. collect_images_existing_tests() runs all test cases of all experiments and collects images, while collect_images() collects images of only one specific test case of one experiment. Since I already collected images, you can just run predict_all_images() which will use the pretrained traffic light detection system to make predictions and visualize the results. plot_confusion_matrix() will plot a confusion matrix; I included examples for this method.

Traffic Light Detection

If you want to run the evaluation for the traffic light detection, you need to setup a traffic light detection model. I used this one: https://github.com/affinis-lab/traffic-light-detection-module

Features

  • The test generator generates randomly an urban-like scenario as XML files. The scenarios contain

    • intersections,
    • multi-lane roads,
    • valid road configurations,
    • positions for traffic lights and signs,
    • traffic light sequences and states,
    • parked cars positions,
    • other traffic participants (waypoints and spawn points),
    • waypoints for ego-car with lane switches
    • choosing the daytime
  • A scoring function for assessing how fuel inefficient a driver drives. The function contains the following metrics:

    • RPM (Rounds per minute) infraction checking
    • Throttle infraction checking
    • Brake infraction checking
    • Accelerate-and-Stop behaviour checking
    • Engine idling while standing checking
  • A test oracle for checking test-specific infractions during runtime to consider a test case as succeeded or failed. The oracles are:

    • Timeout
    • Crashing
    • Violating traffic rules at intersections

urban-test-generator-fuel-scoring-function's People

Contributors

dependabot[bot] avatar masskro0 avatar

Watchers

 avatar

urban-test-generator-fuel-scoring-function's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.