12 Commits

Author SHA1 Message Date
c331d0bac0 fix(legs, balance): invert wheel1/3 velocities and persist offset state
- Negated velocities for wheel1 and wheel3 in `control_wheels_vel` to match hardware direction, ensuring correct movement.
- Introduced `self.offs` in `BalanceController` to store offset values across calls instead of recreating them each update.
- Refactored `_update_offsets` to operate on the instance offsets, increased threshold sensitivity from 0.2 to 1, and adjusted scaling factors for smoother offset accumulation.
- Simplified offset limiting and normalization logic, removing redundant local variables.
- Updated `run_balance_loop` to initialize and use the persistent `self.offs` state.

These changes fix incorrect wheel commands and improve the stability and accuracy of the balance controller's offset handling.
2025-12-21 11:23:46 +08:00
7c3d18ffcb fix(balance): correct IMU import and add quick_test entrypoint
- Updated import in `balance.py` from `dm_imu_pkg` to the correct `dm_imu` package.
- Introduced `quick_test()` function as a convenient debugging entry point, moving the previous script execution logic into this callable.
- Modified `__main__` block to display a UI usage message instead of directly running the balance loop.
- Revised `dm_imu.egg-info/PKG-INFO` to reflect the new Gradio‑based control panel documentation and project description.
2025-12-11 12:12:12 +08:00
06482c14de modified: README.md 2025-12-10 22:37:41 +08:00
6df70b0bb6 docs: rewrite README to introduce Gradio‑based quadruped control panel
The README was completely overhauled to reflect the new focus of the repository.
- Replaced the original DM‑IMU driver description with documentation for a web‑based control panel built with Gradio.
- Added sections covering project overview, environment requirements, quick installation, usage instructions, main features, and code structure.
- Updated installation steps to include Python dependencies and optional C++ IMU driver compilation.
- Provided run instructions for the UI and clarified how the BalanceController and LegsController interact with the IMU driver.
- Improved navigation with a table of contents and clearer headings for easier consumption.
2025-12-10 22:35:01 +08:00
35efbfc91a refactor(build): restructure package layout and fix CMake build directory restoration
- Update pybind_src to point to project root instead of dm_imu subdirectory
- Change CMakeExtension module from "imu_py" to "dm_imu.imu_py"
- Switch to find_packages() with package_dir for automatic package discovery
- Add saving/restoring of CWD in CMake build to prevent directory side effects
2025-12-10 21:11:21 +08:00
ced3669fac refactor(package): rename to dm_imu and restructure directories
Renamed package from dm_imu_pkg to dm_imu across PKG-INFO, egg-info files,
and directories. Updated CMakeLists.txt, __init__.py, and top_level.txt to
reflect new structure. Bumped gradio version from <5.0 to <6.0 in
dependencies. This refactoring improves naming consistency and streamlines
the package layout for better maintainability.
2025-12-10 19:32:28 +08:00
e2287178fa feat(build): Add generated Python bytecode cache and update log
Add new .pyc files for Legs_controller, balance, and dm_imu_pkg __init__ modules,
and update DM_CAN .pyc. Append new log entry to ui.log for BalanceController
initialization attempt, indicafing code execution and cache generation.
2025-12-09 23:39:36 +08:00
f8d12a8348 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.
2025-12-09 22:55:35 +08:00
8c76cf23a7 feat: add runtime dependencies for IMU functionality
- Add numpy<2.0 for numerical computations with IMU data
- Add pyserial>=3.5 for serial communication with IMU hardware
- Add gradio for web-based user interface

