auto-atomic-operation 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.
Files changed (25) hide show
  1. auto_atomic_operation-0.1.0/LICENSE +21 -0
  2. auto_atomic_operation-0.1.0/PKG-INFO +215 -0
  3. auto_atomic_operation-0.1.0/README.md +198 -0
  4. auto_atomic_operation-0.1.0/auto_atom/__init__.py +60 -0
  5. auto_atomic_operation-0.1.0/auto_atom/backend/__init__.py +0 -0
  6. auto_atomic_operation-0.1.0/auto_atom/backend/mjc/__init__.py +0 -0
  7. auto_atomic_operation-0.1.0/auto_atom/backend/mjc/mujoco_backend.py +571 -0
  8. auto_atomic_operation-0.1.0/auto_atom/backend/mjc/tactile/__init__.py +0 -0
  9. auto_atomic_operation-0.1.0/auto_atom/backend/mjc/tactile/base_env.py +170 -0
  10. auto_atomic_operation-0.1.0/auto_atom/backend/mjc/tactile/tactile_sensor.py +663 -0
  11. auto_atomic_operation-0.1.0/auto_atom/basis/mujoco_env.py +903 -0
  12. auto_atomic_operation-0.1.0/auto_atom/framework.py +220 -0
  13. auto_atomic_operation-0.1.0/auto_atom/mock.py +260 -0
  14. auto_atomic_operation-0.1.0/auto_atom/runtime.py +1152 -0
  15. auto_atomic_operation-0.1.0/auto_atom/utils/pose.py +144 -0
  16. auto_atomic_operation-0.1.0/auto_atom/utils/transformations.py +1751 -0
  17. auto_atomic_operation-0.1.0/auto_atomic_operation.egg-info/PKG-INFO +215 -0
  18. auto_atomic_operation-0.1.0/auto_atomic_operation.egg-info/SOURCES.txt +23 -0
  19. auto_atomic_operation-0.1.0/auto_atomic_operation.egg-info/dependency_links.txt +1 -0
  20. auto_atomic_operation-0.1.0/auto_atomic_operation.egg-info/requires.txt +6 -0
  21. auto_atomic_operation-0.1.0/auto_atomic_operation.egg-info/top_level.txt +1 -0
  22. auto_atomic_operation-0.1.0/pyproject.toml +27 -0
  23. auto_atomic_operation-0.1.0/setup.cfg +4 -0
  24. auto_atomic_operation-0.1.0/tests/test_mujoco.py +77 -0
  25. auto_atomic_operation-0.1.0/tests/test_mujoco_pick_place_demo.py +40 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ge Haizhou
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.
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: auto-atomic-operation
3
+ Version: 0.1.0
4
+ Summary: A YAML-driven atomic operation framework for robotic manipulation.
5
+ Author: OpenGHz
6
+ License: MIT
7
+ Project-URL: repository, https://github.com/OpenGHz/auto-atomic-operation.git
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: hydra-core
12
+ Requires-Dist: numpy
13
+ Requires-Dist: pydantic>=2
14
+ Provides-Extra: mujoco
15
+ Requires-Dist: mujoco; extra == "mujoco"
16
+ Dynamic: license-file
17
+
18
+ <div align="center">
19
+
20
+ <h1>Auto Atomic Operation</h1>
21
+
22
+ [![PyPI](https://img.shields.io/pypi/v/auto-atomic-operation)](https://pypi.org/project/auto-atomic-operation/)
23
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://www.python.org/)
24
+ [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
25
+
26
+ A YAML-driven atomic operation framework for robotic manipulation.
27
+
28
+ </div>
29
+
30
+ `auto-atomic-operation` lets you define robotic manipulation tasks — pick, place, push, pull, move, grasp, release — as declarative YAML files. A built-in state machine handles task sequencing, pose resolution, end-effector control, and execution tracking. A plugin-based backend system decouples task logic from the underlying hardware or simulator, making it easy to run the same task definition against a real robot, a physics simulator, or a lightweight mock for testing.
31
+
32
+ ## Features
33
+
34
+ - **Hydra-powered task configuration** — describe multi-stage manipulation tasks in YAML; full [Hydra](https://hydra.cc) support means `_target_` instantiation, variable interpolation, and command-line overrides work out of the box
35
+ - **Flexible pose references** — specify targets relative to world, robot base, end-effector, or tracked objects
36
+ - **Pluggable backends** — connect any robot or simulator by implementing a small set of abstract interfaces
37
+ - **Pose randomization** — per-object position/orientation randomization with automatic collision avoidance on reset
38
+ - **Multi-arm support** — single-arm and dual-arm (left/right) topologies
39
+ - **Execution records** — detailed per-stage status, failure reasons, and timing after every run
40
+ - **Mujoco backend included** — a ready-to-use backend with RGB-D cameras, tactile sensors, force/torque, IMU, and joint state support
41
+
42
+ ## Installation
43
+
44
+ Requires **Python 3.10+**.
45
+
46
+ ```bash
47
+ # Core framework only
48
+ pip install -e .
49
+
50
+ # With the built-in Mujoco backend
51
+ pip install -e ".[mujoco]"
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ### 1. Define a task in YAML
57
+
58
+ ```yaml
59
+ # task.yaml
60
+ backend: auto_atom.mock.build_mock_backend
61
+
62
+ task:
63
+ env_name: my_env
64
+ stages:
65
+ - name: pick_cup
66
+ object: cup
67
+ operation: pick
68
+ operator: arm_a
69
+ param:
70
+ pre_move:
71
+ - position: [0.45, -0.10, 0.08]
72
+ rotation: [0.0, 1.57, 0.0]
73
+ reference: object_world
74
+ eef:
75
+ close: true
76
+
77
+ - name: place_on_shelf
78
+ object: shelf
79
+ operation: place
80
+ operator: arm_a
81
+ param:
82
+ pre_move:
83
+ - position: [0.10, 0.25, 0.16]
84
+ orientation: [0.0, 0.0, 0.0, 1.0]
85
+ reference: world
86
+ eef:
87
+ close: false
88
+
89
+ operators:
90
+ - name: arm_a
91
+ role: manipulator
92
+ ```
93
+
94
+ ### 2. Run the task
95
+
96
+ ```python
97
+ from pathlib import Path
98
+ from auto_atom.runtime import ComponentRegistry, TaskRunner
99
+
100
+ ComponentRegistry.clear()
101
+ runner = TaskRunner().from_yaml(Path("task.yaml"))
102
+
103
+ runner.reset()
104
+ while True:
105
+ update = runner.update()
106
+ if update.done:
107
+ break
108
+
109
+ for record in runner.records:
110
+ print(record)
111
+
112
+ runner.close()
113
+ ```
114
+
115
+ ## YAML Configuration Reference
116
+
117
+ Task files are processed by [Hydra](https://hydra.cc) / OmegaConf, so the full Hydra feature set is available: `_target_` instantiation, `${key}` interpolation, structured configs, and command-line overrides (`key=value`).
118
+
119
+ A task file has four top-level keys:
120
+
121
+ | Key | Description |
122
+ |-----|-------------|
123
+ | `env` | Hydra `_target_` instantiation of the environment, registered via `ComponentRegistry` |
124
+ | `backend` | Dotted import path to the backend factory function |
125
+ | `task` | Task definition: `env_name`, `seed`, and a list of `stages` |
126
+ | `operators` | Named operators with assigned roles |
127
+
128
+ ### Stage definition
129
+
130
+ ```yaml
131
+ - name: <stage_name> # Unique stage identifier
132
+ object: <object_name> # Target object
133
+ operation: pick|place|push|pull|move|grasp|release
134
+ operator: <operator_name> # Which arm/robot executes this stage
135
+ blocking: true # Optional, default true
136
+ param:
137
+ pre_move: # Approach waypoints (list of pose configs)
138
+ - position: [x, y, z]
139
+ rotation: [rx, ry, rz] # Euler angles (rad), or:
140
+ orientation: [x, y, z, w] # Quaternion
141
+ reference: world|base|eef|object|object_world|eef_world|auto
142
+ post_move: # Retreat waypoints (same format as pre_move)
143
+ eef:
144
+ close: true|false # Gripper open/close
145
+ ```
146
+
147
+ ### Pose references
148
+
149
+ | Reference | Description |
150
+ |-----------|-------------|
151
+ | `world` | Fixed world frame |
152
+ | `base` | Robot base frame |
153
+ | `eef` | Current end-effector frame |
154
+ | `object` | Object frame (tracks object movement) |
155
+ | `object_world` | Object position with world orientation |
156
+ | `eef_world` | EEF position snapshot at command start |
157
+ | `auto` | Automatically determined from context |
158
+
159
+ ## Examples
160
+
161
+ The [`examples/`](examples/) directory contains two runnable demos:
162
+
163
+ ### Mock example (no robot or simulator required)
164
+
165
+ ```bash
166
+ python examples/run_mock_example.py
167
+ ```
168
+
169
+ Uses the in-memory mock backend — ideal for testing task logic in isolation.
170
+
171
+ ### Mujoco pick-and-place demo
172
+
173
+ ```bash
174
+ python examples/run_mujoco_pick_place_demo.py
175
+ ```
176
+
177
+ A full pick-and-place task with RGB-D cameras, tactile sensors, and randomized object placement, running in the Mujoco physics simulator.
178
+
179
+ ## Architecture
180
+
181
+ ```
182
+ auto_atom/
183
+ ├── framework.py # Pydantic configuration models (YAML schema)
184
+ ├── runtime.py # Task execution engine (TaskRunner, TaskFlowBuilder)
185
+ ├── mock.py # In-memory mock backend for testing
186
+ ├── basis/
187
+ │ └── mujoco_env.py # UnifiedMujocoEnv — Mujoco wrapper with sensor suite
188
+ ├── backend/
189
+ │ └── mjc/ # Mujoco backend (operators, objects, scene)
190
+ └── utils/
191
+ └── pose.py # Pose transforms and quaternion utilities
192
+ ```
193
+
194
+ **Execution flow:**
195
+
196
+ 1. Load and validate the YAML task file via Pydantic models
197
+ 2. Instantiate the backend via the configured factory function
198
+ 3. `TaskFlowBuilder` expands stages into primitive pose-move and EEF-control actions
199
+ 4. `TaskRunner.reset()` initializes the scene (with optional randomization)
200
+ 5. `TaskRunner.update()` advances one step of the active primitive action
201
+ 6. After completion, `TaskRunner.records` holds per-stage execution history
202
+
203
+ ## Implementing a Custom Backend
204
+
205
+ To integrate a new simulator or real robot, implement three abstract classes from `auto_atom.runtime`:
206
+
207
+ - `OperatorHandler` — arm movement (`move_to_pose`) and gripper control (`control_eef`)
208
+ - `ObjectHandler` — object pose queries and updates (`get_pose`, `set_pose`)
209
+ - `SceneBackend` — scene lifecycle, handler resolution, and randomization
210
+
211
+ See the **[Custom Backend Guide](docs/custom-backend.md)** for a step-by-step walkthrough with annotated code examples. [`auto_atom/mock.py`](auto_atom/mock.py) provides a minimal reference implementation.
212
+
213
+ ## License
214
+
215
+ See [LICENSE](LICENSE).
@@ -0,0 +1,198 @@
1
+ <div align="center">
2
+
3
+ <h1>Auto Atomic Operation</h1>
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/auto-atomic-operation)](https://pypi.org/project/auto-atomic-operation/)
6
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://www.python.org/)
7
+ [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
8
+
9
+ A YAML-driven atomic operation framework for robotic manipulation.
10
+
11
+ </div>
12
+
13
+ `auto-atomic-operation` lets you define robotic manipulation tasks — pick, place, push, pull, move, grasp, release — as declarative YAML files. A built-in state machine handles task sequencing, pose resolution, end-effector control, and execution tracking. A plugin-based backend system decouples task logic from the underlying hardware or simulator, making it easy to run the same task definition against a real robot, a physics simulator, or a lightweight mock for testing.
14
+
15
+ ## Features
16
+
17
+ - **Hydra-powered task configuration** — describe multi-stage manipulation tasks in YAML; full [Hydra](https://hydra.cc) support means `_target_` instantiation, variable interpolation, and command-line overrides work out of the box
18
+ - **Flexible pose references** — specify targets relative to world, robot base, end-effector, or tracked objects
19
+ - **Pluggable backends** — connect any robot or simulator by implementing a small set of abstract interfaces
20
+ - **Pose randomization** — per-object position/orientation randomization with automatic collision avoidance on reset
21
+ - **Multi-arm support** — single-arm and dual-arm (left/right) topologies
22
+ - **Execution records** — detailed per-stage status, failure reasons, and timing after every run
23
+ - **Mujoco backend included** — a ready-to-use backend with RGB-D cameras, tactile sensors, force/torque, IMU, and joint state support
24
+
25
+ ## Installation
26
+
27
+ Requires **Python 3.10+**.
28
+
29
+ ```bash
30
+ # Core framework only
31
+ pip install -e .
32
+
33
+ # With the built-in Mujoco backend
34
+ pip install -e ".[mujoco]"
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ### 1. Define a task in YAML
40
+
41
+ ```yaml
42
+ # task.yaml
43
+ backend: auto_atom.mock.build_mock_backend
44
+
45
+ task:
46
+ env_name: my_env
47
+ stages:
48
+ - name: pick_cup
49
+ object: cup
50
+ operation: pick
51
+ operator: arm_a
52
+ param:
53
+ pre_move:
54
+ - position: [0.45, -0.10, 0.08]
55
+ rotation: [0.0, 1.57, 0.0]
56
+ reference: object_world
57
+ eef:
58
+ close: true
59
+
60
+ - name: place_on_shelf
61
+ object: shelf
62
+ operation: place
63
+ operator: arm_a
64
+ param:
65
+ pre_move:
66
+ - position: [0.10, 0.25, 0.16]
67
+ orientation: [0.0, 0.0, 0.0, 1.0]
68
+ reference: world
69
+ eef:
70
+ close: false
71
+
72
+ operators:
73
+ - name: arm_a
74
+ role: manipulator
75
+ ```
76
+
77
+ ### 2. Run the task
78
+
79
+ ```python
80
+ from pathlib import Path
81
+ from auto_atom.runtime import ComponentRegistry, TaskRunner
82
+
83
+ ComponentRegistry.clear()
84
+ runner = TaskRunner().from_yaml(Path("task.yaml"))
85
+
86
+ runner.reset()
87
+ while True:
88
+ update = runner.update()
89
+ if update.done:
90
+ break
91
+
92
+ for record in runner.records:
93
+ print(record)
94
+
95
+ runner.close()
96
+ ```
97
+
98
+ ## YAML Configuration Reference
99
+
100
+ Task files are processed by [Hydra](https://hydra.cc) / OmegaConf, so the full Hydra feature set is available: `_target_` instantiation, `${key}` interpolation, structured configs, and command-line overrides (`key=value`).
101
+
102
+ A task file has four top-level keys:
103
+
104
+ | Key | Description |
105
+ |-----|-------------|
106
+ | `env` | Hydra `_target_` instantiation of the environment, registered via `ComponentRegistry` |
107
+ | `backend` | Dotted import path to the backend factory function |
108
+ | `task` | Task definition: `env_name`, `seed`, and a list of `stages` |
109
+ | `operators` | Named operators with assigned roles |
110
+
111
+ ### Stage definition
112
+
113
+ ```yaml
114
+ - name: <stage_name> # Unique stage identifier
115
+ object: <object_name> # Target object
116
+ operation: pick|place|push|pull|move|grasp|release
117
+ operator: <operator_name> # Which arm/robot executes this stage
118
+ blocking: true # Optional, default true
119
+ param:
120
+ pre_move: # Approach waypoints (list of pose configs)
121
+ - position: [x, y, z]
122
+ rotation: [rx, ry, rz] # Euler angles (rad), or:
123
+ orientation: [x, y, z, w] # Quaternion
124
+ reference: world|base|eef|object|object_world|eef_world|auto
125
+ post_move: # Retreat waypoints (same format as pre_move)
126
+ eef:
127
+ close: true|false # Gripper open/close
128
+ ```
129
+
130
+ ### Pose references
131
+
132
+ | Reference | Description |
133
+ |-----------|-------------|
134
+ | `world` | Fixed world frame |
135
+ | `base` | Robot base frame |
136
+ | `eef` | Current end-effector frame |
137
+ | `object` | Object frame (tracks object movement) |
138
+ | `object_world` | Object position with world orientation |
139
+ | `eef_world` | EEF position snapshot at command start |
140
+ | `auto` | Automatically determined from context |
141
+
142
+ ## Examples
143
+
144
+ The [`examples/`](examples/) directory contains two runnable demos:
145
+
146
+ ### Mock example (no robot or simulator required)
147
+
148
+ ```bash
149
+ python examples/run_mock_example.py
150
+ ```
151
+
152
+ Uses the in-memory mock backend — ideal for testing task logic in isolation.
153
+
154
+ ### Mujoco pick-and-place demo
155
+
156
+ ```bash
157
+ python examples/run_mujoco_pick_place_demo.py
158
+ ```
159
+
160
+ A full pick-and-place task with RGB-D cameras, tactile sensors, and randomized object placement, running in the Mujoco physics simulator.
161
+
162
+ ## Architecture
163
+
164
+ ```
165
+ auto_atom/
166
+ ├── framework.py # Pydantic configuration models (YAML schema)
167
+ ├── runtime.py # Task execution engine (TaskRunner, TaskFlowBuilder)
168
+ ├── mock.py # In-memory mock backend for testing
169
+ ├── basis/
170
+ │ └── mujoco_env.py # UnifiedMujocoEnv — Mujoco wrapper with sensor suite
171
+ ├── backend/
172
+ │ └── mjc/ # Mujoco backend (operators, objects, scene)
173
+ └── utils/
174
+ └── pose.py # Pose transforms and quaternion utilities
175
+ ```
176
+
177
+ **Execution flow:**
178
+
179
+ 1. Load and validate the YAML task file via Pydantic models
180
+ 2. Instantiate the backend via the configured factory function
181
+ 3. `TaskFlowBuilder` expands stages into primitive pose-move and EEF-control actions
182
+ 4. `TaskRunner.reset()` initializes the scene (with optional randomization)
183
+ 5. `TaskRunner.update()` advances one step of the active primitive action
184
+ 6. After completion, `TaskRunner.records` holds per-stage execution history
185
+
186
+ ## Implementing a Custom Backend
187
+
188
+ To integrate a new simulator or real robot, implement three abstract classes from `auto_atom.runtime`:
189
+
190
+ - `OperatorHandler` — arm movement (`move_to_pose`) and gripper control (`control_eef`)
191
+ - `ObjectHandler` — object pose queries and updates (`get_pose`, `set_pose`)
192
+ - `SceneBackend` — scene lifecycle, handler resolution, and randomization
193
+
194
+ See the **[Custom Backend Guide](docs/custom-backend.md)** for a step-by-step walkthrough with annotated code examples. [`auto_atom/mock.py`](auto_atom/mock.py) provides a minimal reference implementation.
195
+
196
+ ## License
197
+
198
+ See [LICENSE](LICENSE).
@@ -0,0 +1,60 @@
1
+ """Import-friendly runtime package for the Auto Atomic Operation framework."""
2
+
3
+ from .framework import (
4
+ AutoAtomConfig,
5
+ EefControlConfig,
6
+ OperatorConfig,
7
+ PoseControlConfig,
8
+ PoseReference,
9
+ StageConfig,
10
+ StageControlConfig,
11
+ TaskFileConfig,
12
+ )
13
+ from .mock import MockOperatorHandler, MockSceneBackend
14
+ from .runtime import (
15
+ ComponentRegistry,
16
+ ControlResult,
17
+ ControlSignal,
18
+ ExecutionContext,
19
+ ExecutionRecord,
20
+ ObjectHandler,
21
+ OperatorHandler,
22
+ PoseRandomRange,
23
+ PrimitiveAction,
24
+ StageExecutionStatus,
25
+ TaskFlowBuilder,
26
+ TaskRunner,
27
+ TaskUpdate,
28
+ load_config,
29
+ load_task_file,
30
+ )
31
+ from .utils.pose import PoseState
32
+
33
+ __all__ = [
34
+ "AutoAtomConfig",
35
+ "ComponentRegistry",
36
+ "ControlResult",
37
+ "ControlSignal",
38
+ "ExecutionContext",
39
+ "ExecutionRecord",
40
+ "EefControlConfig",
41
+ "MockOperatorHandler",
42
+ "MockSceneBackend",
43
+ "ObjectHandler",
44
+ "OperatorConfig",
45
+ "OperatorHandler",
46
+ "PoseControlConfig",
47
+ "PoseRandomRange",
48
+ "PoseReference",
49
+ "PoseState",
50
+ "PrimitiveAction",
51
+ "StageConfig",
52
+ "StageControlConfig",
53
+ "StageExecutionStatus",
54
+ "TaskFileConfig",
55
+ "TaskFlowBuilder",
56
+ "TaskRunner",
57
+ "TaskUpdate",
58
+ "load_config",
59
+ "load_task_file",
60
+ ]