百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

assetto_corsa_gym

> DevOps
开源

Assetto Corsa OpenAI 体育环境

199 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

Assetto Corsa OpenAI 体育环境

Assetto Corsa Gym

Official implementation of the paper: A Simulation Benchmark for Autonomous Racing with Large-Scale Human Data

[Website] [Dataset] [ROS2 interface] [Paper]


Table of Contents

  • Overview
  • Updates
  • Source Code Tree
  • Getting Started
  • Demos
  • Benchmarks
    • Example policy for Monza and GT3
    • Train SAC from Scratch
    • Test a Model
    • Train SAC from Demonstrations
    • Train with Weights & Biases
  • Screen Capture Support
  • Download Datasets

Overview

Gym interfaces with AssettoCorsa for Autonomous Racing. This repository integrates the AssettoCorsa racing simulator with the OpenAI's Gym interface, providing a high-fidelity environment for developing and testing Autonomous Racing algorithms in realistic racing scenarios.

Features:

  • High-Fidelity Simulation: Realistic car dynamics and track environments.
  • Customizable Scenarios: Various cars, tracks, and weather conditions.
  • RL Integration: Compatible with Gym for easy application of RL algorithms.
  • ROS2 interface
  • Baselines: Soft Actor-Critic (SAC)(this code base) and TD-MPC2 (to be uploaded soon)

This repository contains all the necessary code to run the Gym interface for Assetto Corsa and RL benchmarks. For the ROS2 interface, refer to ROS2 interface

We base our SAC code on this implementation.

Updates

Apr 2025:

  • Added support for running Assetto Corsa and training agents natively on Linux using Proton.
    The Linux version offers better execution speed and is more stable than Windows, while yielding identical results.
    • See detailed installation instructions in INSTALL_Linux.md.
    • Thanks to @xi-jiajun and @alfredgu001324 for their contributions.
  • Added support for manual gearbox shifting.

Feb 2025: Support for Alternate Python Interpreters

  • Now supports the use of newer Python interpreter versions on the plugin side.

Feb 2025: Screen Capture Support

  • Added support for retrieving images from the OpenAI Gym interface.
  • Images can be saved directly to the hard drive.
  • Implemented a dual-buffer shared memory mechanism to minimize read/write latency.
  • Color and gray scale images support.
  • See the usage examples and installation instructions below.

Dic 2024: Checkpoints

  • Added example checkpoints for the SAC policy for Monza and the GT3 car.

Source Code Tree:

  • assetto_corsa_gym
    • assetto-corsa-autonomous-racing-plugin
      • Plugin for AC
    • AssettoCorsaConfigs
      • cars
      • controls maps
      • tracks
        • Track bounds
        • Occupancy
        • Racing line
    • AssettoCorsaEnv
      • Communication client
      • OpenAI Gym interface
  • algorithm
    • SAC baseline
  • data
    • Extra information of the dataset and statistics. Instructions to record human demonstrations

Getting started

  1. Install the AC plug-in Follow the instructions in INSTALL.md

  2. Install Python in Windows

    • Install Visual Studio Compiler

      • To compile the necessary components for the plugin, download and install the Visual Studio compiler from: Visual Studio C++ Build Tools
      • Make sure to install the C++ build tools component
    • Install Python using Anaconda

      bash
      conda create -n p309 python=3.9.13
      conda activate p309
      pip install setuptools==65.5.0 "cython`. To enable logging to Weights and Biases, appropriate values should be set in the config file. Each parameter in the config file can be modified directly from the terminal using `=`. For instance, to change the car, use `AssettoCorsa.car=`.
  • Example policy for Monza and the GT3 car

    The checkpoints are in the dataset (see below). The expected lap time is approximately 112.1 seconds.

    bash
    python train.py --test --load_path \monza\bmw_z4_gt3\20241108_SAC\model\checkpoints\step_05400000 AssettoCorsa.track=monza AssettoCorsa.car=bmw_z4_gt3
  • Train from SAC from Scratch

    • To train SAC from scratch in Barcelona/F317:

      bash
      python train.py
    • To train on other cars and tracks (ensure the car and track are set first in AC):

      bash
      python train.py AssettoCorsa.track= AssettoCorsa.car=

      Example for Monza GT3:

      bash
      python train.py AssettoCorsa.track=monza AssettoCorsa.car=bmw_z4_gt3
  • Test a model by loading a checkpoint

    bash
    python train.py --test --load_path  AssettoCorsa.track= AssettoCorsa.car=
  • Train SAC from demonstrations using an ensemble of buffers

    • Update ac_offline_train_paths.yml (see available data in data\paths.yml).

    • Run:

      bash
      python train.py load_offline_data=True Agent.use_offline_buffer=True dataset_path=
  • Train with Weights & Biases enabled

    python
    python train.py disable_wandb=False
…

python git clone https://huggingface.co/datasets/dasgringuen/assettoCorsaGym

After cloning, delete the .git directory to free up space


- To download one track and car combination at a time, run the following replacing  and :

```python
from huggingface_hub import snapshot_download

snapshot_download(
    repo_id="dasgringuen/assettoCorsaGym",
    repo_type="dataset",
    local_dir="AssettoCorsaGymDataSet",
    allow_patterns="data_sets///*"
)

Hugging Face is currently having some false positives in their dataset checking due to a security issue with pickle files importing numpy:

  Detected Pickle imports:
  - "numpy.core.multiarray.scalar"
  - "numpy.core.multiarray._reconstruct"
  - "numpy.dtype"
  - "numpy.ndarray"

Hugging Face flags these for security reasons. You can see more about this in the issue here. We plan to convert the files to a safer format like Parquet in the future.


Contributing

You are very welcome to contribute to this project. Feel free to open an issue or pull request if you have any suggestions or bug reports, but please review our guidelines first. Our goal is to build a codebase that can easily be extended to new environments and tasks, and we would love to hear about your experience!


License

This project is licensed under the MIT License - see the LICENSE file for details. Note that the repository relies on third-party code, which is subject to their respective licenses.


Acknowledgments

  • Adrian Remonda @dasgringuen (TU Graz / UCSD)
  • Jiajun Xi @Nightwalkx
  • @alfredgu001324
  • Francesco Gatti (TII EuroRacing - Hipert)
  • Andrea Serafini (TII EuroRacing - Unimore)
  • Francesco Moretti (TII EuroRacing - Unimore)
  • Ayoub Raji (TII EuroRacing - Unimore)

Issues· 6 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonassetto-corsagym-environmentlearning-from-demonstrationmpc-control

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理