{"id":13646982,"url":"https://github.com/marsauto/europilot","last_synced_at":"2025-05-16T10:06:25.383Z","repository":{"id":56685288,"uuid":"96978806","full_name":"marsauto/europilot","owner":"marsauto","description":"A toolkit for controlling Euro Truck Simulator 2 with python to develop self-driving algorithms.","archived":false,"fork":false,"pushed_at":"2020-10-25T11:19:26.000Z","size":9384,"stargazers_count":1519,"open_issues_count":5,"forks_count":187,"subscribers_count":60,"default_branch":"master","last_synced_at":"2025-04-09T04:06:57.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marsauto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-12T07:33:04.000Z","updated_at":"2025-04-08T00:13:18.000Z","dependencies_parsed_at":"2022-08-15T23:20:16.246Z","dependency_job_id":null,"html_url":"https://github.com/marsauto/europilot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsauto%2Feuropilot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsauto%2Feuropilot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsauto%2Feuropilot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marsauto%2Feuropilot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marsauto","download_url":"https://codeload.github.com/marsauto/europilot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T01:03:17.478Z","updated_at":"2025-05-16T10:06:25.351Z","avatar_url":"https://github.com/marsauto.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook","SOTA代码"],"sub_categories":["决策系统|Decision Making"],"readme":"# europilot\r\n\r\n## Overview\r\n\r\nEuropilot is an open source project that leverages the popular Euro Truck Simulator(ETS2) to develop self-driving algorithms.\r\n\r\n![alt tag](examples/day.gif)\r\n![alt tag](examples/night.gif)\r\n\u003cp align = 'center'\u003e\r\nA convolutional neural network (CNN) controls the steering wheel inside ETS2.\r\n\u003c/p\u003e\r\n\r\nThink of europilot as a bridge between the game environment, and your favorite deep-learning framework, such as Keras or Tensorflow. With europilot, you can capture the game screen input, and programmatically control the truck inside the simulator. \r\n\r\nEuropilot can be used in one of two ways: training or testing. \r\n\r\nFor training, europilot can capture the screen input and output a numpy array in realtime, while simultaenously getting the wheel-joystick values. The mapping between the relevant screenshot and the joystick values is written inside a csv file.\r\n\u003cdiv align = 'center'\u003e\r\n\t\u003cimg src = 'examples/example_csv.png'\u003e\r\n\u003c/div\u003e\r\n\u003cp align = 'center'\u003e\r\nIn the csv file, each row has the screenshot filename with the joystick values. \r\n\u003c/p\u003e\r\n\r\nFor testing, europilot can create a virtual joystick driver that can be recognized inside the game, which can be used to programmatically control the truck. Using this joystick, you can create a real-time inference network that uses the game screen as the input, and outputs the relevant joystick commands, such as steering. \r\n\r\n[Click to see an example demo on YouTube.](https://www.youtube.com/watch?v=n2pPR3WLaxI)\r\n\r\n[Click to read a blog post on our motivation behind the project.](https://medium.com/mars-auto/create-self-driving-trucks-inside-euro-truck-simulator-2-c64424d528ed)\r\n\r\n## Getting Started\r\n\r\nFirst, clone the project\r\n\r\n```\r\ngit clone git@github.com:marshq/europilot.git\r\n```\r\n\r\nIf you want to install europilot locally,\r\n\r\n```\r\npython setup.py install\r\n```\r\n\r\nYou can also install prerequisite libraries and do something directly in this project path.\r\n\r\n```\r\npip install -r requirements.txt\r\npython\r\n```\r\n```python\r\n\u003e\u003e\u003e import europilot\r\n\u003e\u003e\u003e europilot.__version__\r\n'0.0.1'\r\n```\r\n\r\nTo start generating training data, check out [generate_training_data.py](scripts/generate_training_data.py) in the scripts directory.\r\n\r\nNOTE that `opencv` compiled with `opencv_contrib` module is required to use screen selection gui.\r\n\r\nOtherwise, you should specify a screen area in which will be captured by assigning custom `Box` object to `train.Config.BOX`.\r\n\r\nAfter the generation of training data is finished, you may want to manually inspect each image to check if unwanted data was recorded. Check [clean_up.ipynb](scripts/01.clean_up.ipynb) for a simple script to remove unwanted data together with the accompanying row in the csv file. Also check out [preprocess.ipynb](scripts/02.preprocess.ipynb) and [get_mean_std.ipynb](scripts/03.get_mean_std.ipynb) for an example code to preprocess the data.\r\n\r\n[PilotNet.ipynb](scripts/04.PilotNet.ipynb) is an implementation of Mariusz Bojarski's [End to End Learning for Self-Driving Cars](https://arxiv.org/abs/1604.07316), with slight differences. The demo shown above was created with the following notebook.\r\n\r\nFor running inference on the model, check out [inference.ipynb](scripts/05.inference.ipynb) in the scripts directory.\r\n\r\n## Sample Training Data\r\nFor those interested, a driving dataset consisting of 162,495 images is available [here](https://drive.google.com/file/d/0B42sVbnSOCJ4bnZhWF80b0xUY28/view?usp=sharing) (17G).\r\n\r\n## General Architecture\r\n\r\nEuropilot hides the complexity of capturing the screen data and joystick data with a simplified interface. Internally, the joystick datastream is parsed into a machine readable format, which for us was a Logitech G27. If you have a different joystick, modify [joystick.py](europilot/joystick.py) to your needs.\r\n\r\nWe currently have [example notebooks](scripts/) implemented with Keras. We hope to add more examples in other popular frameworks.\r\n\r\nA virtual joystick driver is implemented by attaching userspace drivers in the kernel, by outputting events into udev. This driver can be recognized inside ETS2. Please note that the driver must be initialized before the game is started, or else it will not show up in the controller page.\r\n\r\n## Why Euro Truck Simulator 2?\r\n\r\nEuropilot captures the screen input, therefore technically it is game agnostic. We chose ETS2 as our first target for several reasons.\r\n\r\n* Multi platform support: ETS2 supports Windows, OS X, and Linux. Developers can run the game in a Macbook, or in a Ubuntu workstation. This put ETS2 ahead of games such as GTAV.\r\n\r\n\r\n* Realistic graphics/physics: We looked at open source games, but found that the graphics or physics engine was not realistic enough for our use case. ETS2 afterall, has \"simulator\" inside its title.\r\n\r\n\r\n* Fun: Having a large dataset is critical to developing a good model. Therefore you, as a developer, have to play many hours of whatever game you target. Fortunately, ETS2 is fun to play!\r\n\r\n## Documentation\r\n\r\nFor now, refer to the README and the source code.\r\n\r\n## Compatibility\r\n\r\nEuropilot runs on linux. It supports python 2.6-2.7 and 3.3+.\r\n\r\n## How to Contribute\r\n\r\nAny contribution regarding new feature, bug fix and documentation is welcomed.\r\n\r\nBut we highly recommend you to read this guideline before you make a pull request.\r\n\r\n### Coding convention\r\n\r\nWe generally follow PEP8 with few additional conventions.\r\n\r\n* Line-length can exceed 79 characters, to 100 in case of comments.\r\n* Always use single-quoted strings, unless a single-quote occurs within the string.\r\n* Docstrings use double-quote.\r\n\r\n### Roadmap\r\n\r\nFeature roadmap includes\r\n\r\n* Run ETS2 on virtual machine and train/test a model remotely\r\n* Web leaderboard\r\n* Capture custom(ex. left, right side cam) vision data while driving in ETS2\r\n* Support reinforcement learning workflow which is simliar to openai universe\r\n* Windows support, if there is demand.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarsauto%2Feuropilot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarsauto%2Feuropilot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarsauto%2Feuropilot/lists"}