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
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
- 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
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.
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.
- 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.
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
- 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)