These dependencies enable core features like data processing, hardware connectivity, and UI interaction for the IMU package. Updated pyproject.toml, with resulting changes in requires.txt and PKG-INFO.
2025-12-09 13:11:48 +08:00
c3dac34dcc feat: add IMU Python package with pybind11 bindings
- Add dm_imu_pkg/__init__.py to dynamically load compiled IMU module during development and installation
- Update .vscode/settings.json to ignore missing CMakeLists for flexible builds
- Generate egg-info metadata and package structure for distribution
2025-12-08 23:54:56 +08:00
74a2d8c355 new file: .vscode/settings.json
new file:   Legs_controller.py
	modified:   README.md
	new file:   __pycache__/Legs_controller.cpython-310.pyc
	new file:   __pycache__/Legs_controller.cpython-313.pyc
	new file:   __pycache__/balance.cpython-310.pyc
	new file:   __pycache__/gradio.cpython-310.pyc
	new file:   __pycache__/gradio.cpython-313.pyc
	new file:   app_ui.py
	new file:   balance.py
	new file:   build/.cmake/api/v1/query/client-vscode/query.json
	new file:   build/.cmake/api/v1/reply/cache-v2-ae4a9db768b4bbb36baa.json
	new file:   build/.cmake/api/v1/reply/cmakeFiles-v1-389eb8769a8295e7571d.json
	new file:   build/.cmake/api/v1/reply/codemodel-v2-5ea8cfc0b9263cbe5ae5.json
	new file:   build/.cmake/api/v1/reply/directory-.-Debug-f5ebdc15457944623624.json
	new file:   build/.cmake/api/v1/reply/index-2025-09-11T04-53-20-0515.json
	new file:   build/.cmake/api/v1/reply/target-imu_py-Debug-3913d741f2156d7faae9.json
	new file:   build/.cmake/api/v1/reply/toolchains-v1-3105704d088db7adbfb5.json
	new file:   build/CMakeCache.txt
	new file:   build/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake
	new file:   build/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin
	new file:   build/CMakeFiles/3.22.1/CMakeSystem.cmake
	new file:   build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
	new file:   build/CMakeFiles/3.22.1/CompilerIdCXX/a.out
	new file:   build/CMakeFiles/CMakeDirectoryInformation.cmake
	new file:   build/CMakeFiles/CMakeOutput.log
	new file:   build/CMakeFiles/Makefile.cmake
	new file:   build/CMakeFiles/Makefile2
	new file:   build/CMakeFiles/TargetDirectories.txt
	new file:   build/CMakeFiles/cmake.check_cache
	new file:   build/CMakeFiles/imu_py.dir/DependInfo.cmake
	new file:   build/CMakeFiles/imu_py.dir/build.make
	new file:   build/CMakeFiles/imu_py.dir/cmake_clean.cmake
	new file:   build/CMakeFiles/imu_py.dir/compiler_depend.make
	new file:   build/CMakeFiles/imu_py.dir/compiler_depend.ts
	new file:   build/CMakeFiles/imu_py.dir/depend.make
	new file:   build/CMakeFiles/imu_py.dir/flags.make
	new file:   build/CMakeFiles/imu_py.dir/link.txt
	new file:   build/CMakeFiles/imu_py.dir/progress.make
	new file:   build/CMakeFiles/progress.marks
	new file:   build/Makefile
	new file:   build/cmake_install.cmake
	new file:   build/compile_commands.json
	new file:   dm_imu/bsp_crc.cpp
	new file:   dm_imu/bsp_crc.h
	new file:   dm_imu/imu_data.csv
	new file:   dm_imu/imu_driver.cpp
	new file:   dm_imu/imu_driver.h
	new file:   dm_imu/imu_plot.png
	new file:   dm_imu/plot_imu.py
	new file:   dm_imu/test_imu.cpp
	new file:   imu_data.csv
	new file:   pybind_imu/CMakeLists.txt
	new file:   pybind_imu/README.md
	new file:   pybind_imu/build/CMakeCache.txt
	new file:   pybind_imu/build/CMakeFiles/3.22.1/CMakeCXXCompiler.cmake
	new file:   pybind_imu/build/CMakeFiles/3.22.1/CMakeDetermineCompilerABI_CXX.bin
	new file:   pybind_imu/build/CMakeFiles/3.22.1/CMakeSystem.cmake
	new file:   pybind_imu/build/CMakeFiles/3.22.1/CompilerIdCXX/CMakeCXXCompilerId.cpp
	new file:   pybind_imu/build/CMakeFiles/3.22.1/CompilerIdCXX/a.out
	new file:   pybind_imu/build/CMakeFiles/CMakeDirectoryInformation.cmake
	new file:   pybind_imu/build/CMakeFiles/CMakeOutput.log
	new file:   pybind_imu/build/CMakeFiles/Makefile.cmake
	new file:   pybind_imu/build/CMakeFiles/Makefile2
	new file:   pybind_imu/build/CMakeFiles/TargetDirectories.txt
	new file:   pybind_imu/build/CMakeFiles/cmake.check_cache
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/DependInfo.cmake
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/build.make
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/cmake_clean.cmake
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/compiler_depend.make
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/compiler_depend.ts
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/depend.make
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/flags.make
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/home/allenyuan/balance/dm_imu/bsp_crc.cpp.o
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/home/allenyuan/balance/dm_imu/bsp_crc.cpp.o.d
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/home/allenyuan/balance/dm_imu/imu_driver.cpp.o
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/home/allenyuan/balance/dm_imu/imu_driver.cpp.o.d
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/link.txt
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/progress.make
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/pybind_imu.cpp.o
	new file:   pybind_imu/build/CMakeFiles/imu_py.dir/pybind_imu.cpp.o.d
	new file:   pybind_imu/build/CMakeFiles/progress.marks
	new file:   pybind_imu/build/Makefile
	new file:   pybind_imu/build/cmake_install.cmake
	new file:   pybind_imu/build/imu_py.cpython-310-aarch64-linux-gnu.so
	new file:   pybind_imu/example.py
	new file:   pybind_imu/pybind_imu.cpp
	new file:   src/example.py
	new file:   test_imu
	new file:   u2can/DM_CAN.py
	new file:   u2can/DM_Motor_Test.py
	new file:   u2can/LICENSE
	new file:   u2can/README.md
	new file:   u2can/__pycache__/DM_CAN.cpython-310.pyc
	new file:   u2can/__pycache__/DM_CAN.cpython-312.pyc
	new file:   u2can/__pycache__/DM_CAN.cpython-313.pyc
	new file:   u2can/__pycache__/gradio.cpython-313.pyc
	new file:   u2can/__pycache__/motor_interface.cpython-313.pyc
	new file:   u2can/motor_interface.py
	new file:   u2can/requirements.txt
	new file:   ui.log
2025-12-06 22:47:57 +08:00
d3bb4f293d Initial commit 2025-12-06 22:42:06 +08:00