feat: refactor project structure and update dependencies
- Rename app_ui.py to main.py for better naming convention - Update balance.py import to use dm_imu_pkg.dm_imu_py for modularity - Constrain Gradio version to <5.0 in pyproject.toml and <6.0 in PKG-INFO for compatibility - Add compiled .so file for dm_imu_pkg and update cached .pyc files after builds - Include motors_enabled flag in main.py UI for better state management These changes improve code organization, resolve potential import issues, and ensure dependency compatibility in the balance controller project.
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
__pycache__/main.cpython-310.pyc
Normal file
BIN
__pycache__/main.cpython-310.pyc
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
import time
|
||||
import imu_py
|
||||
from dm_imu_pkg import imu_py
|
||||
from Legs_controller import LegsController
|
||||
|
||||
class BalanceController:
|
||||
|
||||
@@ -13,7 +13,7 @@ License-File: LICENSE
|
||||
Requires-Dist: pybind11>=2.10
|
||||
Requires-Dist: numpy<2.0
|
||||
Requires-Dist: pyserial>=3.5
|
||||
Requires-Dist: gradio
|
||||
Requires-Dist: gradio<5.0
|
||||
Dynamic: author
|
||||
Dynamic: license-file
|
||||
Dynamic: requires-python
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pybind11>=2.10
|
||||
numpy<2.0
|
||||
pyserial>=3.5
|
||||
gradio
|
||||
gradio<5.0
|
||||
|
||||
BIN
dm_imu_pkg/imu_py.cpython-312-darwin.so
Executable file
BIN
dm_imu_pkg/imu_py.cpython-312-darwin.so
Executable file
Binary file not shown.
@@ -27,6 +27,7 @@ def log(msg: str) -> None:
|
||||
# 全局状态
|
||||
# -------------------------------------------------
|
||||
controller: BalanceController | None = None # 单例
|
||||
motors_enabled = False # 电机使能状态
|
||||
|
||||
# -------------------------------------------------
|
||||
# 安全创建 BalanceController(带重试)
|
||||
@@ -202,9 +203,9 @@ with gr.Blocks() as demo:
|
||||
start_btn = gr.Button("▶️ 启动平衡控制")
|
||||
status_box = gr.Textbox(label="状态", value=init_status, interactive=False)
|
||||
|
||||
enable_btn.click(fn=enable_all, inputs=None, outputs=[status_box, log_box])
|
||||
disable_btn.click(fn=disable_all, inputs=None, outputs=[status_box, log_box])
|
||||
start_btn.click(fn=start_balance, inputs=None, outputs=[status_box, log_box])
|
||||
enable_btn.click(fn=enable_all, inputs=None, outputs=[status_box, log_box])
|
||||
disable_btn.click(fn=disable_all, inputs=None, outputs=[status_box, log_box])
|
||||
start_btn.click(fn=start_balance, inputs=None, outputs=[status_box, log_box])
|
||||
|
||||
# 中间:位置控制
|
||||
with gr.Column():
|
||||
@@ -14,7 +14,7 @@ dependencies = [
|
||||
"pybind11>=2.10",
|
||||
"numpy<2.0",
|
||||
"pyserial>=3.5",
|
||||
"gradio",
|
||||
"gradio<6.0",
|
||||
]
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user