SuperAPIAI Directory

europilot

github.com · AI coding

Train autonomous driving with games. Europilot is an open-source project that uses Python to control Euro Truck Simulator 2 as a toolkit for developing self-driving algorithms. Use the popular Euro Truck Simulator (ETS2) to develop autonomous driving algorithms. With europilot, you can capture game screen input and programmatically control the truck in the simulator. Europilot can be used in one of two ways: training or testing. For training, europilot can capture screen input in real time and output a numpy array, while also obtaining wheel joystick values. For testing, europilot can create a virtual joystick driver that can be recognized in the game and can programmatically control the truck. Using this joystick, you can create a real-time inference network that performs real-time inference

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

Europilot is an open-source toolkit designed to use Euro Truck Simulator 2 (ETS2) to develop and test autonomous driving algorithms. It connects the game environment with commonly used deep learning frameworks such as Keras or TensorFlow, allowing developers to capture game screen input and programmatically control the truck in the simulator. The project uses a convolutional neural network (CNN) to control the steering wheel in ETS2, making it suitable as a research and experimentation platform for end-to-end driving models.

Main capabilities

Europilot provides two ways to use it: training and testing.

  • Training mode: Captures screen input in real time and outputs numpy arrays, while also obtaining wheel joystick values. The mapping between the relevant screenshots and joystick values is written to a CSV file, with each line recording the screenshot filename and the corresponding joystick value. This allows a training dataset to be built for training driving models.
  • Testing mode: Creates a virtual joystick driver that can be recognized in the game, thereby programmatically controlling the truck. Using this virtual joystick, a real-time inference network can be built that takes the game screen as input and outputs the relevant joystick commands such as steering.

Europilot hides the complexity of capturing screen data and joystick data, providing a simplified interface. Internally, it parses the joystick data stream into a machine-readable format (originally for the Logitech G27 steering wheel; if using another joystick, you need to modify joystick.py to suit your needs). The virtual joystick driver is implemented by attaching a userspace driver in the kernel and outputting events to udev. Note that the driver must be initialized before the game starts, otherwise it will not appear on the controllers page.

The project currently provides an example notebook based on Keras, and hopes to add examples for other popular frameworks in the future.

Usage

  1. First clone the project.
  2. If you want to install europilot locally, you can follow the project instructions; alternatively, you can install the dependencies directly in the project path and operate there.
  3. To start generating training data, see scripts directory in generate_training_data.py.
    • Note: Using the screen selection GUI requires OpenCV compiled with the opencv_contrib module. Otherwise, you need to specify a custom Box object for train.Config.BOX to determine the screen region to capture.
  4. After generating training data, it is recommended to manually inspect each image to confirm that unwanted data was not recorded. You can use clean_up.ipynb in the simple script to delete unwanted data and the corresponding rows in the CSV file. You can also refer to preprocess.ipynb and get_mean_std.ipynb in the example code to preprocess the data.
  5. PilotNet.ipynb is an implementation of Mariusz Bojarski's End to End Learning for Self-Driving Cars, with slight differences. The demo provided by the project was created by this notebook.
  6. To run inference on the model, see scripts in the directory inference.ipynb.

The project also provides a driving dataset containing 162,495 images (17G in size), available for those interested.

Applicable Scenarios

Europilot is suitable for the following scenarios:

  • Researching and developing end-to-end autonomous driving algorithms, especially vision-based steering control.
  • Collecting driving data in a simulated environment and training deep learning models without the need for a real vehicle.
  • Testing real-time inference networks that take game screens as input and output joystick control commands.
  • Serving as a teaching or experimental platform to help understand the perception and control pipeline in autonomous driving.

The reasons the project chose ETS2 as the first target platform include: ETS2 supports multiple platforms (Windows, OS X, Linux), so developers can run it on a Macbook or Ubuntu workstation; ETS2 has realistic graphics and a physics engine (with "simulator" in its name), making it closer to reality than the graphics or physics engines of some open-source games; and the game itself is fun, making it easy for developers to play for long periods to accumulate large datasets.

Limitations

  • Europilot runs on Linux and supports Python 2.6-2.7 and 3.3+.
  • The virtual joystick driver must be initialized before the game starts, otherwise it will not be recognized in-game.
  • The default joystick data parsing is for the Logitech G27; if using another joystick, you need to modify joystick.py.
  • Using the screen selection GUI requires OpenCV compiled with the opencv_contrib module; otherwise, the capture region must be specified manually.
  • The current example notebook is based on Keras; examples for other popular frameworks have not yet been provided.
  • The project roadmap includes: running ETS2 on a virtual machine and remotely training/testing models, a web leaderboard, capturing custom visual data while driving in ETS2 (such as left and right side cameras), supporting reinforcement learning workflows similar to OpenAI Universe, and supporting Windows as needed.
  • The project uses the MIT license.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools