deepracer 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deepracer-0.1.0/LICENSE +21 -0
- deepracer-0.1.0/PKG-INFO +87 -0
- deepracer-0.1.0/README.md +50 -0
- deepracer-0.1.0/client/deepracer/__init__.py +60 -0
- deepracer-0.1.0/client/deepracer/clean.py +75 -0
- deepracer-0.1.0/client/deepracer/defaults/__init__.py +58 -0
- deepracer-0.1.0/client/deepracer/defaults/agent_params.json +28 -0
- deepracer-0.1.0/client/deepracer/defaults/environment_params.yaml +22 -0
- deepracer-0.1.0/client/deepracer/defaults/reward_function.py +25 -0
- deepracer-0.1.0/client/deepracer/defaults/tracks.txt +127 -0
- deepracer-0.1.0/client/deepracer/envs/__init__.py +3 -0
- deepracer-0.1.0/client/deepracer/envs/env.py +228 -0
- deepracer-0.1.0/client/deepracer/envs/utils.py +160 -0
- deepracer-0.1.0/client/deepracer/gym_adapter.py +101 -0
- deepracer-0.1.0/client/deepracer/service/__init__.py +26 -0
- deepracer-0.1.0/client/deepracer/service/backends.py +473 -0
- deepracer-0.1.0/client/deepracer/service/identity.py +126 -0
- deepracer-0.1.0/client/deepracer/service/manager.py +259 -0
- deepracer-0.1.0/client/deepracer/service/spec.py +76 -0
- deepracer-0.1.0/client/deepracer/service/validate.py +128 -0
- deepracer-0.1.0/client/deepracer/utils.py +27 -0
- deepracer-0.1.0/client/deepracer/zmq_client.py +51 -0
- deepracer-0.1.0/client/deepracer.egg-info/PKG-INFO +87 -0
- deepracer-0.1.0/client/deepracer.egg-info/SOURCES.txt +32 -0
- deepracer-0.1.0/client/deepracer.egg-info/dependency_links.txt +1 -0
- deepracer-0.1.0/client/deepracer.egg-info/requires.txt +22 -0
- deepracer-0.1.0/client/deepracer.egg-info/top_level.txt +1 -0
- deepracer-0.1.0/pyproject.toml +80 -0
- deepracer-0.1.0/setup.cfg +4 -0
- deepracer-0.1.0/tests/test_backends_argv.py +304 -0
- deepracer-0.1.0/tests/test_docker_integration.py +189 -0
- deepracer-0.1.0/tests/test_env_integration.py +146 -0
- deepracer-0.1.0/tests/test_identity.py +98 -0
- deepracer-0.1.0/tests/test_validate.py +128 -0
deepracer-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Uzair Akbar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
deepracer-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepracer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Gymnasium wrapper for the AWS DeepRacer simulator
|
|
5
|
+
Author-email: Uzair Akbar <uzairakbar025@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://uzairakbar.github.com/deepracer/
|
|
7
|
+
Project-URL: Repository, https://github.com/uzairakbar/deepracer
|
|
8
|
+
Project-URL: Documentation, https://uzairakbar.github.com/deepracer/
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: matplotlib
|
|
18
|
+
Requires-Dist: gymnasium
|
|
19
|
+
Requires-Dist: pyzmq
|
|
20
|
+
Requires-Dist: msgpack
|
|
21
|
+
Requires-Dist: msgpack_numpy
|
|
22
|
+
Requires-Dist: loguru
|
|
23
|
+
Requires-Dist: docker
|
|
24
|
+
Requires-Dist: pyyaml
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: ruff>=0.15; extra == "dev"
|
|
27
|
+
Requires-Dist: mypy>=1.14; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
30
|
+
Requires-Dist: pre-commit>=4; extra == "dev"
|
|
31
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
32
|
+
Requires-Dist: bump-my-version; extra == "dev"
|
|
33
|
+
Provides-Extra: docs
|
|
34
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
35
|
+
Requires-Dist: pymdown-extensions>=10; extra == "docs"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# DeepRacer Gym
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/deepracer/)
|
|
41
|
+
[](https://pepy.tech/project/deepracer)
|
|
42
|
+
[](https://www.python.org/)
|
|
43
|
+
[](LICENSE)
|
|
44
|
+
[](https://github.com/uzairakbar/deepracer/actions/workflows/test.yml)
|
|
45
|
+
[](https://codecov.io/gh/uzairakbar/deepracer)
|
|
46
|
+
[](https://hub.docker.com/r/uzairakbar/deepracer-test)
|
|
47
|
+
[](https://zenodo.org/badge/latestdoi/1297933489)
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<img src="https://raw.githubusercontent.com/uzairakbar/deepracer/main/docs/deepracer.gif" alt="DeepRacer" width="200">
|
|
51
|
+
</p>
|
|
52
|
+
|
|
53
|
+
A [Gymnasium](https://gymnasium.farama.org/) wrapper for the
|
|
54
|
+
[AWS DeepRacer](https://github.com/aws-deepracer-community/deepracer-for-cloud)
|
|
55
|
+
simulator. Each `deepracer-v0` environment automatically launches its own
|
|
56
|
+
containerized simulator (Docker/Podman/Apptainer), then exposes it through the standard `gymnasium` API.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
Requirements:
|
|
61
|
+
- Python 3.12+
|
|
62
|
+
- Linux (tested on Ubuntu 20.04+), macOS, or Windows (via WSL2)
|
|
63
|
+
- A container runtime: Docker, Podman, or Apptainer (e.g. for rootless runs on HPC)
|
|
64
|
+
- Sufficient hardware resources (recommended ~3 CPUs, ~6 GB RAM per environment)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install deepracer
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Quick Start
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import gymnasium as gym
|
|
74
|
+
import deepracer
|
|
75
|
+
|
|
76
|
+
env = gym.make("deepracer-v0") # starts a simulator service on demand
|
|
77
|
+
|
|
78
|
+
observation, info = env.reset()
|
|
79
|
+
|
|
80
|
+
observation, reward, terminated, truncated, info = env.step(
|
|
81
|
+
env.action_space.sample()
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
env.close() # stops + removes the simulator service
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
See the [full documentation](https://uzairakbar.com/deepracer/) for details.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# DeepRacer Gym
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/deepracer/)
|
|
4
|
+
[](https://pepy.tech/project/deepracer)
|
|
5
|
+
[](https://www.python.org/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/uzairakbar/deepracer/actions/workflows/test.yml)
|
|
8
|
+
[](https://codecov.io/gh/uzairakbar/deepracer)
|
|
9
|
+
[](https://hub.docker.com/r/uzairakbar/deepracer-test)
|
|
10
|
+
[](https://zenodo.org/badge/latestdoi/1297933489)
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="https://raw.githubusercontent.com/uzairakbar/deepracer/main/docs/deepracer.gif" alt="DeepRacer" width="200">
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
A [Gymnasium](https://gymnasium.farama.org/) wrapper for the
|
|
17
|
+
[AWS DeepRacer](https://github.com/aws-deepracer-community/deepracer-for-cloud)
|
|
18
|
+
simulator. Each `deepracer-v0` environment automatically launches its own
|
|
19
|
+
containerized simulator (Docker/Podman/Apptainer), then exposes it through the standard `gymnasium` API.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
Requirements:
|
|
24
|
+
- Python 3.12+
|
|
25
|
+
- Linux (tested on Ubuntu 20.04+), macOS, or Windows (via WSL2)
|
|
26
|
+
- A container runtime: Docker, Podman, or Apptainer (e.g. for rootless runs on HPC)
|
|
27
|
+
- Sufficient hardware resources (recommended ~3 CPUs, ~6 GB RAM per environment)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install deepracer
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import gymnasium as gym
|
|
37
|
+
import deepracer
|
|
38
|
+
|
|
39
|
+
env = gym.make("deepracer-v0") # starts a simulator service on demand
|
|
40
|
+
|
|
41
|
+
observation, info = env.reset()
|
|
42
|
+
|
|
43
|
+
observation, reward, terminated, truncated, info = env.step(
|
|
44
|
+
env.action_space.sample()
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
env.close() # stops + removes the simulator service
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
See the [full documentation](https://uzairakbar.com/deepracer/) for details.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from importlib.metadata import PackageNotFoundError
|
|
2
|
+
from importlib.metadata import version as _version
|
|
3
|
+
|
|
4
|
+
from gymnasium.envs.registration import register
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
__version__ = _version("deepracer")
|
|
8
|
+
except PackageNotFoundError: # running from a source tree without an install
|
|
9
|
+
__version__ = "0.0.0"
|
|
10
|
+
|
|
11
|
+
register(id="deepracer-v0", entry_point="deepracer.envs:DeepracerGymEnv")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def close(env, cache: bool | None = None):
|
|
15
|
+
"""Close a (possibly gym.make-wrapped) DeepRacer env, overriding its cache flag.
|
|
16
|
+
|
|
17
|
+
The container's fate is normally the env's `cache` flag (set at gym.make), and a
|
|
18
|
+
plain `env.close()` already honors it through the wrapper. Use this helper (or
|
|
19
|
+
`env.unwrapped.close(cache=…)`) only to *override* that decision at close time —
|
|
20
|
+
e.g. `deepracer.close(env, cache=False)` to force-stop a cache=True env.
|
|
21
|
+
"""
|
|
22
|
+
env.unwrapped.close(cache=cache)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def shutdown_all():
|
|
26
|
+
"""Stop every DeepRacer container this process is managing, including any
|
|
27
|
+
kept warm. Call when you are completely done (or to reclaim warm
|
|
28
|
+
containers)."""
|
|
29
|
+
from deepracer.service.manager import SimulationManager
|
|
30
|
+
|
|
31
|
+
if SimulationManager._instance is not None:
|
|
32
|
+
SimulationManager._instance.shutdown_all()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def running() -> list[str]:
|
|
36
|
+
"""Names of DeepRacer simulators currently running on this host (across any
|
|
37
|
+
kernels/processes). Handy to see what is up before/after your work."""
|
|
38
|
+
import shutil
|
|
39
|
+
import subprocess
|
|
40
|
+
|
|
41
|
+
from deepracer.service.spec import LABEL_NS
|
|
42
|
+
|
|
43
|
+
names: list[str] = []
|
|
44
|
+
for engine in ("podman", "docker"):
|
|
45
|
+
if shutil.which(engine) is None:
|
|
46
|
+
continue
|
|
47
|
+
result = subprocess.run(
|
|
48
|
+
[
|
|
49
|
+
engine,
|
|
50
|
+
"ps",
|
|
51
|
+
"--filter",
|
|
52
|
+
f"label={LABEL_NS}.managed=true",
|
|
53
|
+
"--format",
|
|
54
|
+
"{{.Names}}",
|
|
55
|
+
],
|
|
56
|
+
capture_output=True,
|
|
57
|
+
text=True,
|
|
58
|
+
)
|
|
59
|
+
names += [n for n in result.stdout.split() if n]
|
|
60
|
+
return names
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Maintenance CLI for removing orphaned DeepRacer sims.
|
|
2
|
+
|
|
3
|
+
python -m deepracer.clean
|
|
4
|
+
|
|
5
|
+
Removes managed Docker/Podman containers, DeepRacer Apptainer instances,
|
|
6
|
+
per-instance overlays, and stale Apptainer logs. Best-effort and idempotent.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import glob
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import shutil
|
|
13
|
+
import subprocess
|
|
14
|
+
|
|
15
|
+
from deepracer.service.spec import LABEL_NS
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _run(argv):
|
|
19
|
+
return subprocess.run(argv, capture_output=True, text=True)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _clean_oci(binary: str) -> None:
|
|
23
|
+
if shutil.which(binary) is None:
|
|
24
|
+
return
|
|
25
|
+
result = _run([binary, "ps", "-aq", "--filter", f"label={LABEL_NS}.managed=true"])
|
|
26
|
+
ids = [i for i in result.stdout.split() if i]
|
|
27
|
+
for cid in ids:
|
|
28
|
+
_run([binary, "rm", "-f", cid]) # -f stops then removes
|
|
29
|
+
print(f"{binary}: removed {len(ids)} managed container(s).")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _clean_apptainer() -> None:
|
|
33
|
+
if shutil.which("apptainer") is None:
|
|
34
|
+
return
|
|
35
|
+
result = _run(["apptainer", "instance", "list", "--json"])
|
|
36
|
+
try:
|
|
37
|
+
instances = json.loads(result.stdout).get("instances", [])
|
|
38
|
+
except Exception:
|
|
39
|
+
instances = []
|
|
40
|
+
names = [
|
|
41
|
+
i["instance"]
|
|
42
|
+
for i in instances
|
|
43
|
+
if str(i.get("instance", "")).startswith("deepracer-")
|
|
44
|
+
]
|
|
45
|
+
for name in names:
|
|
46
|
+
_run(["apptainer", "instance", "stop", name])
|
|
47
|
+
for overlay in glob.glob("/tmp/deepracer_*"):
|
|
48
|
+
shutil.rmtree(overlay, ignore_errors=True)
|
|
49
|
+
# Apptainer never rotates its per-instance logs; they accumulate forever and
|
|
50
|
+
# a stale FATAL: line poisons a later start of the same name (the backend
|
|
51
|
+
# clears these per-name on start, but sweep leftovers here too).
|
|
52
|
+
log_base = os.path.expanduser("~/.apptainer/instances/logs")
|
|
53
|
+
logs = glob.glob(os.path.join(log_base, "*", "*", "deepracer-*.out")) + glob.glob(
|
|
54
|
+
os.path.join(log_base, "*", "*", "deepracer-*.err")
|
|
55
|
+
)
|
|
56
|
+
for path in logs:
|
|
57
|
+
try:
|
|
58
|
+
os.remove(path)
|
|
59
|
+
except OSError:
|
|
60
|
+
pass
|
|
61
|
+
print(
|
|
62
|
+
f"apptainer: stopped {len(names)} instance(s), cleared overlays + "
|
|
63
|
+
f"{len(logs)} stale log file(s)."
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def main() -> None:
|
|
68
|
+
for binary in ("docker", "podman"):
|
|
69
|
+
_clean_oci(binary)
|
|
70
|
+
_clean_apptainer()
|
|
71
|
+
print("Done.")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if __name__ == "__main__":
|
|
75
|
+
main()
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Packaged default configs (agent_params.json, environment_params.yaml,
|
|
2
|
+
# reward_function.py) and the frozen track list (tracks.txt), so the package
|
|
3
|
+
# works from any cwd without the repo's top-level configs/ directory.
|
|
4
|
+
import importlib.resources as resources
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _read(name: str) -> str:
|
|
9
|
+
return resources.files("deepracer.defaults").joinpath(name).read_text()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def default_agent_config() -> dict:
|
|
13
|
+
return json.loads(_read("agent_params.json"))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def default_track_config() -> dict:
|
|
17
|
+
import yaml # pyyaml
|
|
18
|
+
|
|
19
|
+
return yaml.safe_load(_read("environment_params.yaml"))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def resolve_agent_config(config: dict | None = None) -> dict:
|
|
23
|
+
"""shallow merge agent config with packaged defaults"""
|
|
24
|
+
if config is None:
|
|
25
|
+
return default_agent_config()
|
|
26
|
+
if isinstance(config, dict):
|
|
27
|
+
return {**default_agent_config(), **config}
|
|
28
|
+
raise TypeError(
|
|
29
|
+
f"agent_config must be a dict or None, got {type(config).__name__}."
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def resolve_track_config(config: dict | None = None) -> dict:
|
|
34
|
+
"""shallow merge track config with packaged defaults"""
|
|
35
|
+
if config is None:
|
|
36
|
+
return default_track_config()
|
|
37
|
+
if isinstance(config, dict):
|
|
38
|
+
return {**default_track_config(), **config}
|
|
39
|
+
raise TypeError(
|
|
40
|
+
f"track_config must be a dict or None, got {type(config).__name__}."
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def default_reward_function():
|
|
45
|
+
"""The packaged default reward function (used when the caller passes none).
|
|
46
|
+
|
|
47
|
+
Prefer a repo-local ``configs.reward_function`` if importable (back-compat
|
|
48
|
+
with the current project layout); otherwise fall back to the packaged copy.
|
|
49
|
+
Loaded lazily so importing the package never depends on cwd.
|
|
50
|
+
"""
|
|
51
|
+
try:
|
|
52
|
+
from configs.reward_function import reward_function
|
|
53
|
+
|
|
54
|
+
return reward_function
|
|
55
|
+
except Exception:
|
|
56
|
+
namespace: dict = {}
|
|
57
|
+
exec(_read("reward_function.py"), namespace)
|
|
58
|
+
return namespace["reward_function"]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action_space": [
|
|
3
|
+
{
|
|
4
|
+
"steering_angle": 30,
|
|
5
|
+
"speed": 0.6
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"steering_angle": 15,
|
|
9
|
+
"speed": 0.6
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"steering_angle": 0,
|
|
13
|
+
"speed": 0.6
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"steering_angle": -15,
|
|
17
|
+
"speed": 0.6
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"steering_angle": -30,
|
|
21
|
+
"speed": 0.6
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"sensor": ["STEREO_CAMERAS", "LIDAR"],
|
|
25
|
+
"neural_network": "DEEP_CONVOLUTIONAL_NETWORK_SHALLOW",
|
|
26
|
+
"action_space_type": "discrete",
|
|
27
|
+
"version": "6"
|
|
28
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
WORLD_NAME: "reInvent2019_wide"
|
|
2
|
+
CHANGE_START_POSITION: "true"
|
|
3
|
+
ALTERNATE_DRIVING_DIRECTION: "true"
|
|
4
|
+
NUMBER_OF_OBSTACLES: "0"
|
|
5
|
+
IS_OBSTACLE_BOT_CAR: "false"
|
|
6
|
+
RANDOMIZE_OBSTACLE_LOCATIONS: "true"
|
|
7
|
+
# OBJECT_POSITIONS:
|
|
8
|
+
# - 0.1690708037909166, -1
|
|
9
|
+
# - 0.2638102569075569, 1
|
|
10
|
+
# - 0.4072827740044651, -1
|
|
11
|
+
# - 0.5804718430735435, 1
|
|
12
|
+
# - 0.6937442410812812, -1
|
|
13
|
+
# - 0.7864867324330095, 1
|
|
14
|
+
IS_LANE_CHANGE: "false"
|
|
15
|
+
LOWER_LANE_CHANGE_TIME: "3.0"
|
|
16
|
+
UPPER_LANE_CHANGE_TIME: "5.0"
|
|
17
|
+
LANE_CHANGE_DISTANCE: "1.0"
|
|
18
|
+
NUMBER_OF_BOT_CARS: "0"
|
|
19
|
+
MIN_DISTANCE_BETWEEN_BOT_CARS: "2.0"
|
|
20
|
+
RANDOMIZE_BOT_CAR_LOCATIONS: "true"
|
|
21
|
+
BOT_CAR_SPEED: "0.2"
|
|
22
|
+
ENABLE_DOMAIN_RANDOMIZATION: "false"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
def reward_function(params):
|
|
2
|
+
"""
|
|
3
|
+
Example of rewarding the agent to follow center line
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# Read input parameters
|
|
7
|
+
track_width = params["track_width"]
|
|
8
|
+
distance_from_center = params["distance_from_center"]
|
|
9
|
+
|
|
10
|
+
# Calculate 3 markers that are at varying distances away from the center line
|
|
11
|
+
marker_1 = 0.1 * track_width
|
|
12
|
+
marker_2 = 0.25 * track_width
|
|
13
|
+
marker_3 = 0.5 * track_width
|
|
14
|
+
|
|
15
|
+
# Give higher reward if the car is closer to center line and vice versa
|
|
16
|
+
if distance_from_center <= marker_1:
|
|
17
|
+
reward = 1.0
|
|
18
|
+
elif distance_from_center <= marker_2:
|
|
19
|
+
reward = 0.5
|
|
20
|
+
elif distance_from_center <= marker_3:
|
|
21
|
+
reward = 0.1
|
|
22
|
+
else:
|
|
23
|
+
reward = 1e-3 # likely crashed/ close to off track
|
|
24
|
+
|
|
25
|
+
return float(reward)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
2022_april_open
|
|
2
|
+
2022_april_open_ccw
|
|
3
|
+
2022_april_open_cw
|
|
4
|
+
2022_april_pro
|
|
5
|
+
2022_april_pro_ccw
|
|
6
|
+
2022_april_pro_cw
|
|
7
|
+
2022_august_open
|
|
8
|
+
2022_august_open_ccw
|
|
9
|
+
2022_august_open_cw
|
|
10
|
+
2022_august_pro
|
|
11
|
+
2022_august_pro_ccw
|
|
12
|
+
2022_august_pro_cw
|
|
13
|
+
2022_july_open
|
|
14
|
+
2022_july_pro
|
|
15
|
+
2022_july_pro_ccw
|
|
16
|
+
2022_july_pro_cw
|
|
17
|
+
2022_june_open
|
|
18
|
+
2022_june_open_ccw
|
|
19
|
+
2022_june_open_cw
|
|
20
|
+
2022_june_pro
|
|
21
|
+
2022_june_pro_ccw
|
|
22
|
+
2022_june_pro_cw
|
|
23
|
+
2022_march_open
|
|
24
|
+
2022_march_open_ccw
|
|
25
|
+
2022_march_open_cw
|
|
26
|
+
2022_march_pro
|
|
27
|
+
2022_march_pro_ccw
|
|
28
|
+
2022_march_pro_cw
|
|
29
|
+
2022_may_open
|
|
30
|
+
2022_may_open_ccw
|
|
31
|
+
2022_may_open_cw
|
|
32
|
+
2022_may_pro
|
|
33
|
+
2022_may_pro_ccw
|
|
34
|
+
2022_may_pro_cw
|
|
35
|
+
2022_october_open
|
|
36
|
+
2022_october_open_ccw
|
|
37
|
+
2022_october_open_cw
|
|
38
|
+
2022_october_pro
|
|
39
|
+
2022_october_pro_ccw
|
|
40
|
+
2022_october_pro_cw
|
|
41
|
+
2022_reinvent_champ_ccw
|
|
42
|
+
2022_reinvent_champ_cw
|
|
43
|
+
2022_september_open
|
|
44
|
+
2022_september_open_ccw
|
|
45
|
+
2022_september_open_cw
|
|
46
|
+
2022_september_pro
|
|
47
|
+
2022_september_pro_ccw
|
|
48
|
+
2022_september_pro_cw
|
|
49
|
+
2022_summit_speedway
|
|
50
|
+
2022_summit_speedway_ccw
|
|
51
|
+
2022_summit_speedway_cw
|
|
52
|
+
2022_summit_speedway_mini
|
|
53
|
+
2024_reinvent_champ_ccw
|
|
54
|
+
2024_reinvent_champ_cw
|
|
55
|
+
Albert
|
|
56
|
+
AmericasGeneratedInclStart
|
|
57
|
+
Aragon
|
|
58
|
+
arctic_open
|
|
59
|
+
arctic_open_ccw
|
|
60
|
+
arctic_open_cw
|
|
61
|
+
arctic_pro
|
|
62
|
+
arctic_pro_ccw
|
|
63
|
+
arctic_pro_cw
|
|
64
|
+
Austin
|
|
65
|
+
AWS_track
|
|
66
|
+
Belille
|
|
67
|
+
Bowtie_track
|
|
68
|
+
caecer_gp
|
|
69
|
+
caecer_loop
|
|
70
|
+
Canada_Training
|
|
71
|
+
China_track
|
|
72
|
+
dubai_open
|
|
73
|
+
dubai_open_ccw
|
|
74
|
+
dubai_open_cw
|
|
75
|
+
dubai_pro
|
|
76
|
+
FS_June2020
|
|
77
|
+
hamption_open
|
|
78
|
+
hamption_pro
|
|
79
|
+
July_2020
|
|
80
|
+
jyllandsringen_open
|
|
81
|
+
jyllandsringen_open_ccw
|
|
82
|
+
jyllandsringen_open_cw
|
|
83
|
+
jyllandsringen_pro
|
|
84
|
+
jyllandsringen_pro_ccw
|
|
85
|
+
jyllandsringen_pro_cw
|
|
86
|
+
LGSWide
|
|
87
|
+
Mexico_track
|
|
88
|
+
Monaco
|
|
89
|
+
Monaco_building
|
|
90
|
+
morgan_open
|
|
91
|
+
morgan_pro
|
|
92
|
+
New_York_Track
|
|
93
|
+
Oval_track
|
|
94
|
+
penbay_open
|
|
95
|
+
penbay_open_ccw
|
|
96
|
+
penbay_open_cw
|
|
97
|
+
penbay_pro
|
|
98
|
+
penbay_pro_ccw
|
|
99
|
+
penbay_pro_cw
|
|
100
|
+
red_star_open
|
|
101
|
+
red_star_pro
|
|
102
|
+
red_star_pro_ccw
|
|
103
|
+
red_star_pro_cw
|
|
104
|
+
reInvent2019_track
|
|
105
|
+
reInvent2019_track_ccw
|
|
106
|
+
reInvent2019_track_cw
|
|
107
|
+
reInvent2019_wide
|
|
108
|
+
reInvent2019_wide_ccw
|
|
109
|
+
reInvent2019_wide_cw
|
|
110
|
+
reInvent2019_wide_mirrored
|
|
111
|
+
reinvent_base
|
|
112
|
+
reinvent_carpet
|
|
113
|
+
reinvent_concrete
|
|
114
|
+
reinvent_wood
|
|
115
|
+
Singapore
|
|
116
|
+
Singapore_building
|
|
117
|
+
Singapore_f1
|
|
118
|
+
Spain_track
|
|
119
|
+
Spain_track_f1
|
|
120
|
+
Straight_track
|
|
121
|
+
thunder_hill_open
|
|
122
|
+
thunder_hill_pro
|
|
123
|
+
thunder_hill_pro_ccw
|
|
124
|
+
thunder_hill_pro_cw
|
|
125
|
+
Tokyo_Training_track
|
|
126
|
+
Vegas_track
|
|
127
|
+
Virtual_May19_Train_track
|