Commit graph

4 commits

Author SHA1 Message Date
cb452ad5e4 fix(arm_main): remove dead plt import, path_history leak, fix OFFSET init
- Delete `import matplotlib.pyplot as plt` (never used, ~100ms startup cost)
- Delete `self.path_history` list and the redundant FK call in `_send_and_audit`
  that fed it — free FK invocation per motion step with zero readers
- Init `self.OFFSET_Y/Z` from `config.*` directly instead of hardcoding 0.0
- Remove redundant `set_correction` + `set_damping_params` calls from
  `AutoGraspSystem.__init__` and `__main__` (both now duplicate what `__init__` does)

Closes #8
2026-02-20 21:45:04 +08:00
54c1dc8c01 refactor: extract magic constants to config.py (closes #7)
Create config.py with env-var-overridable hardware constants:
- SERIAL_PORT / SERIAL_BAUD
- LLM_MODEL_PATH / YOLO_MODEL_PATH
- Z_HOVER / Z_GRAB / Z_AFTER_PICK  (Z_TABLE eliminated — same as Z_GRAB)
- REST_X / REST_Y / REST_Z         (replaces three copies of [120,0,60])
- WS_X / WS_Y / WS_Z              (workspace clipping bounds)
- DAMPING_BUFFER_SIZE / DAMPING_MAX_SPEED / DAMPING_FACTOR
- OFFSET_Y / OFFSET_Z

arm_main.py: port/baud/damping defaults now read from config.
voice_main.py: all magic constants replaced; remaining Chinese
non-i18n strings translated to English.
.gitignore: whitelist config.py.
2026-02-20 20:56:52 +08:00
f1df158d56 fix(arm_main): replace bare except with SerialException, use deque for servo_buffer
- Replace `except:` with `except serial.SerialException as e` to prevent
  silently swallowing KeyboardInterrupt and other system exceptions (#1)
- Replace list + pop(0) with collections.deque(maxlen=N) for O(1) buffer
  management; removes manual length check in _send_and_audit (#6)
- Rebuild deque in set_damping_params when buffer_size changes
- Translate all Chinese log messages and comments to English (#5)
- Minor: sort imports (stdlib before third-party)
2026-02-20 20:22:12 +08:00
whisper11111111111
bb85c3266b Initial commit for robot arm voice control system 2026-02-10 23:31:14 +08:00