deep-learning-robotics 0.0.1__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.
- deep_learning_robotics-0.0.1/.github/workflows/ci.yml +64 -0
- deep_learning_robotics-0.0.1/.github/workflows/publish-testpypi.yml +90 -0
- deep_learning_robotics-0.0.1/.github/workflows/publish.yml +89 -0
- deep_learning_robotics-0.0.1/.gitignore +8 -0
- deep_learning_robotics-0.0.1/LICENSE +22 -0
- deep_learning_robotics-0.0.1/PKG-INFO +210 -0
- deep_learning_robotics-0.0.1/README.md +156 -0
- deep_learning_robotics-0.0.1/pyproject.toml +56 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/__init__.py +38 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/environment.py +447 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/episode_manager.py +160 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/planning.py +249 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/py.typed +1 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/rendering.py +233 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/scenario.py +141 -0
- deep_learning_robotics-0.0.1/src/dl_robotics/world.py +337 -0
- deep_learning_robotics-0.0.1/tests/test_environment.py +165 -0
- deep_learning_robotics-0.0.1/tests/test_planning.py +127 -0
- deep_learning_robotics-0.0.1/tests/test_rendering.py +170 -0
- deep_learning_robotics-0.0.1/tests/test_scenario.py +192 -0
- deep_learning_robotics-0.0.1/uv.lock +2399 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
pull_request:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions: {}
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
validate:
|
|
21
|
+
name: Python ${{ matrix.python-version }}
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
permissions:
|
|
24
|
+
contents: read
|
|
25
|
+
strategy:
|
|
26
|
+
fail-fast: false
|
|
27
|
+
matrix:
|
|
28
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- name: Check out repository
|
|
32
|
+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
|
|
36
|
+
- name: Set up uv
|
|
37
|
+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
38
|
+
with:
|
|
39
|
+
version: "0.10.1"
|
|
40
|
+
|
|
41
|
+
- name: Set up Python
|
|
42
|
+
env:
|
|
43
|
+
PYTHON_VERSION: ${{ matrix.python-version }}
|
|
44
|
+
run: uv python install "$PYTHON_VERSION"
|
|
45
|
+
|
|
46
|
+
- name: Remove unreleased local source override
|
|
47
|
+
run: uv lock --no-sources
|
|
48
|
+
|
|
49
|
+
- name: Install locked dependencies
|
|
50
|
+
env:
|
|
51
|
+
PYTHON_VERSION: ${{ matrix.python-version }}
|
|
52
|
+
run: uv sync --locked --no-sources --extra dev --python "$PYTHON_VERSION"
|
|
53
|
+
|
|
54
|
+
- name: Run Ruff
|
|
55
|
+
run: uv run --no-sync ruff check src tests
|
|
56
|
+
|
|
57
|
+
- name: Run tests
|
|
58
|
+
run: uv run --no-sync python -m pytest
|
|
59
|
+
|
|
60
|
+
- name: Compile package
|
|
61
|
+
run: uv run --no-sync python -m compileall src/dl_robotics
|
|
62
|
+
|
|
63
|
+
- name: Build distribution artifacts
|
|
64
|
+
run: uv build --no-sources
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: Publish TestPyPI
|
|
2
|
+
# TestPyPI setup required before first use:
|
|
3
|
+
# 1. Create a pending Trusted Publisher for:
|
|
4
|
+
# - owner: Blazkowiz47
|
|
5
|
+
# - repository: dl-robotics
|
|
6
|
+
# - workflow: publish-testpypi.yml
|
|
7
|
+
# - environment: dl-robotics
|
|
8
|
+
# - project: deep-learning-robotics
|
|
9
|
+
# 2. Create the `dl-robotics` GitHub environment if you want approval gates.
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions: {}
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: publish-testpypi
|
|
21
|
+
cancel-in-progress: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build:
|
|
25
|
+
name: Build Distribution
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- name: Check out repository
|
|
32
|
+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
|
|
36
|
+
- name: Set up uv
|
|
37
|
+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
38
|
+
with:
|
|
39
|
+
version: "0.10.1"
|
|
40
|
+
|
|
41
|
+
- name: Set up Python
|
|
42
|
+
run: uv python install 3.11
|
|
43
|
+
|
|
44
|
+
- name: Remove unreleased local source override
|
|
45
|
+
run: uv lock --no-sources
|
|
46
|
+
|
|
47
|
+
- name: Install locked dependencies
|
|
48
|
+
run: uv sync --locked --no-sources --extra dev --python 3.11
|
|
49
|
+
|
|
50
|
+
- name: Run Ruff and tests
|
|
51
|
+
run: |
|
|
52
|
+
uv run --no-sync ruff check src tests
|
|
53
|
+
uv run --no-sync python -m pytest
|
|
54
|
+
|
|
55
|
+
- name: Build and check distributions
|
|
56
|
+
run: |
|
|
57
|
+
rm -rf dist
|
|
58
|
+
uv build --no-sources
|
|
59
|
+
uv run --no-sync twine check dist/*
|
|
60
|
+
|
|
61
|
+
- name: Upload distribution artifacts
|
|
62
|
+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
|
63
|
+
with:
|
|
64
|
+
name: python-package-distributions-testpypi
|
|
65
|
+
path: dist/
|
|
66
|
+
if-no-files-found: error
|
|
67
|
+
retention-days: 7
|
|
68
|
+
|
|
69
|
+
publish:
|
|
70
|
+
name: Publish To TestPyPI
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
needs: build
|
|
73
|
+
permissions:
|
|
74
|
+
id-token: write # Required for OIDC trusted publishing; no API token is used.
|
|
75
|
+
environment:
|
|
76
|
+
name: dl-robotics
|
|
77
|
+
url: https://test.pypi.org/p/deep-learning-robotics
|
|
78
|
+
|
|
79
|
+
steps:
|
|
80
|
+
- name: Download distribution artifacts
|
|
81
|
+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
|
|
82
|
+
with:
|
|
83
|
+
name: python-package-distributions-testpypi
|
|
84
|
+
path: dist/
|
|
85
|
+
|
|
86
|
+
- name: Publish distribution to TestPyPI
|
|
87
|
+
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # release/v1
|
|
88
|
+
with:
|
|
89
|
+
repository-url: https://test.pypi.org/legacy/
|
|
90
|
+
verbose: true
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
# PyPI setup required before first use:
|
|
3
|
+
# 1. Create a pending Trusted Publisher for:
|
|
4
|
+
# - owner: Blazkowiz47
|
|
5
|
+
# - repository: dl-robotics
|
|
6
|
+
# - workflow: publish.yml
|
|
7
|
+
# - environment: dl-robotics
|
|
8
|
+
# - project: deep-learning-robotics
|
|
9
|
+
# 2. Create the `dl-robotics` GitHub environment if you want approval gates.
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
permissions: {}
|
|
18
|
+
|
|
19
|
+
concurrency:
|
|
20
|
+
group: publish-pypi
|
|
21
|
+
cancel-in-progress: false
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
build:
|
|
25
|
+
name: Build Distribution
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
contents: read
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- name: Check out repository
|
|
32
|
+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
|
|
36
|
+
- name: Set up uv
|
|
37
|
+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
38
|
+
with:
|
|
39
|
+
version: "0.10.1"
|
|
40
|
+
|
|
41
|
+
- name: Set up Python
|
|
42
|
+
run: uv python install 3.11
|
|
43
|
+
|
|
44
|
+
- name: Remove unreleased local source override
|
|
45
|
+
run: uv lock --no-sources
|
|
46
|
+
|
|
47
|
+
- name: Install locked dependencies
|
|
48
|
+
run: uv sync --locked --no-sources --extra dev --python 3.11
|
|
49
|
+
|
|
50
|
+
- name: Run Ruff and tests
|
|
51
|
+
run: |
|
|
52
|
+
uv run --no-sync ruff check src tests
|
|
53
|
+
uv run --no-sync python -m pytest
|
|
54
|
+
|
|
55
|
+
- name: Build and check distributions
|
|
56
|
+
run: |
|
|
57
|
+
rm -rf dist
|
|
58
|
+
uv build --no-sources
|
|
59
|
+
uv run --no-sync twine check dist/*
|
|
60
|
+
|
|
61
|
+
- name: Upload distribution artifacts
|
|
62
|
+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
|
63
|
+
with:
|
|
64
|
+
name: python-package-distributions
|
|
65
|
+
path: dist/
|
|
66
|
+
if-no-files-found: error
|
|
67
|
+
retention-days: 7
|
|
68
|
+
|
|
69
|
+
publish:
|
|
70
|
+
name: Publish To PyPI
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
needs: build
|
|
73
|
+
permissions:
|
|
74
|
+
id-token: write # Required for OIDC trusted publishing; no API token is used.
|
|
75
|
+
environment:
|
|
76
|
+
name: dl-robotics
|
|
77
|
+
url: https://pypi.org/p/deep-learning-robotics
|
|
78
|
+
|
|
79
|
+
steps:
|
|
80
|
+
- name: Download distribution artifacts
|
|
81
|
+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6
|
|
82
|
+
with:
|
|
83
|
+
name: python-package-distributions
|
|
84
|
+
path: dist/
|
|
85
|
+
|
|
86
|
+
- name: Publish distribution to PyPI
|
|
87
|
+
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # release/v1
|
|
88
|
+
with:
|
|
89
|
+
verbose: true
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 blazkowiz47
|
|
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.
|
|
22
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deep-learning-robotics
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Fast 2D robotics and MAPF environments for deep-learning-core.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Blazkowiz47/dl-robotics
|
|
6
|
+
Project-URL: Repository, https://github.com/Blazkowiz47/dl-robotics
|
|
7
|
+
Project-URL: Issues, https://github.com/Blazkowiz47/dl-robotics/issues
|
|
8
|
+
Author-email: blazkowiz47 <sushrutpatwardhan@gmail.com>
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 blazkowiz47
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: deep-reinforcement-learning,mapf,path-finding,robotics
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
41
|
+
Classifier: Typing :: Typed
|
|
42
|
+
Requires-Python: >=3.10
|
|
43
|
+
Requires-Dist: deep-learning-core<0.1,>=0.0.27
|
|
44
|
+
Requires-Dist: gymnasium<2,>=1.3
|
|
45
|
+
Requires-Dist: imageio-ffmpeg>=0.5
|
|
46
|
+
Requires-Dist: imageio>=2.34
|
|
47
|
+
Requires-Dist: numpy
|
|
48
|
+
Requires-Dist: opencv-python-headless
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
51
|
+
Requires-Dist: ruff>=0.12; extra == 'dev'
|
|
52
|
+
Requires-Dist: twine>=6.0; extra == 'dev'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# deep-learning-robotics
|
|
56
|
+
|
|
57
|
+
Fast, reproducible 2D robotics environments for
|
|
58
|
+
[`deep-learning-core`](https://github.com/Blazkowiz47/dl-core).
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install deep-learning-robotics
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Version `0.0.1` requires `deep-learning-core>=0.0.27,<0.1`.
|
|
67
|
+
|
|
68
|
+
## What's New in 0.0.1?
|
|
69
|
+
|
|
70
|
+
- validated grid scenarios with walls, actor starts, and per-actor goals
|
|
71
|
+
- preallocated batched world state for position, velocity, acceleration,
|
|
72
|
+
reached goals, path length, makespan, and sum of costs
|
|
73
|
+
- simultaneous exclusive-cell physics covering boundaries, walls, vertex
|
|
74
|
+
conflicts, edge swaps, and moves into stationary actors
|
|
75
|
+
- scalar and native vector Gymnasium environments registered as
|
|
76
|
+
`robotics_mapf` and `robotics_mapf_vector`
|
|
77
|
+
- centralized joint actions compatible with dl-core DQN and PPO
|
|
78
|
+
- semantic channel observations containing walls, actors, goals, velocity, and
|
|
79
|
+
acceleration
|
|
80
|
+
- headless RGB rendering plus direct GIF and MP4 episode output
|
|
81
|
+
- exact A*, Dijkstra, and BFS utilities for static single-agent shortest paths,
|
|
82
|
+
plus deterministic DFS for reachability and debugging
|
|
83
|
+
- a `robotics` episode manager for collision, completion, makespan,
|
|
84
|
+
sum-of-costs, path-length, trajectory, and media artifacts
|
|
85
|
+
|
|
86
|
+
## Environment Configuration
|
|
87
|
+
|
|
88
|
+
Import `dl_robotics` once to register its environments, then use normal
|
|
89
|
+
dl-core configuration:
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
environment:
|
|
93
|
+
name: robotics_mapf_vector
|
|
94
|
+
num_envs: 16
|
|
95
|
+
scenario:
|
|
96
|
+
name: crossing
|
|
97
|
+
width: 7
|
|
98
|
+
height: 7
|
|
99
|
+
max_steps: 40
|
|
100
|
+
walls: [[3, 1], [3, 5]]
|
|
101
|
+
starts: [[1, 1], [5, 5]]
|
|
102
|
+
goals: [[5, 5], [1, 1]]
|
|
103
|
+
rewards:
|
|
104
|
+
step: -0.01
|
|
105
|
+
progress: 0.1
|
|
106
|
+
collision: -0.25
|
|
107
|
+
goal: 1.0
|
|
108
|
+
success: 5.0
|
|
109
|
+
render:
|
|
110
|
+
cell_size: 48
|
|
111
|
+
show_grid: true
|
|
112
|
+
|
|
113
|
+
episode_managers:
|
|
114
|
+
robotics:
|
|
115
|
+
capture_phases: [evaluation]
|
|
116
|
+
capture_every_n_episodes: 1
|
|
117
|
+
max_captured_episodes: 20
|
|
118
|
+
media_format: both
|
|
119
|
+
fps: 8
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Each actor chooses one of `stay`, `up`, `right`, `down`, or `left`. The
|
|
123
|
+
centralized environment encodes all actor choices into one
|
|
124
|
+
`Discrete(5 ** num_agents)` joint action, with actor zero stored in the least
|
|
125
|
+
significant base-5 digit. This is intentionally aimed at small cooperative
|
|
126
|
+
MAPF problems; larger or decentralized systems should use a future multi-agent
|
|
127
|
+
policy API instead of an exponentially growing joint action.
|
|
128
|
+
|
|
129
|
+
The image observation is suitable for DQN and PPO. dl-core's tabular
|
|
130
|
+
Q-learning trainer requires a `Discrete` observation space, so it is not
|
|
131
|
+
compatible with this first image-observation environment.
|
|
132
|
+
|
|
133
|
+
The observation is a float32 tensor with shape `[7, height, width]`: walls,
|
|
134
|
+
actor identity, goal identity, row/column velocity, and row/column acceleration.
|
|
135
|
+
Episode info exposes `is_success`, collision counts, reached agents, makespan,
|
|
136
|
+
sum of costs, and total path length for episode managers and experiment
|
|
137
|
+
tracking. `collisions` and its typed variants describe the latest step;
|
|
138
|
+
`episode_collisions` and its typed variants retain the episode totals.
|
|
139
|
+
|
|
140
|
+
## Rendering and Episode Artifacts
|
|
141
|
+
|
|
142
|
+
`environment.render()` returns RGB `uint8` arrays without opening a display:
|
|
143
|
+
`[height, width, 3]` for the scalar environment and
|
|
144
|
+
`[num_envs, height, width, 3]` for the vector environment.
|
|
145
|
+
|
|
146
|
+
The `robotics` episode manager includes dl-core's standard episode metrics and
|
|
147
|
+
trajectory capture, so it should be used in place of the `standard` manager.
|
|
148
|
+
For selected phases and episode intervals it stores the complete compressed
|
|
149
|
+
trajectory and optionally a GIF, MP4, or both. It also emits
|
|
150
|
+
`robotics/collisions`, typed collision counts, reached fraction, makespan,
|
|
151
|
+
sum of costs, and path length through normal callback and tracker flows.
|
|
152
|
+
|
|
153
|
+
Media files can also be created directly:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from dl_robotics import write_animation
|
|
157
|
+
|
|
158
|
+
write_animation("episode.gif", frames, fps=8)
|
|
159
|
+
write_animation("episode.mp4", frames, fps=8)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Interaction Rules
|
|
163
|
+
|
|
164
|
+
`GridWorldBatch` owns numerical state, while `InteractionRule` owns how proposed
|
|
165
|
+
movements interact. `ExclusiveCellRule` provides MAPF-safe defaults. A custom
|
|
166
|
+
rule instance can be supplied as `environment.interaction_rule` when an
|
|
167
|
+
environment is created programmatically, without changing scenario definitions
|
|
168
|
+
or RL adapters. Serializable rule registries are planned for a later release.
|
|
169
|
+
|
|
170
|
+
The first version uses vectorized geometry and preallocated state arrays, with
|
|
171
|
+
small per-world conflict-resolution loops where agent dependencies require
|
|
172
|
+
them. It does not model continuous rigid-body dynamics, ROS, Gazebo, or 3D
|
|
173
|
+
simulation.
|
|
174
|
+
|
|
175
|
+
## Shortest-Path Baselines
|
|
176
|
+
|
|
177
|
+
Use A* for efficient exact planning on the unit-cost grid, or Dijkstra when a
|
|
178
|
+
heuristic-free reference is useful:
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from dl_robotics import (
|
|
182
|
+
GridScenario,
|
|
183
|
+
astar_path,
|
|
184
|
+
bfs_path,
|
|
185
|
+
dfs_path,
|
|
186
|
+
dijkstra_path,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
scenario = GridScenario(
|
|
190
|
+
width=5,
|
|
191
|
+
height=5,
|
|
192
|
+
starts=((0, 0), (4, 4)),
|
|
193
|
+
goals=((4, 4), (0, 0)),
|
|
194
|
+
walls=((1, 2), (3, 2)),
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
astar = astar_path(scenario, scenario.starts[0], scenario.goals[0])
|
|
198
|
+
dijkstra = dijkstra_path(scenario, scenario.starts[1], scenario.goals[1])
|
|
199
|
+
bfs = bfs_path(scenario, scenario.starts[0], scenario.goals[0])
|
|
200
|
+
dfs = dfs_path(scenario, scenario.starts[1], scenario.goals[1])
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Paths include both endpoints and use four-direction movement around static
|
|
204
|
+
walls. Their move count is therefore `len(path) - 1`. A*, Dijkstra, and BFS
|
|
205
|
+
return shortest paths on this unweighted grid. DFS returns the first
|
|
206
|
+
depth-first route and does not guarantee optimality. Traversal ties use the
|
|
207
|
+
fixed up, right, down, left order. The exact planners provide per-agent lower
|
|
208
|
+
bounds and deterministic evaluation baselines; independently planned paths can
|
|
209
|
+
still have vertex or edge conflicts and are not, by themselves, a multi-agent
|
|
210
|
+
path-finding solver.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# deep-learning-robotics
|
|
2
|
+
|
|
3
|
+
Fast, reproducible 2D robotics environments for
|
|
4
|
+
[`deep-learning-core`](https://github.com/Blazkowiz47/dl-core).
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install deep-learning-robotics
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Version `0.0.1` requires `deep-learning-core>=0.0.27,<0.1`.
|
|
13
|
+
|
|
14
|
+
## What's New in 0.0.1?
|
|
15
|
+
|
|
16
|
+
- validated grid scenarios with walls, actor starts, and per-actor goals
|
|
17
|
+
- preallocated batched world state for position, velocity, acceleration,
|
|
18
|
+
reached goals, path length, makespan, and sum of costs
|
|
19
|
+
- simultaneous exclusive-cell physics covering boundaries, walls, vertex
|
|
20
|
+
conflicts, edge swaps, and moves into stationary actors
|
|
21
|
+
- scalar and native vector Gymnasium environments registered as
|
|
22
|
+
`robotics_mapf` and `robotics_mapf_vector`
|
|
23
|
+
- centralized joint actions compatible with dl-core DQN and PPO
|
|
24
|
+
- semantic channel observations containing walls, actors, goals, velocity, and
|
|
25
|
+
acceleration
|
|
26
|
+
- headless RGB rendering plus direct GIF and MP4 episode output
|
|
27
|
+
- exact A*, Dijkstra, and BFS utilities for static single-agent shortest paths,
|
|
28
|
+
plus deterministic DFS for reachability and debugging
|
|
29
|
+
- a `robotics` episode manager for collision, completion, makespan,
|
|
30
|
+
sum-of-costs, path-length, trajectory, and media artifacts
|
|
31
|
+
|
|
32
|
+
## Environment Configuration
|
|
33
|
+
|
|
34
|
+
Import `dl_robotics` once to register its environments, then use normal
|
|
35
|
+
dl-core configuration:
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
environment:
|
|
39
|
+
name: robotics_mapf_vector
|
|
40
|
+
num_envs: 16
|
|
41
|
+
scenario:
|
|
42
|
+
name: crossing
|
|
43
|
+
width: 7
|
|
44
|
+
height: 7
|
|
45
|
+
max_steps: 40
|
|
46
|
+
walls: [[3, 1], [3, 5]]
|
|
47
|
+
starts: [[1, 1], [5, 5]]
|
|
48
|
+
goals: [[5, 5], [1, 1]]
|
|
49
|
+
rewards:
|
|
50
|
+
step: -0.01
|
|
51
|
+
progress: 0.1
|
|
52
|
+
collision: -0.25
|
|
53
|
+
goal: 1.0
|
|
54
|
+
success: 5.0
|
|
55
|
+
render:
|
|
56
|
+
cell_size: 48
|
|
57
|
+
show_grid: true
|
|
58
|
+
|
|
59
|
+
episode_managers:
|
|
60
|
+
robotics:
|
|
61
|
+
capture_phases: [evaluation]
|
|
62
|
+
capture_every_n_episodes: 1
|
|
63
|
+
max_captured_episodes: 20
|
|
64
|
+
media_format: both
|
|
65
|
+
fps: 8
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Each actor chooses one of `stay`, `up`, `right`, `down`, or `left`. The
|
|
69
|
+
centralized environment encodes all actor choices into one
|
|
70
|
+
`Discrete(5 ** num_agents)` joint action, with actor zero stored in the least
|
|
71
|
+
significant base-5 digit. This is intentionally aimed at small cooperative
|
|
72
|
+
MAPF problems; larger or decentralized systems should use a future multi-agent
|
|
73
|
+
policy API instead of an exponentially growing joint action.
|
|
74
|
+
|
|
75
|
+
The image observation is suitable for DQN and PPO. dl-core's tabular
|
|
76
|
+
Q-learning trainer requires a `Discrete` observation space, so it is not
|
|
77
|
+
compatible with this first image-observation environment.
|
|
78
|
+
|
|
79
|
+
The observation is a float32 tensor with shape `[7, height, width]`: walls,
|
|
80
|
+
actor identity, goal identity, row/column velocity, and row/column acceleration.
|
|
81
|
+
Episode info exposes `is_success`, collision counts, reached agents, makespan,
|
|
82
|
+
sum of costs, and total path length for episode managers and experiment
|
|
83
|
+
tracking. `collisions` and its typed variants describe the latest step;
|
|
84
|
+
`episode_collisions` and its typed variants retain the episode totals.
|
|
85
|
+
|
|
86
|
+
## Rendering and Episode Artifacts
|
|
87
|
+
|
|
88
|
+
`environment.render()` returns RGB `uint8` arrays without opening a display:
|
|
89
|
+
`[height, width, 3]` for the scalar environment and
|
|
90
|
+
`[num_envs, height, width, 3]` for the vector environment.
|
|
91
|
+
|
|
92
|
+
The `robotics` episode manager includes dl-core's standard episode metrics and
|
|
93
|
+
trajectory capture, so it should be used in place of the `standard` manager.
|
|
94
|
+
For selected phases and episode intervals it stores the complete compressed
|
|
95
|
+
trajectory and optionally a GIF, MP4, or both. It also emits
|
|
96
|
+
`robotics/collisions`, typed collision counts, reached fraction, makespan,
|
|
97
|
+
sum of costs, and path length through normal callback and tracker flows.
|
|
98
|
+
|
|
99
|
+
Media files can also be created directly:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from dl_robotics import write_animation
|
|
103
|
+
|
|
104
|
+
write_animation("episode.gif", frames, fps=8)
|
|
105
|
+
write_animation("episode.mp4", frames, fps=8)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Interaction Rules
|
|
109
|
+
|
|
110
|
+
`GridWorldBatch` owns numerical state, while `InteractionRule` owns how proposed
|
|
111
|
+
movements interact. `ExclusiveCellRule` provides MAPF-safe defaults. A custom
|
|
112
|
+
rule instance can be supplied as `environment.interaction_rule` when an
|
|
113
|
+
environment is created programmatically, without changing scenario definitions
|
|
114
|
+
or RL adapters. Serializable rule registries are planned for a later release.
|
|
115
|
+
|
|
116
|
+
The first version uses vectorized geometry and preallocated state arrays, with
|
|
117
|
+
small per-world conflict-resolution loops where agent dependencies require
|
|
118
|
+
them. It does not model continuous rigid-body dynamics, ROS, Gazebo, or 3D
|
|
119
|
+
simulation.
|
|
120
|
+
|
|
121
|
+
## Shortest-Path Baselines
|
|
122
|
+
|
|
123
|
+
Use A* for efficient exact planning on the unit-cost grid, or Dijkstra when a
|
|
124
|
+
heuristic-free reference is useful:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from dl_robotics import (
|
|
128
|
+
GridScenario,
|
|
129
|
+
astar_path,
|
|
130
|
+
bfs_path,
|
|
131
|
+
dfs_path,
|
|
132
|
+
dijkstra_path,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
scenario = GridScenario(
|
|
136
|
+
width=5,
|
|
137
|
+
height=5,
|
|
138
|
+
starts=((0, 0), (4, 4)),
|
|
139
|
+
goals=((4, 4), (0, 0)),
|
|
140
|
+
walls=((1, 2), (3, 2)),
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
astar = astar_path(scenario, scenario.starts[0], scenario.goals[0])
|
|
144
|
+
dijkstra = dijkstra_path(scenario, scenario.starts[1], scenario.goals[1])
|
|
145
|
+
bfs = bfs_path(scenario, scenario.starts[0], scenario.goals[0])
|
|
146
|
+
dfs = dfs_path(scenario, scenario.starts[1], scenario.goals[1])
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Paths include both endpoints and use four-direction movement around static
|
|
150
|
+
walls. Their move count is therefore `len(path) - 1`. A*, Dijkstra, and BFS
|
|
151
|
+
return shortest paths on this unweighted grid. DFS returns the first
|
|
152
|
+
depth-first route and does not guarantee optimality. Traversal ties use the
|
|
153
|
+
fixed up, right, down, left order. The exact planners provide per-agent lower
|
|
154
|
+
bounds and deterministic evaluation baselines; independently planned paths can
|
|
155
|
+
still have vertex or edge conflicts and are not, by themselves, a multi-agent
|
|
156
|
+
path-finding solver.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "deep-learning-robotics"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "Fast 2D robotics and MAPF environments for deep-learning-core."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "blazkowiz47", email = "sushrutpatwardhan@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"deep-reinforcement-learning",
|
|
17
|
+
"mapf",
|
|
18
|
+
"path-finding",
|
|
19
|
+
"robotics",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 3 - Alpha",
|
|
23
|
+
"Intended Audience :: Science/Research",
|
|
24
|
+
"License :: OSI Approved :: MIT License",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
30
|
+
"Typing :: Typed",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
"deep-learning-core>=0.0.27,<0.1",
|
|
34
|
+
"gymnasium>=1.3,<2",
|
|
35
|
+
"imageio>=2.34",
|
|
36
|
+
"imageio-ffmpeg>=0.5",
|
|
37
|
+
"numpy",
|
|
38
|
+
"opencv-python-headless",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=8.0",
|
|
44
|
+
"ruff>=0.12",
|
|
45
|
+
"twine>=6.0",
|
|
46
|
+
]
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://github.com/Blazkowiz47/dl-robotics"
|
|
49
|
+
Repository = "https://github.com/Blazkowiz47/dl-robotics"
|
|
50
|
+
Issues = "https://github.com/Blazkowiz47/dl-robotics/issues"
|
|
51
|
+
|
|
52
|
+
[tool.hatch.build.targets.wheel]
|
|
53
|
+
packages = ["src/dl_robotics"]
|
|
54
|
+
|
|
55
|
+
[tool.uv.sources]
|
|
56
|
+
deep-learning-core = { path = "../dl-core", editable = true }
|