revfly 2.0.0__py3-none-any.whl
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.
- revfly/__init__.py +23 -0
- revfly/__main__.py +6 -0
- revfly-2.0.0.dist-info/METADATA +106 -0
- revfly-2.0.0.dist-info/RECORD +37 -0
- revfly-2.0.0.dist-info/WHEEL +5 -0
- revfly-2.0.0.dist-info/entry_points.txt +3 -0
- revfly-2.0.0.dist-info/top_level.txt +2 -0
- sensory_translator_v2/__init__.py +116 -0
- sensory_translator_v2/assets.py +924 -0
- sensory_translator_v2/backends/__init__.py +19 -0
- sensory_translator_v2/backends/base.py +484 -0
- sensory_translator_v2/backends/mujoco_worker.py +1213 -0
- sensory_translator_v2/backends/persistent_mujoco.py +592 -0
- sensory_translator_v2/backends/v1_subprocess.py +364 -0
- sensory_translator_v2/backends/worker_protocol.py +108 -0
- sensory_translator_v2/bio/__init__.py +39 -0
- sensory_translator_v2/bio/lif_interface.py +624 -0
- sensory_translator_v2/bio/malecns_pools.py +204 -0
- sensory_translator_v2/bio/spiking.py +310 -0
- sensory_translator_v2/contracts.py +708 -0
- sensory_translator_v2/engine/__init__.py +28 -0
- sensory_translator_v2/engine/__main__.py +6 -0
- sensory_translator_v2/engine/benchmark.py +346 -0
- sensory_translator_v2/engine/cli.py +677 -0
- sensory_translator_v2/engine/core.py +1269 -0
- sensory_translator_v2/engine/multijoint.py +1003 -0
- sensory_translator_v2/engine/openapi.py +385 -0
- sensory_translator_v2/engine/server.py +1431 -0
- sensory_translator_v2/evidence.py +84 -0
- sensory_translator_v2/goals.py +172 -0
- sensory_translator_v2/rate/__init__.py +60 -0
- sensory_translator_v2/rate/bridge.py +424 -0
- sensory_translator_v2/rate/model.py +350 -0
- sensory_translator_v2/rate/multijoint.py +805 -0
- sensory_translator_v2/rate/optim.py +57 -0
- sensory_translator_v2/rate/trainer.py +618 -0
- sensory_translator_v2/runtime_install.py +370 -0
revfly/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""Public REvFLY Python API."""
|
|
2
|
+
|
|
3
|
+
from sensory_translator_v2 import __version__
|
|
4
|
+
from sensory_translator_v2.engine import (
|
|
5
|
+
EngineV2,
|
|
6
|
+
EngineV2Config,
|
|
7
|
+
MultiJointEngine,
|
|
8
|
+
MultiJointEngineConfig,
|
|
9
|
+
RateControlV2App,
|
|
10
|
+
RateControlV2HTTPServer,
|
|
11
|
+
evaluate_bio_realization,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"EngineV2",
|
|
16
|
+
"EngineV2Config",
|
|
17
|
+
"MultiJointEngine",
|
|
18
|
+
"MultiJointEngineConfig",
|
|
19
|
+
"RateControlV2App",
|
|
20
|
+
"RateControlV2HTTPServer",
|
|
21
|
+
"__version__",
|
|
22
|
+
"evaluate_bio_realization",
|
|
23
|
+
]
|
revfly/__main__.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: revfly
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: REvFLY engine for inverse motor-rate control in FlyMimic MuJoCo
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/IlleJiViN/REvFLY
|
|
7
|
+
Project-URL: Issues, https://github.com/IlleJiViN/REvFLY/issues
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: numpy>=2.0
|
|
12
|
+
Requires-Dist: torch>=2.4
|
|
13
|
+
Provides-Extra: physics
|
|
14
|
+
Requires-Dist: mujoco<3.4,>=3.3.0; extra == "physics"
|
|
15
|
+
Requires-Dist: dm-control>=1.0.28; extra == "physics"
|
|
16
|
+
Requires-Dist: imageio>=2.36; extra == "physics"
|
|
17
|
+
Requires-Dist: imageio-ffmpeg>=0.5; extra == "physics"
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
20
|
+
|
|
21
|
+
# REvFLY Python SDK and CLI
|
|
22
|
+
|
|
23
|
+
Python SDK and CLI for translating joint trajectories into continuous motor rates and replaying them with FlyMimic MuJoCo. The wheel installs the engine and its APIs. The release ZIP supplies the checkpoints, physics assets, and optional local Control Studio.
|
|
24
|
+
|
|
25
|
+
## Install from PyPI
|
|
26
|
+
|
|
27
|
+
Once the `revfly` distribution is listed on PyPI, install it for the SDK and CLI.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python -m pip install revfly
|
|
31
|
+
revfly --version
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For simulations, add the `physics` extra and download the runtime ZIP for the model checkpoints, physics assets, and local Control Studio. The physics workflow was tested on Linux x86-64 with Python 3.11. On Linux, you can install CPU Torch first to avoid downloading CUDA dependencies. Rendering uses the host's OpenGL/EGL libraries. [Runtime ZIP](https://github.com/IlleJiViN/REvFLY/releases/download/v2.0.0/revfly-2.0.0-local-beta.zip)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python3.11 -m venv .venv
|
|
38
|
+
source .venv/bin/activate
|
|
39
|
+
python -m pip install 'torch>=2.4' --index-url https://download.pytorch.org/whl/cpu
|
|
40
|
+
python -m pip install 'revfly[physics]'
|
|
41
|
+
revfly install-assets ./revfly-2.0.0-local-beta.zip
|
|
42
|
+
revfly verify-assets
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
To switch an existing environment, run `python -m pip uninstall sensory-translator-v2` before installing `revfly`. Both distributions share files and commands.
|
|
46
|
+
|
|
47
|
+
Assets are stored in `~/.local/share/sensory-translator-v2/bundle` or under `XDG_DATA_HOME`. An explicit `--asset-root` or `SENSORY_TRANSLATOR_V2_ASSET_ROOT` selects a different bundle. Source checkouts with the legacy physics assets keep their checkout defaults. Add `--replace` to install a different verified bundle in place. An extracted `bundle/` directory is also a valid input.
|
|
48
|
+
|
|
49
|
+
## Install from a GitHub wheel
|
|
50
|
+
|
|
51
|
+
Download the wheel alongside the runtime ZIP or extract it from the ZIP. Use the same virtual environment as above and replace the PyPI installation command with the wheel command. [GitHub release](https://github.com/IlleJiViN/REvFLY/releases/tag/v2.0.0)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python -m pip install './revfly-2.0.0-py3-none-any.whl[physics]'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Run a simulation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
revfly run-multijoint --goal-family swing_scaled --scale 0.92 \
|
|
61
|
+
--mode fast --output ./swing-result --render
|
|
62
|
+
|
|
63
|
+
revfly serve --host 127.0.0.1 --port 8505 --ui \
|
|
64
|
+
--model-id 20261115_v2_fastbridge_lowenergy
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The first command writes the manifest, physics traces, and top-view video. The second serves the local [Control Studio](http://127.0.0.1:8505/) and the [OpenAPI specification](http://127.0.0.1:8505/openapi.json). For an environment without OpenGL, omit `--render` and set `MUJOCO_GL=disable` for headless inference.
|
|
68
|
+
|
|
69
|
+
## Use the Python API
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from contextlib import closing
|
|
73
|
+
|
|
74
|
+
from revfly import MultiJointEngine
|
|
75
|
+
|
|
76
|
+
with closing(MultiJointEngine()) as engine:
|
|
77
|
+
goal = engine.goal_from_family(family="swing_scaled", scale=0.92)
|
|
78
|
+
result = engine.run(goal["target_rad"], mode="fast", output="./swing-result")
|
|
79
|
+
print(result["best_rmse_deg"], result["independent_replay_verified"])
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Use `EngineV2` for single-axis simulation and `MultiJointEngine` for seven-axis left-front-leg simulation. `EngineV2Config` and `MultiJointEngineConfig` accept an explicit `asset_root` and optional separate `physics_python`. The default multi-joint checkpoint is `20261116_v2_multijoint15_resnorm`. Use `serve --multijoint-checkpoint PATH` or `run-multijoint --checkpoint PATH` to load a different model.
|
|
83
|
+
|
|
84
|
+
The multi-joint controller commands all 15 muscles. The bundle supports deterministic-interval, refractory Poisson, and direct LIF replay with separately reported simulation RMSE. Premotor connectome replay requires local MaleCNS data plus `pandas` and a Parquet reader such as `pyarrow`.
|
|
85
|
+
|
|
86
|
+
## Install from a Git tag
|
|
87
|
+
|
|
88
|
+
Run this in the target virtual environment. Download and install the runtime ZIP separately using `install-assets`.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
python -m pip install 'revfly[physics] @ git+https://github.com/IlleJiViN/REvFLY.git@v2.0.0'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Build and publish a team release
|
|
95
|
+
|
|
96
|
+
Build the wheel and source distribution from the repository root. Export the runtime files from a checkout that contains the trained checkpoints and FlyMimic assets.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python -m pip install build
|
|
100
|
+
python -m build
|
|
101
|
+
revfly export-assets --asset-root . --dest dist/bundle --include-v2-models --include-ui
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
After editing UI sources, build `apps/control_ui` before exporting. The beta ZIP contains the wheel, `bundle/`, this README, third-party notices, the upstream FlyMimic license, and `SHA256SUMS`.
|
|
105
|
+
|
|
106
|
+
After pushing the matching Git tag, attach the wheel and ZIP to that tag's pre-release.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
revfly/__init__.py,sha256=yumA_IX0hHYSprhbAIjKoWRomtkI9iauBpBG1j6mj6g,502
|
|
2
|
+
revfly/__main__.py,sha256=yi5yxlaxf3tAeHfANRPT63FS3e33cOafSdW-dhfW4Js,156
|
|
3
|
+
sensory_translator_v2/__init__.py,sha256=4Uzl-11v96fQmYEa2-hNcbgc4RbO04K9YEBNDxCK4Jw,2494
|
|
4
|
+
sensory_translator_v2/assets.py,sha256=gDhTNzGoLb1dkRPROvMJpAqtt2Lb_QcWoy2Oi2zIAbY,38287
|
|
5
|
+
sensory_translator_v2/contracts.py,sha256=gqHxknIIpy_8prngQoHiq9eEO9C2Gjl0-De5VcTLRkQ,25803
|
|
6
|
+
sensory_translator_v2/evidence.py,sha256=nPGGhuXIk5tgFVRIrVPplgM31aYZVE62l0y9lBjmv1Q,2786
|
|
7
|
+
sensory_translator_v2/goals.py,sha256=TLS2YKHEPRwkmXU8QGO1i0olLeZ5fsD2gu7MKbI5u7Y,6609
|
|
8
|
+
sensory_translator_v2/runtime_install.py,sha256=qWcrDloei8_HOSEhEmt-3zpEAwmAhH9tcbKZ92ewnEo,17470
|
|
9
|
+
sensory_translator_v2/backends/__init__.py,sha256=J6Aj5QXmlMBHu8HiKqMxx5e9el2Pk12pIA-Id44CMVU,507
|
|
10
|
+
sensory_translator_v2/backends/base.py,sha256=dqcCB-4S6-7jyqG5e6XsDiV2DiS58eEGS3Sjrpg5EdE,21831
|
|
11
|
+
sensory_translator_v2/backends/mujoco_worker.py,sha256=FUf2EGZsRe6A8YsOAl9P9oRBoGwfL6OogukRbXcavyQ,55404
|
|
12
|
+
sensory_translator_v2/backends/persistent_mujoco.py,sha256=wW_bIQBO8Vbf6BIO15O7qPcacxqzdxgSAoCZihlQxe8,23682
|
|
13
|
+
sensory_translator_v2/backends/v1_subprocess.py,sha256=Z17rjOK6CSJCQyBMRF-vwngxRlCZy4wfHc5cigbsuHA,14252
|
|
14
|
+
sensory_translator_v2/backends/worker_protocol.py,sha256=-vqxIAejfRswqKV6o8KcE4KScBBKswDTvgXp6QiAhxs,4460
|
|
15
|
+
sensory_translator_v2/bio/__init__.py,sha256=vZ2VdvEPWq1Im-1cBHlAOGDZeBnrlOcrcU2B1SQGHn0,1081
|
|
16
|
+
sensory_translator_v2/bio/lif_interface.py,sha256=CzLi0lQezgPh-ETe-Td0ig2xU40F1DEEUclwsUvu9hE,26034
|
|
17
|
+
sensory_translator_v2/bio/malecns_pools.py,sha256=ye5yHZCvblI51xhFPieKWbHzDa4OEctGZsL__DeD1B4,8666
|
|
18
|
+
sensory_translator_v2/bio/spiking.py,sha256=a4NqJpI-p0N93EpwKCiXtwIOAOCr4EQWwJOpOE-Xz-k,11914
|
|
19
|
+
sensory_translator_v2/engine/__init__.py,sha256=JJIjz3PufIVHOXveYB_tccNJO2eu8OpXJND8jyBIT84,791
|
|
20
|
+
sensory_translator_v2/engine/__main__.py,sha256=XwhCofIl9Jq17TBwSqp2bDvrdyOzPFRFJ0VRAOj8OoE,148
|
|
21
|
+
sensory_translator_v2/engine/benchmark.py,sha256=y8NdIAi0OdS3RuugTx0jgbfIf4kuGMb21hm3Nw_gMVI,13732
|
|
22
|
+
sensory_translator_v2/engine/cli.py,sha256=fsK1WjoMM2OX3sV7d2AIll6IN3OyuekqxWUZ8zJU3JA,30107
|
|
23
|
+
sensory_translator_v2/engine/core.py,sha256=zNe8QwhR2drMdicodkBC95adAMcDWusKzPInhIWdBqM,59708
|
|
24
|
+
sensory_translator_v2/engine/multijoint.py,sha256=PUdHtjqe-CVy5OOS57k_0CucqOp7ey31azVdao0Fc84,44490
|
|
25
|
+
sensory_translator_v2/engine/openapi.py,sha256=lkij75Nv-xLroJj2DvQs1kI82R517lRafHWar7kpERQ,19047
|
|
26
|
+
sensory_translator_v2/engine/server.py,sha256=eK1iXRwZ8E31G_aXH-Wdn4EKvx5SMnPX-Vgj4RpZBGU,62507
|
|
27
|
+
sensory_translator_v2/rate/__init__.py,sha256=UMWn4CLL7BFRhfYeRObfrzfsLfGHazQNZDXnW1eutrE,1573
|
|
28
|
+
sensory_translator_v2/rate/bridge.py,sha256=xY13RZ6jaTMVKXGJcvZVSsdY2OM67_Py4teV97iDv_s,16623
|
|
29
|
+
sensory_translator_v2/rate/model.py,sha256=PaBGHlcJTi3Ncs00ZmAY7QVPRigspGOrTtrl09y8V4c,15694
|
|
30
|
+
sensory_translator_v2/rate/multijoint.py,sha256=2-boiREaczL3cRZ3VLHT8ZKODlmd2Mx9FifD5XPEec0,33382
|
|
31
|
+
sensory_translator_v2/rate/optim.py,sha256=yATqyGWvvrBioG3tTh9SQKdrzDo7SHIEElo3KHuX8BM,1790
|
|
32
|
+
sensory_translator_v2/rate/trainer.py,sha256=UjtRv9L3CAQPW2ZRb4KFQp678uyyxNh01FRCtrl4T0Q,23580
|
|
33
|
+
revfly-2.0.0.dist-info/METADATA,sha256=BwuUAccNtWbTDSOfaX6v4jUN5GBiH3wvij1M_4kULtY,5313
|
|
34
|
+
revfly-2.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
35
|
+
revfly-2.0.0.dist-info/entry_points.txt,sha256=mN2MpRXJ054HJBVkzEUoPzi9Rk662xpphbm4Y8I313k,106
|
|
36
|
+
revfly-2.0.0.dist-info/top_level.txt,sha256=4pWiK8Cx4QdpdPgM6hhz3u0DINMVZnPj4EU5p_w-Dm4,29
|
|
37
|
+
revfly-2.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""REvFLY motor-rate control and simulation engine."""
|
|
2
|
+
|
|
3
|
+
from .contracts import (
|
|
4
|
+
AssetValidationError,
|
|
5
|
+
Backend,
|
|
6
|
+
BackendIdentity,
|
|
7
|
+
BackendSessionError,
|
|
8
|
+
BackendTimeoutError,
|
|
9
|
+
BackendUnavailableError,
|
|
10
|
+
CONTROL_STEPS,
|
|
11
|
+
CONTROL_TIMESTEP_S,
|
|
12
|
+
ClosedLoopCapableBackend,
|
|
13
|
+
ClosedLoopRequest,
|
|
14
|
+
DEFAULT_DIRECTION_EPS,
|
|
15
|
+
DEFAULT_DIRECTION_SEED,
|
|
16
|
+
DEFAULT_FEEDBACK_KD,
|
|
17
|
+
DEFAULT_FEEDBACK_KP,
|
|
18
|
+
DEFAULT_JACOBIAN_EPS,
|
|
19
|
+
DURATION_S,
|
|
20
|
+
EXT_TO_FLEX_RATIO,
|
|
21
|
+
Evaluation,
|
|
22
|
+
EvaluationRequest,
|
|
23
|
+
EXPECTED_TEACHER_SHA256,
|
|
24
|
+
EXPECTED_XML_SHA256,
|
|
25
|
+
InitialState,
|
|
26
|
+
LF_ACTUATOR_COLUMNS,
|
|
27
|
+
LF_ACTUATOR_NAMES,
|
|
28
|
+
LF_JOINT_GROUPS,
|
|
29
|
+
LF_JOINT_NAMES,
|
|
30
|
+
LF_QPOS_ADDRESSES,
|
|
31
|
+
MultiJointCapableBackend,
|
|
32
|
+
MultiJointClosedLoopRequest,
|
|
33
|
+
MultiJointEvaluationRequest,
|
|
34
|
+
NA,
|
|
35
|
+
NQ,
|
|
36
|
+
NSTATE,
|
|
37
|
+
NU,
|
|
38
|
+
NV,
|
|
39
|
+
PHYSICS_TIMESTEP_S,
|
|
40
|
+
PROFILES,
|
|
41
|
+
RateBoundaryError,
|
|
42
|
+
RenderCapableBackend,
|
|
43
|
+
RenderResult,
|
|
44
|
+
RequestValidationError,
|
|
45
|
+
STATE_KEYS,
|
|
46
|
+
STATE_STEPS,
|
|
47
|
+
SUBSTEPS,
|
|
48
|
+
Session,
|
|
49
|
+
SessionSpec,
|
|
50
|
+
TARGET_ACTUATOR_COLUMNS,
|
|
51
|
+
TARGET_ACTUATOR_NAMES,
|
|
52
|
+
TARGET_JOINT,
|
|
53
|
+
TARGET_QPOS_ADDRESS,
|
|
54
|
+
TRACE_KEYS,
|
|
55
|
+
TRACE_SHAPES,
|
|
56
|
+
V2Error,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
__version__ = "2.0.0"
|
|
60
|
+
|
|
61
|
+
__all__ = [
|
|
62
|
+
"__version__",
|
|
63
|
+
"AssetValidationError",
|
|
64
|
+
"Backend",
|
|
65
|
+
"BackendIdentity",
|
|
66
|
+
"BackendSessionError",
|
|
67
|
+
"BackendTimeoutError",
|
|
68
|
+
"BackendUnavailableError",
|
|
69
|
+
"CONTROL_STEPS",
|
|
70
|
+
"CONTROL_TIMESTEP_S",
|
|
71
|
+
"ClosedLoopCapableBackend",
|
|
72
|
+
"ClosedLoopRequest",
|
|
73
|
+
"DEFAULT_DIRECTION_EPS",
|
|
74
|
+
"DEFAULT_DIRECTION_SEED",
|
|
75
|
+
"DEFAULT_FEEDBACK_KD",
|
|
76
|
+
"DEFAULT_FEEDBACK_KP",
|
|
77
|
+
"DEFAULT_JACOBIAN_EPS",
|
|
78
|
+
"DURATION_S",
|
|
79
|
+
"EXT_TO_FLEX_RATIO",
|
|
80
|
+
"Evaluation",
|
|
81
|
+
"EvaluationRequest",
|
|
82
|
+
"EXPECTED_TEACHER_SHA256",
|
|
83
|
+
"EXPECTED_XML_SHA256",
|
|
84
|
+
"InitialState",
|
|
85
|
+
"LF_ACTUATOR_COLUMNS",
|
|
86
|
+
"LF_ACTUATOR_NAMES",
|
|
87
|
+
"LF_JOINT_GROUPS",
|
|
88
|
+
"LF_JOINT_NAMES",
|
|
89
|
+
"LF_QPOS_ADDRESSES",
|
|
90
|
+
"MultiJointCapableBackend",
|
|
91
|
+
"MultiJointClosedLoopRequest",
|
|
92
|
+
"MultiJointEvaluationRequest",
|
|
93
|
+
"NA",
|
|
94
|
+
"NQ",
|
|
95
|
+
"NSTATE",
|
|
96
|
+
"NU",
|
|
97
|
+
"NV",
|
|
98
|
+
"PHYSICS_TIMESTEP_S",
|
|
99
|
+
"PROFILES",
|
|
100
|
+
"RateBoundaryError",
|
|
101
|
+
"RenderCapableBackend",
|
|
102
|
+
"RenderResult",
|
|
103
|
+
"RequestValidationError",
|
|
104
|
+
"STATE_KEYS",
|
|
105
|
+
"STATE_STEPS",
|
|
106
|
+
"SUBSTEPS",
|
|
107
|
+
"Session",
|
|
108
|
+
"SessionSpec",
|
|
109
|
+
"TARGET_ACTUATOR_COLUMNS",
|
|
110
|
+
"TARGET_ACTUATOR_NAMES",
|
|
111
|
+
"TARGET_JOINT",
|
|
112
|
+
"TARGET_QPOS_ADDRESS",
|
|
113
|
+
"TRACE_KEYS",
|
|
114
|
+
"TRACE_SHAPES",
|
|
115
|
+
"V2Error",
|
|
116
|
+
]
|