unienv 0.0.1b2__tar.gz → 0.0.1b3__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.
- {unienv-0.0.1b2 → unienv-0.0.1b3}/LICENSE +1 -3
- unienv-0.0.1b3/PKG-INFO +74 -0
- unienv-0.0.1b3/README.md +49 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/pyproject.toml +9 -15
- unienv-0.0.1b3/unienv.egg-info/PKG-INFO +74 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv.egg-info/SOURCES.txt +14 -7
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv.egg-info/requires.txt +1 -7
- unienv-0.0.1b3/unienv.egg-info/top_level.txt +3 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/base/__init__.py +0 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/base/common.py +95 -45
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/base/storage.py +1 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/batches/__init__.py +2 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/batches/backend_compat.py +47 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/batches/combined_batch.py +2 -4
- {unienv-0.0.1b2/unienv_data/base → unienv-0.0.1b3/unienv_data/batches}/transformations.py +3 -2
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/replay_buffer/replay_buffer.py +4 -0
- unienv-0.0.1b3/unienv_data/samplers/__init__.py +2 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/samplers/multiprocessing_sampler.py +26 -22
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/samplers/step_sampler.py +9 -18
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/storages/common.py +5 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/storages/hdf5.py +291 -20
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/storages/pytorch.py +1 -0
- unienv-0.0.1b3/unienv_data/storages/transformation.py +191 -0
- unienv-0.0.1b3/unienv_data/transformations/image_compress.py +213 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/backends/jax.py +4 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/backends/numpy.py +4 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/backends/pytorch.py +4 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/env_base/__init__.py +1 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/env_base/env.py +5 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/env_base/funcenv.py +32 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/env_base/funcenv_wrapper.py +2 -2
- unienv-0.0.1b3/unienv_interface/env_base/vec_env.py +474 -0
- unienv-0.0.1b3/unienv_interface/func_wrapper/__init__.py +2 -0
- unienv-0.0.1b3/unienv_interface/func_wrapper/frame_stack.py +150 -0
- unienv-0.0.1b3/unienv_interface/space/space_utils/__init__.py +4 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/space_utils/batch_utils.py +83 -0
- unienv-0.0.1b3/unienv_interface/space/space_utils/construct_utils.py +216 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/space_utils/serialization_utils.py +16 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/__init__.py +3 -1
- unienv-0.0.1b3/unienv_interface/space/spaces/batched.py +90 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/binary.py +0 -1
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/box.py +13 -24
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/text.py +1 -3
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/transformations/dict_transform.py +31 -5
- unienv-0.0.1b3/unienv_interface/utils/control_util.py +68 -0
- unienv-0.0.1b3/unienv_interface/utils/data_queue.py +184 -0
- unienv-0.0.1b3/unienv_interface/utils/stateclass.py +46 -0
- unienv-0.0.1b3/unienv_interface/utils/vec_util.py +15 -0
- unienv-0.0.1b3/unienv_interface/world/__init__.py +6 -0
- unienv-0.0.1b3/unienv_interface/world/combined_funcnode.py +336 -0
- unienv-0.0.1b3/unienv_interface/world/combined_node.py +232 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/backend_compat.py +2 -2
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/frame_stack.py +19 -114
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/video_record.py +11 -2
- unienv-0.0.1b2/PKG-INFO +0 -73
- unienv-0.0.1b2/README.md +0 -44
- unienv-0.0.1b2/unienv.egg-info/PKG-INFO +0 -73
- unienv-0.0.1b2/unienv.egg-info/top_level.txt +0 -6
- unienv-0.0.1b2/unienv_data/samplers/__init__.py +0 -3
- unienv-0.0.1b2/unienv_data/samplers/slice_sampler.py +0 -266
- unienv-0.0.1b2/unienv_interface/func_wrapper/__init__.py +0 -1
- unienv-0.0.1b2/unienv_interface/space/space_utils/__init__.py +0 -3
- unienv-0.0.1b2/unienv_interface/world/__init__.py +0 -4
- unienv-0.0.1b2/unienv_maniskill/__init__.py +0 -1
- unienv-0.0.1b2/unienv_maniskill/wrapper/maniskill_compat.py +0 -235
- unienv-0.0.1b2/unienv_mjxplayground/__init__.py +0 -1
- unienv-0.0.1b2/unienv_mjxplayground/wrapper/playground_compat.py +0 -256
- {unienv-0.0.1b2 → unienv-0.0.1b3}/setup.cfg +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv.egg-info/dependency_links.txt +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/batches/framestack_batch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/batches/slicestack_batch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/integrations/pytorch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/replay_buffer/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_data/replay_buffer/trajectory_replay_buffer.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/backends/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/backends/base.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/backends/serialization.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/env_base/wrapper.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/func_wrapper/transformation.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/space.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/space_utils/flatten_utils.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/space_utils/gym_utils.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/dict.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/dynamic_box.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/graph.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/tuple.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/space/spaces/union.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/transformations/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/transformations/batch_and_unbatch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/transformations/chained_transform.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/transformations/filter_dict.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/transformations/rescale.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/transformations/transformation.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/utils/seed_util.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/utils/symbol_util.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/world/funcnode.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/world/funcworld.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/world/node.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/world/world.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/__init__.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/action_rescale.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/batch_and_unbatch.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/control_frequency_limit.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/flatten.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/gym_compat.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/time_limit.py +0 -0
- {unienv-0.0.1b2 → unienv-0.0.1b3}/unienv_interface/wrapper/transformation.py +0 -0
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
4
|
-
Copyright (c) 2022 Farama Foundation
|
|
5
|
-
Copyright (c) 2024 Yunhao Cao
|
|
3
|
+
Copyright (c) 2025 Yunhao Cao and UniEnv Contributors
|
|
6
4
|
|
|
7
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
6
|
of this software and associated documentation files (the "Software"), to deal
|
unienv-0.0.1b3/PKG-INFO
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unienv
|
|
3
|
+
Version: 0.0.1b3
|
|
4
|
+
Summary: Unified robot environment framework supporting multiple tensor and simulation backends
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/UniEnvOrg/UniEnv
|
|
7
|
+
Project-URL: Documentation, https://github.com/UniEnvOrg/UniEnv
|
|
8
|
+
Project-URL: Repository, https://github.com/UniEnvOrg/UniEnv
|
|
9
|
+
Project-URL: Issues, https://github.com/UniEnvOrg/UniEnv/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/UniEnvOrg/UniEnv/blob/main/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: xbarray>=0.0.1a8
|
|
16
|
+
Requires-Dist: pillow
|
|
17
|
+
Requires-Dist: cloudpickle
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
|
+
Provides-Extra: gymnasium
|
|
21
|
+
Requires-Dist: gymnasium>=0.29.0; extra == "gymnasium"
|
|
22
|
+
Provides-Extra: video
|
|
23
|
+
Requires-Dist: moviepy>=2.1; extra == "video"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# UniEnv
|
|
27
|
+
|
|
28
|
+
Framework unifying robot environments and data APIs. UniEnv provides an universal interface for robot actors, sensors, environments, and data.
|
|
29
|
+
|
|
30
|
+
## Tensor library cross-backend Support
|
|
31
|
+
|
|
32
|
+
UniEnv supports multiple tensor backends with zero-copy translation layers through the DLPack protocol, and allows you to use the same abstract compute backend interface to write custom data transformation layers, environment wrappers and other utilities. This is powered by the [XBArray](https://github.com/UniEnvOrg/XBArray) package.
|
|
33
|
+
|
|
34
|
+
## Universal Robot Environment Interface
|
|
35
|
+
|
|
36
|
+
UniEnv supports diverse simulation environments and real robots, built on top of the abstract environment / world interface. This allows you to reuse code across different sim and real robots.
|
|
37
|
+
|
|
38
|
+
## Universal Robot Data Interface
|
|
39
|
+
|
|
40
|
+
UniEnv provides a universal data interface for accessing robot data through the abstract `BatchBase` interface. We also provide a utility `ReplayBuffer` for saving data from various environments with diverse data format support, including `hdf5`, memory-mapped torch tensors, and others.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Install the package with pip
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install unienv
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can install optional dependencies such as `gymnasium` (for Gymnasium-compatible environments), `dev`, or `video` by running
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install unienv[gymnasium,video]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Cite
|
|
57
|
+
|
|
58
|
+
If you use UniEnv in your research, please cite it as follows:
|
|
59
|
+
|
|
60
|
+
```bibtex
|
|
61
|
+
@software{cao_unienv,
|
|
62
|
+
author = {Cao, Yunhao AND Fang, Kuan},
|
|
63
|
+
title = {{UniEnv: Unifying Robot Environments and Data APIs}},
|
|
64
|
+
year = {2025},
|
|
65
|
+
month = oct,
|
|
66
|
+
url = {https://github.com/UniEnvOrg/UniEnv},
|
|
67
|
+
license = {MIT}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Acknowledgements
|
|
72
|
+
|
|
73
|
+
The idea of this project is inspired by [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) and its predecessor [OpenAI Gym](https://github.com/openai/gym).
|
|
74
|
+
This library is impossible without the great work of DataAPIs Consortium and their work on the [Array API Standard](https://data-apis.org/array-api/latest/). The zero-copy translation layers are powered by the [DLPack](https://github.com/dmlc/dlpack) project.
|
unienv-0.0.1b3/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# UniEnv
|
|
2
|
+
|
|
3
|
+
Framework unifying robot environments and data APIs. UniEnv provides an universal interface for robot actors, sensors, environments, and data.
|
|
4
|
+
|
|
5
|
+
## Tensor library cross-backend Support
|
|
6
|
+
|
|
7
|
+
UniEnv supports multiple tensor backends with zero-copy translation layers through the DLPack protocol, and allows you to use the same abstract compute backend interface to write custom data transformation layers, environment wrappers and other utilities. This is powered by the [XBArray](https://github.com/UniEnvOrg/XBArray) package.
|
|
8
|
+
|
|
9
|
+
## Universal Robot Environment Interface
|
|
10
|
+
|
|
11
|
+
UniEnv supports diverse simulation environments and real robots, built on top of the abstract environment / world interface. This allows you to reuse code across different sim and real robots.
|
|
12
|
+
|
|
13
|
+
## Universal Robot Data Interface
|
|
14
|
+
|
|
15
|
+
UniEnv provides a universal data interface for accessing robot data through the abstract `BatchBase` interface. We also provide a utility `ReplayBuffer` for saving data from various environments with diverse data format support, including `hdf5`, memory-mapped torch tensors, and others.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install the package with pip
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install unienv
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
You can install optional dependencies such as `gymnasium` (for Gymnasium-compatible environments), `dev`, or `video` by running
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install unienv[gymnasium,video]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Cite
|
|
32
|
+
|
|
33
|
+
If you use UniEnv in your research, please cite it as follows:
|
|
34
|
+
|
|
35
|
+
```bibtex
|
|
36
|
+
@software{cao_unienv,
|
|
37
|
+
author = {Cao, Yunhao AND Fang, Kuan},
|
|
38
|
+
title = {{UniEnv: Unifying Robot Environments and Data APIs}},
|
|
39
|
+
year = {2025},
|
|
40
|
+
month = oct,
|
|
41
|
+
url = {https://github.com/UniEnvOrg/UniEnv},
|
|
42
|
+
license = {MIT}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Acknowledgements
|
|
47
|
+
|
|
48
|
+
The idea of this project is inspired by [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) and its predecessor [OpenAI Gym](https://github.com/openai/gym).
|
|
49
|
+
This library is impossible without the great work of DataAPIs Consortium and their work on the [Array API Standard](https://data-apis.org/array-api/latest/). The zero-copy translation layers are powered by the [DLPack](https://github.com/dmlc/dlpack) project.
|
|
@@ -3,22 +3,15 @@ name = "unienv"
|
|
|
3
3
|
description = "Unified robot environment framework supporting multiple tensor and simulation backends"
|
|
4
4
|
readme = "README.md"
|
|
5
5
|
license = "MIT"
|
|
6
|
-
version = "0.0.
|
|
6
|
+
version = "0.0.1b3"
|
|
7
7
|
requires-python = ">= 3.10"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"numpy",
|
|
10
10
|
"xbarray>=0.0.1a8",
|
|
11
11
|
"pillow",
|
|
12
|
-
"
|
|
12
|
+
"cloudpickle",
|
|
13
13
|
]
|
|
14
14
|
|
|
15
|
-
[project.urls]
|
|
16
|
-
Homepage = "https://www.quantumcookie.xyz/project/unienv/"
|
|
17
|
-
Documentation = "https://readthedocs.org"
|
|
18
|
-
Repository = "https://github.com/UniEnvOrg/UniEnvPy"
|
|
19
|
-
Issues = "https://github.com/UniEnvOrg/UniEnvPy/issues"
|
|
20
|
-
Changelog = "https://github.com/UniEnvOrg/UniEnvPy/blob/main/CHANGELOG.md"
|
|
21
|
-
|
|
22
15
|
[project.optional-dependencies]
|
|
23
16
|
dev = [
|
|
24
17
|
"pytest",
|
|
@@ -29,12 +22,13 @@ gymnasium = [
|
|
|
29
22
|
video = [
|
|
30
23
|
"moviepy>=2.1"
|
|
31
24
|
]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/UniEnvOrg/UniEnv"
|
|
28
|
+
Documentation = "https://github.com/UniEnvOrg/UniEnv"
|
|
29
|
+
Repository = "https://github.com/UniEnvOrg/UniEnv"
|
|
30
|
+
Issues = "https://github.com/UniEnvOrg/UniEnv/issues"
|
|
31
|
+
Changelog = "https://github.com/UniEnvOrg/UniEnv/blob/main/CHANGELOG.md"
|
|
38
32
|
|
|
39
33
|
[tool.setuptools.packages.find]
|
|
40
34
|
include = ["*"]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unienv
|
|
3
|
+
Version: 0.0.1b3
|
|
4
|
+
Summary: Unified robot environment framework supporting multiple tensor and simulation backends
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/UniEnvOrg/UniEnv
|
|
7
|
+
Project-URL: Documentation, https://github.com/UniEnvOrg/UniEnv
|
|
8
|
+
Project-URL: Repository, https://github.com/UniEnvOrg/UniEnv
|
|
9
|
+
Project-URL: Issues, https://github.com/UniEnvOrg/UniEnv/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/UniEnvOrg/UniEnv/blob/main/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: xbarray>=0.0.1a8
|
|
16
|
+
Requires-Dist: pillow
|
|
17
|
+
Requires-Dist: cloudpickle
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
|
+
Provides-Extra: gymnasium
|
|
21
|
+
Requires-Dist: gymnasium>=0.29.0; extra == "gymnasium"
|
|
22
|
+
Provides-Extra: video
|
|
23
|
+
Requires-Dist: moviepy>=2.1; extra == "video"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# UniEnv
|
|
27
|
+
|
|
28
|
+
Framework unifying robot environments and data APIs. UniEnv provides an universal interface for robot actors, sensors, environments, and data.
|
|
29
|
+
|
|
30
|
+
## Tensor library cross-backend Support
|
|
31
|
+
|
|
32
|
+
UniEnv supports multiple tensor backends with zero-copy translation layers through the DLPack protocol, and allows you to use the same abstract compute backend interface to write custom data transformation layers, environment wrappers and other utilities. This is powered by the [XBArray](https://github.com/UniEnvOrg/XBArray) package.
|
|
33
|
+
|
|
34
|
+
## Universal Robot Environment Interface
|
|
35
|
+
|
|
36
|
+
UniEnv supports diverse simulation environments and real robots, built on top of the abstract environment / world interface. This allows you to reuse code across different sim and real robots.
|
|
37
|
+
|
|
38
|
+
## Universal Robot Data Interface
|
|
39
|
+
|
|
40
|
+
UniEnv provides a universal data interface for accessing robot data through the abstract `BatchBase` interface. We also provide a utility `ReplayBuffer` for saving data from various environments with diverse data format support, including `hdf5`, memory-mapped torch tensors, and others.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
Install the package with pip
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install unienv
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can install optional dependencies such as `gymnasium` (for Gymnasium-compatible environments), `dev`, or `video` by running
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install unienv[gymnasium,video]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Cite
|
|
57
|
+
|
|
58
|
+
If you use UniEnv in your research, please cite it as follows:
|
|
59
|
+
|
|
60
|
+
```bibtex
|
|
61
|
+
@software{cao_unienv,
|
|
62
|
+
author = {Cao, Yunhao AND Fang, Kuan},
|
|
63
|
+
title = {{UniEnv: Unifying Robot Environments and Data APIs}},
|
|
64
|
+
year = {2025},
|
|
65
|
+
month = oct,
|
|
66
|
+
url = {https://github.com/UniEnvOrg/UniEnv},
|
|
67
|
+
license = {MIT}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Acknowledgements
|
|
72
|
+
|
|
73
|
+
The idea of this project is inspired by [Gymnasium](https://github.com/Farama-Foundation/Gymnasium) and its predecessor [OpenAI Gym](https://github.com/openai/gym).
|
|
74
|
+
This library is impossible without the great work of DataAPIs Consortium and their work on the [Array API Standard](https://data-apis.org/array-api/latest/). The zero-copy translation layers are powered by the [DLPack](https://github.com/dmlc/dlpack) project.
|
|
@@ -10,23 +10,24 @@ unienv_data/__init__.py
|
|
|
10
10
|
unienv_data/base/__init__.py
|
|
11
11
|
unienv_data/base/common.py
|
|
12
12
|
unienv_data/base/storage.py
|
|
13
|
-
unienv_data/base/transformations.py
|
|
14
13
|
unienv_data/batches/__init__.py
|
|
15
14
|
unienv_data/batches/backend_compat.py
|
|
16
15
|
unienv_data/batches/combined_batch.py
|
|
17
16
|
unienv_data/batches/framestack_batch.py
|
|
18
17
|
unienv_data/batches/slicestack_batch.py
|
|
18
|
+
unienv_data/batches/transformations.py
|
|
19
19
|
unienv_data/integrations/pytorch.py
|
|
20
20
|
unienv_data/replay_buffer/__init__.py
|
|
21
21
|
unienv_data/replay_buffer/replay_buffer.py
|
|
22
22
|
unienv_data/replay_buffer/trajectory_replay_buffer.py
|
|
23
23
|
unienv_data/samplers/__init__.py
|
|
24
24
|
unienv_data/samplers/multiprocessing_sampler.py
|
|
25
|
-
unienv_data/samplers/slice_sampler.py
|
|
26
25
|
unienv_data/samplers/step_sampler.py
|
|
27
26
|
unienv_data/storages/common.py
|
|
28
27
|
unienv_data/storages/hdf5.py
|
|
29
28
|
unienv_data/storages/pytorch.py
|
|
29
|
+
unienv_data/storages/transformation.py
|
|
30
|
+
unienv_data/transformations/image_compress.py
|
|
30
31
|
unienv_interface/__init__.py
|
|
31
32
|
unienv_interface/backends/__init__.py
|
|
32
33
|
unienv_interface/backends/base.py
|
|
@@ -38,17 +39,21 @@ unienv_interface/env_base/__init__.py
|
|
|
38
39
|
unienv_interface/env_base/env.py
|
|
39
40
|
unienv_interface/env_base/funcenv.py
|
|
40
41
|
unienv_interface/env_base/funcenv_wrapper.py
|
|
42
|
+
unienv_interface/env_base/vec_env.py
|
|
41
43
|
unienv_interface/env_base/wrapper.py
|
|
42
44
|
unienv_interface/func_wrapper/__init__.py
|
|
45
|
+
unienv_interface/func_wrapper/frame_stack.py
|
|
43
46
|
unienv_interface/func_wrapper/transformation.py
|
|
44
47
|
unienv_interface/space/__init__.py
|
|
45
48
|
unienv_interface/space/space.py
|
|
46
49
|
unienv_interface/space/space_utils/__init__.py
|
|
47
50
|
unienv_interface/space/space_utils/batch_utils.py
|
|
51
|
+
unienv_interface/space/space_utils/construct_utils.py
|
|
48
52
|
unienv_interface/space/space_utils/flatten_utils.py
|
|
49
53
|
unienv_interface/space/space_utils/gym_utils.py
|
|
50
54
|
unienv_interface/space/space_utils/serialization_utils.py
|
|
51
55
|
unienv_interface/space/spaces/__init__.py
|
|
56
|
+
unienv_interface/space/spaces/batched.py
|
|
52
57
|
unienv_interface/space/spaces/binary.py
|
|
53
58
|
unienv_interface/space/spaces/box.py
|
|
54
59
|
unienv_interface/space/spaces/dict.py
|
|
@@ -64,9 +69,15 @@ unienv_interface/transformations/dict_transform.py
|
|
|
64
69
|
unienv_interface/transformations/filter_dict.py
|
|
65
70
|
unienv_interface/transformations/rescale.py
|
|
66
71
|
unienv_interface/transformations/transformation.py
|
|
72
|
+
unienv_interface/utils/control_util.py
|
|
73
|
+
unienv_interface/utils/data_queue.py
|
|
67
74
|
unienv_interface/utils/seed_util.py
|
|
75
|
+
unienv_interface/utils/stateclass.py
|
|
68
76
|
unienv_interface/utils/symbol_util.py
|
|
77
|
+
unienv_interface/utils/vec_util.py
|
|
69
78
|
unienv_interface/world/__init__.py
|
|
79
|
+
unienv_interface/world/combined_funcnode.py
|
|
80
|
+
unienv_interface/world/combined_node.py
|
|
70
81
|
unienv_interface/world/funcnode.py
|
|
71
82
|
unienv_interface/world/funcworld.py
|
|
72
83
|
unienv_interface/world/node.py
|
|
@@ -81,8 +92,4 @@ unienv_interface/wrapper/frame_stack.py
|
|
|
81
92
|
unienv_interface/wrapper/gym_compat.py
|
|
82
93
|
unienv_interface/wrapper/time_limit.py
|
|
83
94
|
unienv_interface/wrapper/transformation.py
|
|
84
|
-
unienv_interface/wrapper/video_record.py
|
|
85
|
-
unienv_maniskill/__init__.py
|
|
86
|
-
unienv_maniskill/wrapper/maniskill_compat.py
|
|
87
|
-
unienv_mjxplayground/__init__.py
|
|
88
|
-
unienv_mjxplayground/wrapper/playground_compat.py
|
|
95
|
+
unienv_interface/wrapper/video_record.py
|
|
@@ -9,26 +9,44 @@ import dataclasses
|
|
|
9
9
|
|
|
10
10
|
from unienv_interface.space.space_utils import batch_utils as space_batch_utils, flatten_utils as space_flatten_utils
|
|
11
11
|
|
|
12
|
+
__all__ = [
|
|
13
|
+
"BatchT",
|
|
14
|
+
"BatchBase",
|
|
15
|
+
"BatchSampler",
|
|
16
|
+
"IndexableType",
|
|
17
|
+
"convert_index_to_backendarray",
|
|
18
|
+
]
|
|
19
|
+
|
|
12
20
|
IndexableType = Union[int, slice, EllipsisType]
|
|
13
21
|
|
|
22
|
+
def convert_index_to_backendarray(
|
|
23
|
+
backend : ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType],
|
|
24
|
+
index : IndexableType,
|
|
25
|
+
length : int,
|
|
26
|
+
device : Optional[BDeviceType] = None,
|
|
27
|
+
) -> BArrayType:
|
|
28
|
+
if isinstance(index, int):
|
|
29
|
+
return backend.asarray([index], dtype=backend.default_integer_dtype, device=device)
|
|
30
|
+
elif isinstance(index, slice):
|
|
31
|
+
return backend.arange(*index.indices(length), dtype=backend.default_integer_dtype, device=device)
|
|
32
|
+
elif index is Ellipsis:
|
|
33
|
+
return backend.arange(length, dtype=backend.default_integer_dtype, device=device)
|
|
34
|
+
else:
|
|
35
|
+
raise ValueError("Index must be an integer, slice, or Ellipsis.")
|
|
36
|
+
|
|
14
37
|
BatchT = TypeVar('BatchT')
|
|
15
38
|
class BatchBase(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]):
|
|
16
|
-
backend: ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
17
|
-
device: Optional[BDeviceType] = None
|
|
18
|
-
|
|
19
39
|
# If the batch is mutable, then the data can be changed (extend_*, set_*, remove_*, etc.)
|
|
20
40
|
is_mutable: bool = True
|
|
21
41
|
|
|
22
42
|
def __init__(
|
|
23
43
|
self,
|
|
24
|
-
single_space : Space[
|
|
44
|
+
single_space : Space[BatchT, BDeviceType, BDtypeType, BRNGType],
|
|
25
45
|
single_metadata_space : Optional[DictSpace[BDeviceType, BDtypeType, BRNGType]] = None,
|
|
26
46
|
):
|
|
27
47
|
self.single_space = single_space
|
|
28
48
|
self.single_metadata_space = single_metadata_space
|
|
29
|
-
self._batched_space : Space[
|
|
30
|
-
BatchT, Any, BDeviceType, BDtypeType, BRNGType
|
|
31
|
-
] = space_batch_utils.batch_space(single_space, 1)
|
|
49
|
+
self._batched_space : Space[BatchT, BDeviceType, BDtypeType, BRNGType] = space_batch_utils.batch_space(single_space, 1)
|
|
32
50
|
if single_metadata_space is not None:
|
|
33
51
|
self._batched_metadata_space : DictSpace[
|
|
34
52
|
BDeviceType, BDtypeType, BRNGType
|
|
@@ -36,24 +54,43 @@ class BatchBase(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType, BR
|
|
|
36
54
|
else:
|
|
37
55
|
self._batched_metadata_space = None
|
|
38
56
|
|
|
57
|
+
@property
|
|
58
|
+
def backend(self) -> ComputeBackend[BArrayType, BDeviceType, BDtypeType, BRNGType]:
|
|
59
|
+
return self.single_space.backend
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def device(self) -> Optional[BDeviceType]:
|
|
63
|
+
return self.single_space.device
|
|
64
|
+
|
|
39
65
|
@abc.abstractmethod
|
|
40
66
|
def __len__(self) -> int:
|
|
41
67
|
raise NotImplementedError
|
|
42
68
|
|
|
43
69
|
def get_flattened_at(self, idx : Union[IndexableType, BArrayType]) -> BArrayType:
|
|
44
|
-
|
|
70
|
+
unflattened_data = self.get_at(idx)
|
|
71
|
+
if isinstance(idx, int):
|
|
72
|
+
return space_flatten_utils.flatten_data(self.single_space, unflattened_data)
|
|
73
|
+
else:
|
|
74
|
+
return space_flatten_utils.flatten_data(self._batched_space, unflattened_data, start_dim=1)
|
|
45
75
|
|
|
46
|
-
@abc.abstractmethod
|
|
47
76
|
def get_flattened_at_with_metadata(
|
|
48
77
|
self, idx : Union[IndexableType, BArrayType]
|
|
49
78
|
) -> Tuple[BArrayType, Optional[Dict[str, Any]]]:
|
|
50
|
-
|
|
79
|
+
unflattened_data, metadata = self.get_at_with_metadata(idx)
|
|
80
|
+
if isinstance(idx, int):
|
|
81
|
+
return space_flatten_utils.flatten_data(self.single_space, unflattened_data), metadata
|
|
82
|
+
else:
|
|
83
|
+
return space_flatten_utils.flatten_data(self._batched_space, unflattened_data, start_dim=1), metadata
|
|
51
84
|
|
|
52
85
|
def set_flattened_at(self, idx : Union[IndexableType, BArrayType], value : BArrayType) -> None:
|
|
53
86
|
raise NotImplementedError
|
|
54
87
|
|
|
88
|
+
def append_flattened(self, value : BArrayType) -> None:
|
|
89
|
+
return self.extend_flattened(value[None])
|
|
90
|
+
|
|
55
91
|
def extend_flattened(self, value : BArrayType) -> None:
|
|
56
|
-
|
|
92
|
+
unflat_data = space_flatten_utils.unflatten_data(self._batched_space, value, start_dim=1)
|
|
93
|
+
self.extend(unflat_data)
|
|
57
94
|
|
|
58
95
|
def get_at(self, idx : Union[IndexableType, BArrayType]) -> BatchT:
|
|
59
96
|
flattened_data = self.get_flattened_at(idx)
|
|
@@ -90,6 +127,10 @@ class BatchBase(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType, BR
|
|
|
90
127
|
def __delitem__(self, idx : Union[IndexableType, BArrayType]) -> None:
|
|
91
128
|
self.remove_at(idx)
|
|
92
129
|
|
|
130
|
+
def append(self, value : BatchT) -> None:
|
|
131
|
+
batched_data = space_batch_utils.concatenate(self._batched_space, [value])
|
|
132
|
+
self.extend(batched_data)
|
|
133
|
+
|
|
93
134
|
def extend(self, value : BatchT) -> None:
|
|
94
135
|
flattened_data = space_flatten_utils.flatten_data(self._batched_space, value, start_dim=1)
|
|
95
136
|
self.extend_flattened(flattened_data)
|
|
@@ -105,40 +146,49 @@ SamplerArrayType = TypeVar('SamplerArrayType')
|
|
|
105
146
|
SamplerDeviceType = TypeVar('SamplerDeviceType')
|
|
106
147
|
SamplerDtypeType = TypeVar('SamplerDtypeType')
|
|
107
148
|
SamplerRNGType = TypeVar('SamplerRNGType')
|
|
108
|
-
class BatchSampler(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
backend : ComputeBackend[SamplerArrayType, SamplerDeviceType, SamplerDtypeType, SamplerRNGType]
|
|
118
|
-
device : Optional[SamplerDeviceType] = None
|
|
119
|
-
|
|
149
|
+
class BatchSampler(
|
|
150
|
+
Generic[
|
|
151
|
+
SamplerBatchT, SamplerArrayType, SamplerDeviceType, SamplerDtypeType, SamplerRNGType,
|
|
152
|
+
BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType,
|
|
153
|
+
],
|
|
154
|
+
BatchBase[
|
|
155
|
+
SamplerBatchT, SamplerArrayType, SamplerDeviceType, SamplerDtypeType, SamplerRNGType
|
|
156
|
+
]
|
|
157
|
+
):
|
|
120
158
|
data : BatchBase[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]
|
|
121
159
|
|
|
122
160
|
rng : Optional[SamplerRNGType] = None
|
|
123
161
|
data_rng : Optional[BRNGType] = None
|
|
124
|
-
|
|
125
|
-
def get_flat_at(self, idx : SamplerArrayType) -> SamplerArrayType:
|
|
126
|
-
return self.get_flat_at_with_metadata(idx)[0]
|
|
127
162
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
163
|
+
is_mutable : bool = False
|
|
164
|
+
|
|
165
|
+
def __init__(
|
|
166
|
+
self,
|
|
167
|
+
single_space : Space[BatchT, BDeviceType, BDtypeType, BRNGType],
|
|
168
|
+
single_metadata_space : Optional[DictSpace[BDeviceType, BDtypeType, BRNGType]] = None,
|
|
169
|
+
batch_size : int = 1,
|
|
170
|
+
) -> None:
|
|
171
|
+
super().__init__(single_space=single_space, single_metadata_space=single_metadata_space)
|
|
172
|
+
self.batch_size = batch_size
|
|
173
|
+
self._batched_space : Space[SamplerBatchT, SamplerDeviceType, SamplerDtypeType, SamplerRNGType] = space_batch_utils.batch_space(self.single_space, batch_size)
|
|
174
|
+
self._batched_metadata_space : Optional[DictSpace[SamplerDeviceType, SamplerDtypeType, SamplerRNGType]] = space_batch_utils.batch_space(self.single_metadata_space, batch_size) if self.single_metadata_space is not None else None
|
|
175
|
+
|
|
176
|
+
def manual_seed(self, seed : int) -> None:
|
|
177
|
+
if self.rng is not None:
|
|
178
|
+
self.rng = self.backend.random.random_number_generator(seed, device=self.device)
|
|
179
|
+
if self.data_rng is not None:
|
|
180
|
+
self.data_rng = self.backend.random.random_number_generator(seed, device=self.data.device)
|
|
181
|
+
|
|
182
|
+
@property
|
|
183
|
+
def sampled_space(self) -> Space[SamplerBatchT, SamplerDeviceType, SamplerDtypeType, SamplerRNGType]:
|
|
184
|
+
return self._batched_space
|
|
136
185
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
186
|
+
@property
|
|
187
|
+
def sampled_metadata_space(self) -> Optional[DictSpace[SamplerDeviceType, SamplerDtypeType, SamplerRNGType]]:
|
|
188
|
+
return self._batched_metadata_space
|
|
189
|
+
|
|
190
|
+
def __len__(self):
|
|
191
|
+
return len(self.data)
|
|
142
192
|
|
|
143
193
|
def sample_index(self) -> SamplerArrayType:
|
|
144
194
|
new_rng, indices = self.backend.random.random_discrete_uniform( # (B, )
|
|
@@ -156,11 +206,11 @@ class BatchSampler(abc.ABC, Generic[
|
|
|
156
206
|
|
|
157
207
|
def sample_flat(self) -> SamplerArrayType:
|
|
158
208
|
idx = self.sample_index()
|
|
159
|
-
return self.
|
|
209
|
+
return self.get_flattened_at(idx)
|
|
160
210
|
|
|
161
211
|
def sample_flat_with_metadata(self) -> Tuple[SamplerArrayType, Optional[Dict[str, Any]]]:
|
|
162
212
|
idx = self.sample_index()
|
|
163
|
-
return self.
|
|
213
|
+
return self.get_flattened_at_with_metadata(idx)
|
|
164
214
|
|
|
165
215
|
def sample(self) -> SamplerBatchT:
|
|
166
216
|
idx = self.sample_index()
|
|
@@ -205,9 +255,9 @@ class BatchSampler(abc.ABC, Generic[
|
|
|
205
255
|
n_batches = len(self.data) // self.batch_size
|
|
206
256
|
num_left = len(self.data) % self.batch_size
|
|
207
257
|
for i in range(n_batches):
|
|
208
|
-
yield self.
|
|
258
|
+
yield self.get_flattened_at(idx[i*self.batch_size:(i+1)*self.batch_size])
|
|
209
259
|
if num_left > 0:
|
|
210
|
-
yield self.
|
|
260
|
+
yield self.get_flattened_at(idx[-num_left:])
|
|
211
261
|
|
|
212
262
|
def epoch_flat_iter_with_metadata(self) -> Iterator[Tuple[SamplerArrayType, Optional[Dict[str, Any]]]]:
|
|
213
263
|
if self.data_rng is not None:
|
|
@@ -217,9 +267,9 @@ class BatchSampler(abc.ABC, Generic[
|
|
|
217
267
|
n_batches = len(self.data) // self.batch_size
|
|
218
268
|
num_left = len(self.data) % self.batch_size
|
|
219
269
|
for i in range(n_batches):
|
|
220
|
-
yield self.
|
|
270
|
+
yield self.get_flattened_at_with_metadata(idx[i*self.batch_size:(i+1)*self.batch_size])
|
|
221
271
|
if num_left > 0:
|
|
222
|
-
yield self.
|
|
272
|
+
yield self.get_flattened_at_with_metadata(idx[-num_left:])
|
|
223
273
|
|
|
224
274
|
def close(self) -> None:
|
|
225
275
|
pass
|
|
@@ -31,6 +31,7 @@ class SpaceStorage(abc.ABC, Generic[BatchT, BArrayType, BDeviceType, BDtypeType,
|
|
|
31
31
|
single_instance_space: Space[BatchT, BDeviceType, BDtypeType, BRNGType],
|
|
32
32
|
*,
|
|
33
33
|
capacity : Optional[int] = None,
|
|
34
|
+
read_only : bool = True,
|
|
34
35
|
**kwargs
|
|
35
36
|
) -> "SpaceStorage[BatchT, BArrayType, BDeviceType, BDtypeType, BRNGType]":
|
|
36
37
|
raise NotImplementedError
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from .backend_compat import ToBackendOrDeviceBatch
|
|
2
2
|
from .combined_batch import CombinedBatch
|
|
3
3
|
from .slicestack_batch import SliceStackedBatch
|
|
4
|
-
from .framestack_batch import FrameStackedBatch
|
|
4
|
+
from .framestack_batch import FrameStackedBatch
|
|
5
|
+
from .transformations import TransformedBatch
|