vrc-autopilot 1.0.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 (75) hide show
  1. vrc_autopilot-1.0.0/.gitattributes +19 -0
  2. vrc_autopilot-1.0.0/.github/workflows/publish.yml +73 -0
  3. vrc_autopilot-1.0.0/.gitignore +226 -0
  4. vrc_autopilot-1.0.0/.python-version +1 -0
  5. vrc_autopilot-1.0.0/LICENSE +24 -0
  6. vrc_autopilot-1.0.0/PKG-INFO +56 -0
  7. vrc_autopilot-1.0.0/README.md +39 -0
  8. vrc_autopilot-1.0.0/docs/architecture.md +93 -0
  9. vrc_autopilot-1.0.0/docs/gain-tuning.md +168 -0
  10. vrc_autopilot-1.0.0/docs/loop-bode.png +0 -0
  11. vrc_autopilot-1.0.0/docs/system-identification.md +88 -0
  12. vrc_autopilot-1.0.0/docs/usage.md +25 -0
  13. vrc_autopilot-1.0.0/docs/verification.md +100 -0
  14. vrc_autopilot-1.0.0/examples/dekapu/main.py +72 -0
  15. vrc_autopilot-1.0.0/examples/dekapu/room.npz +0 -0
  16. vrc_autopilot-1.0.0/examples/dekapu/room.png +0 -0
  17. vrc_autopilot-1.0.0/pyproject.toml +63 -0
  18. vrc_autopilot-1.0.0/src/vrc_autopilot/__init__.py +19 -0
  19. vrc_autopilot-1.0.0/src/vrc_autopilot/_version.py +24 -0
  20. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/__init__.py +0 -0
  21. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/_keys.py +14 -0
  22. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/_logging.py +9 -0
  23. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/bode_margins.py +45 -0
  24. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/calibrate_world.py +110 -0
  25. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/decode_demo.py +56 -0
  26. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/find_button.py +46 -0
  27. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/log_video.py +592 -0
  28. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/map_room.py +162 -0
  29. vrc_autopilot-1.0.0/src/vrc_autopilot/cli/probe_axes.py +259 -0
  30. vrc_autopilot-1.0.0/src/vrc_autopilot/control/__init__.py +0 -0
  31. vrc_autopilot-1.0.0/src/vrc_autopilot/control/actuator.py +92 -0
  32. vrc_autopilot-1.0.0/src/vrc_autopilot/control/controller.py +247 -0
  33. vrc_autopilot-1.0.0/src/vrc_autopilot/control/guidance.py +99 -0
  34. vrc_autopilot-1.0.0/src/vrc_autopilot/control/loop_analysis.py +198 -0
  35. vrc_autopilot-1.0.0/src/vrc_autopilot/control/maneuvers.py +728 -0
  36. vrc_autopilot-1.0.0/src/vrc_autopilot/control/osc.py +68 -0
  37. vrc_autopilot-1.0.0/src/vrc_autopilot/control/pid.py +73 -0
  38. vrc_autopilot-1.0.0/src/vrc_autopilot/control/pilot.py +674 -0
  39. vrc_autopilot-1.0.0/src/vrc_autopilot/control/recording.py +166 -0
  40. vrc_autopilot-1.0.0/src/vrc_autopilot/core/__init__.py +0 -0
  41. vrc_autopilot-1.0.0/src/vrc_autopilot/core/pose.py +44 -0
  42. vrc_autopilot-1.0.0/src/vrc_autopilot/mapping/__init__.py +0 -0
  43. vrc_autopilot-1.0.0/src/vrc_autopilot/mapping/draw.py +103 -0
  44. vrc_autopilot-1.0.0/src/vrc_autopilot/mapping/live.py +89 -0
  45. vrc_autopilot-1.0.0/src/vrc_autopilot/mapping/mapper.py +472 -0
  46. vrc_autopilot-1.0.0/src/vrc_autopilot/perception/__init__.py +0 -0
  47. vrc_autopilot-1.0.0/src/vrc_autopilot/perception/capture.py +195 -0
  48. vrc_autopilot-1.0.0/src/vrc_autopilot/perception/decode.py +106 -0
  49. vrc_autopilot-1.0.0/src/vrc_autopilot/perception/encode.py +76 -0
  50. vrc_autopilot-1.0.0/src/vrc_autopilot/perception/reader.py +217 -0
  51. vrc_autopilot-1.0.0/src/vrc_autopilot/perception/spec.py +31 -0
  52. vrc_autopilot-1.0.0/src/vrc_autopilot/py.typed +0 -0
  53. vrc_autopilot-1.0.0/src/vrc_autopilot/spatial/__init__.py +0 -0
  54. vrc_autopilot-1.0.0/src/vrc_autopilot/spatial/navigation.py +388 -0
  55. vrc_autopilot-1.0.0/src/vrc_autopilot/spatial/triangulate.py +133 -0
  56. vrc_autopilot-1.0.0/src/vrc_autopilot/sysid/__init__.py +0 -0
  57. vrc_autopilot-1.0.0/src/vrc_autopilot/sysid/adaptive.py +287 -0
  58. vrc_autopilot-1.0.0/src/vrc_autopilot/sysid/identify.py +974 -0
  59. vrc_autopilot-1.0.0/src/vrc_autopilot/sysid/sim_plant.py +227 -0
  60. vrc_autopilot-1.0.0/src/vrc_autopilot/sysid/worldcal.py +301 -0
  61. vrc_autopilot-1.0.0/tests/test_actuator.py +80 -0
  62. vrc_autopilot-1.0.0/tests/test_adaptive.py +263 -0
  63. vrc_autopilot-1.0.0/tests/test_guidance.py +81 -0
  64. vrc_autopilot-1.0.0/tests/test_maneuvers.py +116 -0
  65. vrc_autopilot-1.0.0/tests/test_mapping.py +343 -0
  66. vrc_autopilot-1.0.0/tests/test_navigation.py +428 -0
  67. vrc_autopilot-1.0.0/tests/test_osc.py +103 -0
  68. vrc_autopilot-1.0.0/tests/test_pid.py +143 -0
  69. vrc_autopilot-1.0.0/tests/test_pilot.py +718 -0
  70. vrc_autopilot-1.0.0/tests/test_recording.py +36 -0
  71. vrc_autopilot-1.0.0/tests/test_roundtrip.py +149 -0
  72. vrc_autopilot-1.0.0/tests/test_sysid.py +469 -0
  73. vrc_autopilot-1.0.0/tests/test_triangulate.py +107 -0
  74. vrc_autopilot-1.0.0/tests/test_worldcal.py +594 -0
  75. vrc_autopilot-1.0.0/uv.lock +511 -0
