Commit graph

26 commits

Author SHA1 Message Date
85a1c92268 docs: fix Mermaid line breaks \n -> <br/> 2026-02-20 21:58:29 +08:00
a02a134ae6 docs: replace ASCII architecture diagram with Mermaid flowchart 2026-02-20 21:56:48 +08:00
881302c493 docs: split bilingual README into README.md (CN) + README_EN.md (EN) 2026-02-20 21:54:27 +08:00
d53269739d docs: update README for audio pipeline refactor and expanded config.py 2026-02-20 21:50:01 +08:00
0975d7da37
refactor: full cleanup — dead code, audio pipeline, helpers, ino translation
refactor: full cleanup — dead code, audio pipeline, helpers, ino translation
2026-02-20 21:46:25 +08:00
2d36633dcf chore(ino): translate main.ino comments and Serial output to English
All Chinese comments, Serial.println strings, and inline notes
translated to English per the project's English-first codebase rule.
No logic changes.

Closes #11
2026-02-20 21:45:36 +08:00
f2ad220cc8 refactor(audio): move full pipeline into RobotEar.get_text(); add config constants
config.py:
- Add AUDIO_SILENCE_THRESHOLD, AUDIO_SILENCE_MARGIN, AUDIO_MIN_DURATION,
  AUDIO_MAX_DURATION so all audio tunables live in one place

whisper_main.py:
- RobotEar.get_text() now owns the full pipeline: silence trimming,
  duration guards, WAV write, Whisper transcription with all options
- _fix_recognition() moved here from RobotApp (ASR post-processing
  belongs in the ear layer, not the application layer)
- Add `import re`, `import config`; remove unused `sounddevice` import

voice_main.py:
- Remove `import scipy.io.wavfile` (WAV handling moved to whisper_main)
- get_audio_text() is now a one-liner: return self.ear.get_text(self.audio_frames)
- Remove _fix_recognition() (lives in RobotEar now)

Closes #9
2026-02-20 21:45:16 +08:00
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
1d31dc5b96 docs: rewrite README (bilingual) + restructure documentation
- README.md: comprehensive bilingual (CN+EN) rewrite
  Consolidates 使用说明书.md + 项目介绍文档.md into one document.
  Sections: overview, architecture, BOM, installation, quick start,
  voice commands, calibration, troubleshooting, technical notes,
  training reference, project structure.

- TRAINING.md: rename from lora.md; add bilingual header.
  Full QLoRA fine-tuning research notes preserved as-is.

- Delete: ck.md (dev journal), 使用说明书.md, 项目介绍文档.md
  All useful content merged into README.md.

- .gitignore: remove stale whitelist entries for deleted files.
2026-02-20 21:23:47 +08:00
4eb716c8ad merge dev: consolidate all fixes + config.py refactor
Merges all fix/feat branches:
- fix/exception-handling-and-deque  (closes #1, #6)
- fix/whisper-dead-code-and-import  (closes #2)
- fix/current-pos-tracking-and-requirements (closes #3, #4)
- feat/i18n-english-first           (closes #5)
- refactor: config.py magic constants (closes #7)
2026-02-20 21:04:34 +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
fc02886bfa merge: English-first i18n codebase (closes #5)
Conflict in voice_main.py resolved in favour of HEAD: the current-pos
tracking fix (PR #10) takes priority over translated comments from the
i18n branch.  Remaining Chinese comments will be cleaned up in the
subsequent config.py refactor commit.
2026-02-20 20:46:41 +08:00
7931d42010 merge: fix hardcoded current_pos + add requirements.txt (closes #3, #4) 2026-02-20 20:45:27 +08:00
f631157887 merge: fix whisper broken start_recording (closes #2) 2026-02-20 20:45:23 +08:00
01313a1d94 merge: fix bare except + deque optimization (closes #1, #6) 2026-02-20 20:45:18 +08:00
bc48f564f9 feat(i18n): English-first codebase — translate all non-i18n strings in voice_main.py
All code comments, docstrings, and log messages translated to English.
Chinese strings are preserved ONLY where they are legitimate i18n data:

  Kept (user-facing language data):
  - self.system_prompt: LLM fine-tuning system prompt (must match training data)
  - initial_prompt: Whisper domain hint vocabulary
  - _fix_recognition.replacements: homophone correction table
  - All regex patterns in _try_simple_parse / _fallback_parse (they match
    actual spoken Chinese commands — this IS the i18n layer)

  Translated to English:
  - All print() log messages
  - All inline comments and docstrings
  - Class/section header comments

Part of #5. No functional changes.
2026-02-20 20:36:26 +08:00
9e672ce637 fix(voice_main): pass actual current_pos to execute_pick/execute_lift; add requirements.txt
- Closes #3: execute_pick and execute_lift now accept an optional
  current_pos parameter. Callers (execute_command) pass self.current_pos
  so move_line starts from the actual arm position rather than a hardcoded
  [120, 0, 60] default. Falls back to rest position when None.
- Closes #4: add requirements.txt with correct package names.
  Note: README listed 'openai-whisper' but the code imports faster_whisper;
  requirements.txt uses the correct 'faster-whisper' package name.
- Replace all `servo_buffer = []` assignments with `.clear()` to stay
  compatible with the deque introduced in PR #8 (#6 follow-up).
- Partial #5: translate Chinese print/comment strings to English in
  execute_pick, execute_lift, and execute_command.
2026-02-20 20:26:30 +08:00
6977061bef fix(whisper): remove broken start_recording; move scipy import to top-level
whisper_main.py:
- Remove RobotEar.start_recording() and record_callback() which called
  the nonexistent sd.start_stream() API (correct API is sd.InputStream).
  These methods were never called by voice_main.py and contained a broken
  sounddevice API call that would raise AttributeError (#2).
- Remove unused recording_buffer field
- Translate Chinese comment/docstring to English (#5)

voice_main.py:
- Move `import scipy.io.wavfile as wav` from inside get_audio_text()
  function body to module top-level where all imports belong (#4 related)
- Sort imports: stdlib before third-party, local last
- Remove Chinese comment, replace with English equivalent
2026-02-20 20:24:24 +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
a7209c4f78 Optimize project introduction in README 2026-02-11 00:16:49 +08:00
whisper11111111111
0e7d692784 Add BOM list and cost summary 2026-02-11 00:11:53 +08:00
whisper11111111111
e7278edeb4 Enhance README with project overview and keywords 2026-02-10 23:56:33 +08:00
whisper11111111111
c7828ea914 Add main.ino firmware and update docs 2026-02-10 23:52:15 +08:00
whisper11111111111
865957604d Set replication guide as README.md 2026-02-10 23:43:48 +08:00
whisper11111111111
eaa8b9a132 Add usage manual and replication guide 2026-02-10 23:41:06 +08:00
whisper11111111111
bb85c3266b Initial commit for robot arm voice control system 2026-02-10 23:31:14 +08:00