@@ -0,0 +1,19 @@
1
+ # Normalize all text files to LF line endings on checkin/checkout,
2
+ # regardless of the OS or editor used to create/edit them.
3
+ * text=auto eol=lf
4
+
5
+ # Explicit text types
6
+ *.py text eol=lf
7
+ *.md text eol=lf
8
+ *.toml text eol=lf
9
+ *.json text eol=lf
10
+ *.csv text eol=lf
11
+ *.shader text eol=lf
12
+ *.lock text eol=lf
13
+ *.gitignore text eol=lf
14
+ *.gitattributes text eol=lf
15
+
16
+ # Binary types — do not touch line endings
17
+ *.png binary
18
+ *.npz binary
19
+ *.pyc binary
@@ -0,0 +1,73 @@
1
+ name: Publish
2
+
3
+ # Tag push (v*) -> build and publish to PyPI via Trusted Publishing (OIDC, no API token).
4
+ # Manual run (workflow_dispatch) -> publish to TestPyPI for a dry run.
5
+ on:
6
+ push:
7
+ tags:
8
+ - "v*"
9
+ workflow_dispatch:
10
+
11
+ jobs:
12
+ build:
13
+ name: Build distributions
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ with:
18
+ # hatch-vcs derives the version from git tags, so full history is required.
19
+ fetch-depth: 0
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v6
23
+
24
+ - name: Build sdist and wheel
25
+ run: uv build
26
+
27
+ - name: Show built version
28
+ run: ls -l dist
29
+
30
+ - uses: actions/upload-artifact@v4
31
+ with:
32
+ name: dist
33
+ path: dist/
34
+
35
+ publish-pypi:
36
+ name: Publish to PyPI
37
+ needs: build
38
+ if: github.event_name == 'push'
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/project/vrc-autopilot/
43
+ permissions:
44
+ id-token: write # required for Trusted Publishing (OIDC)
45
+ steps:
46
+ - uses: actions/download-artifact@v4
47
+ with:
48
+ name: dist
49
+ path: dist/
50
+
51
+ - name: Publish to PyPI
52
+ uses: pypa/gh-action-pypi-publish@release/v1
53
+
54
+ publish-testpypi:
55
+ name: Publish to TestPyPI
56
+ needs: build
57
+ if: github.event_name == 'workflow_dispatch'
58
+ runs-on: ubuntu-latest
59
+ environment:
60
+ name: testpypi
61
+ url: https://test.pypi.org/project/vrc-autopilot/
62
+ permissions:
63
+ id-token: write # required for Trusted Publishing (OIDC)
64
+ steps:
65
+ - uses: actions/download-artifact@v4
66
+ with:
67
+ name: dist
68
+ path: dist/
69
+
70
+ - name: Publish to TestPyPI
71
+ uses: pypa/gh-action-pypi-publish@release/v1
72
+ with:
73
+ repository-url: https://test.pypi.org/legacy/
@@ -0,0 +1,226 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
201
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
203
+ # you could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+
222
+ maps/
223
+ logs/
224
+
225
+ # hatch-vcs generated version file
226
+ src/vrc_autopilot/_version.py
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,24 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2026, njm2360
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,56 @@
1
+ Metadata-Version: 2.4
2
+ Name: vrc-autopilot
3
+ Version: 1.0.0
4
+ Summary: VRChat AutoPilot
5
+ Project-URL: Homepage, https://github.com/njm2360/vrc-autopilot
6
+ Project-URL: Repository, https://github.com/njm2360/vrc-autopilot
7
+ License-Expression: BSD-2-Clause
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.14
10
+ Requires-Dist: matplotlib>=3.11
11
+ Requires-Dist: mss>=10.2
12
+ Requires-Dist: numpy>=2.5
13
+ Requires-Dist: pydirectinput>=1.0.4
14
+ Requires-Dist: python-osc>=1.10
15
+ Requires-Dist: scipy>=1.18
16
+ Description-Content-Type: text/markdown
17
+
18
+ # vrc-autopilot
19
+
20
+ [VRCPositionHUD](https://github.com/njm2360/vrc-position-hud)を利用してOSCで移動・視点を操作する自動化ツール
21
+
22
+ > [!WARNING]
23
+ > 本ツールの使用によって生じたいかなる結果についても、作者は一切の責任を負いません。自己責任で使用してください。
24
+ > 使用にあたっては各ワールド・コミュニティのルールに従ってください。自動化を歓迎しない場所では使わないこと。
25
+
26
+ - 全体像とモジュール対応: [docs/architecture.md](docs/architecture.md)
27
+ - プラント特性の測定手順: [docs/system-identification.md](docs/system-identification.md)
28
+ - 制御ゲインの根拠と調整手順: [docs/gain-tuning.md](docs/gain-tuning.md)
29
+ - オフライン検証の組み方: [docs/verification.md](docs/verification.md)
30
+ - 各コマンドの使用方法: [docs/usage.md](docs/usage.md)
31
+
32
+ ## 動作環境
33
+
34
+ - Python 3.14
35
+ - [uv](https://docs.astral.sh/uv/)
36
+
37
+ ## サンプルコード
38
+
39
+ 移動・照準・押下は `Pilot` API で記述する。マップ・プラント・ボタン座標を渡して巡回ルートを組む。
40
+
41
+ - [でかプ 軽量化スイッチ自動化](examples/dekapu/main.py)
42
+ ※マップデータ同梱
43
+
44
+ ## CLI
45
+
46
+ `uv run <コマンド>` で実行する。フラグ詳細は各 `--help` で確認可能
47
+
48
+ | コマンド | 用途 |
49
+ | ----------------- | ---------------------------------------------------------------------------- |
50
+ | `decode-demo` | HUD を読み取り 6DoF を表示(動作確認とキャリブレーション) |
51
+ | `map-room` | 壁沿いに歩いて部屋マップを記録 |
52
+ | `find-button` | 複数地点からボタンを三角測量 |
53
+ | `probe-axes` | 入力軸の応答特性を測って `plant.json` に同定(制御ゲインの前提) |
54
+ | `calibrate-world` | ワールドごとに変わる移動速度を測り、ゲインの倍率を補正 |
55
+ | `bode-margins` | 同定プラント上で全制御ループの安定余裕(ωc/PM/GM)とボード線図を出す(実機不要) |
56
+ | `log-video` | 制御ログCSVを一人称3D+2D地図の動画(mp4)に再生 |
@@ -0,0 +1,39 @@
1
+ # vrc-autopilot
2
+
3
+ [VRCPositionHUD](https://github.com/njm2360/vrc-position-hud)を利用してOSCで移動・視点を操作する自動化ツール
4
+
5
+ > [!WARNING]
6
+ > 本ツールの使用によって生じたいかなる結果についても、作者は一切の責任を負いません。自己責任で使用してください。
7
+ > 使用にあたっては各ワールド・コミュニティのルールに従ってください。自動化を歓迎しない場所では使わないこと。
8
+
9
+ - 全体像とモジュール対応: [docs/architecture.md](docs/architecture.md)
10
+ - プラント特性の測定手順: [docs/system-identification.md](docs/system-identification.md)
11
+ - 制御ゲインの根拠と調整手順: [docs/gain-tuning.md](docs/gain-tuning.md)
12
+ - オフライン検証の組み方: [docs/verification.md](docs/verification.md)
13
+ - 各コマンドの使用方法: [docs/usage.md](docs/usage.md)
14
+
15
+ ## 動作環境
16
+
17
+ - Python 3.14
18
+ - [uv](https://docs.astral.sh/uv/)
19
+
20
+ ## サンプルコード
21
+
22
+ 移動・照準・押下は `Pilot` API で記述する。マップ・プラント・ボタン座標を渡して巡回ルートを組む。
23
+
24
+ - [でかプ 軽量化スイッチ自動化](examples/dekapu/main.py)
25
+ ※マップデータ同梱
26
+
27
+ ## CLI
28
+
29
+ `uv run <コマンド>` で実行する。フラグ詳細は各 `--help` で確認可能
30
+
31
+ | コマンド | 用途 |
32
+ | ----------------- | ---------------------------------------------------------------------------- |
33
+ | `decode-demo` | HUD を読み取り 6DoF を表示(動作確認とキャリブレーション) |
34
+ | `map-room` | 壁沿いに歩いて部屋マップを記録 |
35
+ | `find-button` | 複数地点からボタンを三角測量 |
36
+ | `probe-axes` | 入力軸の応答特性を測って `plant.json` に同定(制御ゲインの前提) |
37
+ | `calibrate-world` | ワールドごとに変わる移動速度を測り、ゲインの倍率を補正 |
38
+ | `bode-margins` | 同定プラント上で全制御ループの安定余裕(ωc/PM/GM)とボード線図を出す(実機不要) |
39
+ | `log-video` | 制御ログCSVを一人称3D+2D地図の動画(mp4)に再生 |
@@ -0,0 +1,93 @@
1
+ # アーキテクチャ概要
2
+
3
+ ## パイプライン
4
+
5
+ ```txt
6
+ VRChat 画面(HUDビットグリッド)
7
+ │ スクリーンキャプチャ(ネイティブ解像度・クライアント左上の小領域)
8
+
9
+ [capture] WindowsVRChatCapture ──► フレーム(numpy)
10
+
11
+
12
+ [decode] decode_frame ──► DecodeResult(Pose + 検証結果)
13
+
14
+
15
+ [reader] PoseReader(スレッドで読み続ける・統計・コールバック/ジェネレータ)
16
+
17
+ ├─► [mapping] RoomMapper ──► 部屋の地図(占有グリッド/間取り図)
18
+ ├─► [triangulate] Sighting/triangulate ──► ボタンのワールド座標(最小二乗交点)
19
+ └─► [navigation] NavGrid + plan_path ──► 壁を避けた経路
20
+
21
+
22
+ [pilot / maneuvers] goto / aim / activate(フェーズ連結と制御ループ)
23
+ │ [guidance] で誤差を計算し、[controller] AxisController(PID) が指令[-1,1] に変換
24
+
25
+ [actuator] LookActuator / MoveActuator
26
+ ├─ OSC: VRChatOSC ──► /input/* を注入
27
+ └─ DirectInput: MouseLookActuator ──► 相対マウス(視点のみ)
28
+ ```
29
+
30
+ ## モジュール(`src/vrc_autopilot/`)
31
+
32
+ ### `core/` — 全層が参照する中核型
33
+
34
+ | モジュール | 役割 |
35
+ | -------------- | ----------------------- |
36
+ | `core/pose.py` | `Pose`(6DoF ドメイン型) |
37
+
38
+ ### `perception/` — VRChat 画面 → Pose
39
+
40
+ | モジュール | 役割 |
41
+ | ----------------------- | --------------------------------------------------------------- |
42
+ | `perception/spec.py` | グリッド/プロトコルの確定定数(モジュール定数。シェーダーと一致) |
43
+ | `perception/capture.py` | Windows/VRChat ウィンドウキャプチャ(DPI対応、`FrameSource`) |
44
+ | `perception/decode.py` | numpy ベクトル化デコード + 検証(`decode_frame` / `decode_pose`) |
45
+ | `perception/encode.py` | 合成エンコーダ(`render_pose`)。テスト用 |
46
+ | `perception/reader.py` | `PoseReader`(スレッドで読み続ける・統計・ジェネレータ) |
47
+
48
+ ### `mapping/` — 部屋地図
49
+
50
+ | モジュール | 役割 |
51
+ | ------------------- | ---------------------------------------------------------------------- |
52
+ | `mapping/mapper.py` | `RoomMapper`。軌跡→寸法・占有グリッド・外周/内壁ポリゴン・保存/読込 |
53
+ | `mapping/draw.py` | 地図の描画・PNG 保存(バックエンド非依存の `draw_map` / `save_map_png`) |
54
+ | `mapping/live.py` | 録画中のライブ地図表示(matplotlib インタラクティブ) |
55
+
56
+ ### `spatial/` — 空間推定・経路計画
57
+
58
+ | モジュール | 役割 |
59
+ | ------------------------ | -------------------------------------------------- |
60
+ | `spatial/triangulate.py` | 視線レイの最小二乗交点でボタン座標を推定 |
61
+ | `spatial/navigation.py` | 歩行可能グリッド生成(壁回避)+ A\* + 経由点の直線化 |
62
+
63
+ ### `control/` — 閉ループ制御 + VRChat 出力
64
+
65
+ | モジュール | 役割 |
66
+ | -------------------------- | -------------------------------------------------------------------------------------- |
67
+ | `control/guidance.py` | フレーム単位の照準幾何(`wrap180` / `heading_error` / `pitch_error` / `forward_factor`) |
68
+ | `control/pid.py` | 汎用 PID(離散・積分の溜まりすぎ防止・不感帯補償) |
69
+ | `control/controller.py` | `AxisController`(PID+tolゲート)/ `ControlTuning` / 制御器ビルダー |
70
+ | `control/loop_analysis.py` | ループ整形解析(安定余裕・ボード線図。`analyze_loops` / `save_bode_png`) |
71
+ | `control/actuator.py` | `LookActuator`/`MoveActuator` IF + `MouseLookActuator`(DirectInput) |
72
+ | `control/osc.py` | VRChat への OSC 送信(look/move/stop で両 actuator IF を満たす) |
73
+ | `control/recording.py` | `Recorder` IF(`ControlLog`=CSV / `ListRecorder`)+ `AxisMetrics`(応答指標) |
74
+ | `control/maneuvers.py` | 制御ループの部品(`follow_path`(carrot追従)/ `aim_at` / `strafe_align` / `turn_to`) |
75
+ | `control/pilot.py` | `Pilot` ファサード(経路計画+ループ連結。実機 I/O は `connect()` に集約) |
76
+
77
+ ### `sysid/` — システム同定・シミュレーション
78
+
79
+ | モジュール | 役割 |
80
+ | -------------------- | -------------------------------------------------------------------------------------- |
81
+ | `sysid/identify.py` | システム同定(プローブ注入・静特性/むだ時間/dt 抽出・`PlantModel` JSON) |
82
+ | `sysid/sim_plant.py` | `SimulatedVRChat`(同定モデルを積分。PoseSource+両 Actuator を満たし制御ループに注入可) |
83
+
84
+ ## CLI
85
+
86
+ | コマンド | スクリプト | 用途 |
87
+ | -------------- | --------------------- | ----------------------------------------------------------------- |
88
+ | `decode-demo` | `cli/decode_demo.py` | HUD を読み取り 6DoF を表示(動作確認) |
89
+ | `map-room` | `cli/map_room.py` | 壁沿いに歩いて部屋マップを記録(SPACE一時停止・日時フォルダ出力) |
90
+ | `find-button` | `cli/find_button.py` | 複数地点からボタンを三角測量(SPACE/r/q) |
91
+ | `probe-axes` | `cli/probe_axes.py` | 入力軸の応答特性を測定し `plant.json` に同定(--from-log で再同定) |
92
+ | `bode-margins` | `cli/bode_margins.py` | 同定プラント上で全ループの安定余裕とボード線図を出す(実機不要) |
93
+ | `log-video` | `cli/log_video.py` | 制御ログCSVを一人称3D+2D地図の動画に再生(目視確認用) |