Dev alex video start on authenticated#41
Open
alexstrangeparts wants to merge 73 commits intoremotv:masterfrom
Open
Dev alex video start on authenticated#41alexstrangeparts wants to merge 73 commits intoremotv:masterfrom
alexstrangeparts wants to merge 73 commits intoremotv:masterfrom
Conversation
- Check geofence before allowing movement commands - Moderators bypass the geofence check - Pass moderator flag from server message through to move handler - Add geofence debug logging (inside/outside status, distance to edge) - Simplify geofence distance calculation in gps.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The TTS thread now calls declareFinishedTTS() itself when playback completes, removing the need for the main loop to poll thread state. This eliminates up to 1 second of latency between messages and lets the server be the sole TTS queue. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix time.time.now() to time.time()
Move play call outside with block in google_cloud TTS
Send TTS_FINISHED directly from thread instead of polling
The function returns True when the robot is safely inside the geofence, which is the opposite of what "is_breaking" suggests. Rename to is_within_geofence so call sites read naturally: if not gps.is_within_geofence(): block Addresses review comment on PR #4. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add geofence enforcement with moderator bypass
- Add reportGeofenceBreach() and reportGeofenceClear() to networking.py - Block movement and report breach direction in handle_command() - Detect geofence re-entry in main loop and send GEOFENCE_CLEAR Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Only block and report on the first breach. After that, let commands through so the user can drive back — the server handles which directions are allowed. Also removes duplicate geofence check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The main loop was setting geofence_was_breached = True when outside the fence, which prevented handle_command from ever triggering the breach report. Also caused spurious GEOFENCE_CLEAR on GPS jitter. Only handle_command should set the flag — the main loop only clears it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Clarifies that commands are intentionally allowed through after the first geofence breach because the server handles directional filtering. Addresses review comment by @scottyallen on PR #9 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of reporting the blocked command's direction (which may not be the direction that moved the robot outside), track the last successful f/b command and report that. This ensures the server disables the correct controls for recovery. Turns (tl/tr) are not tracked since they don't move the robot linearly. Addresses review comment by @scottyallen on PR #9 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add geofence breach/clear reporting to server
Temp WAV files were never deleted after playback, accumulating in /tmp. Replace os.system with subprocess.call to capture the exit code and log failures. Delete the temp file after playback in a finally block. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When ffmpeg dies, the watchdog restarts immediately but /dev/video0 is still held by the old process, causing a tight "Device or resource busy" loop (26000+ restarts observed in logs). Changes: - Kill stale ffmpeg processes and wait 2s before starting a new one, giving the kernel time to release the video device - Remove recursive restartVideoCapture() call from inside the ffmpeg log monitoring loop — this caused nested restarts while the old ffmpeg was still being monitored. The watchdog already handles restarts when ffmpeg exits. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
audio_input_options was read from config but never used in the command template. Add it before the ALSA audio input so options like -use_wallclock_as_timestamps 1 can be set via config to help fix audio/video drift. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
If the robot disconnects or restarts mid-TTS, the server can be stuck waiting for TTS_FINISHED indefinitely. Sending it right after authentication clears any stale lock from a previous session. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f.close without () just references the method without calling it, so the file handle is never released after writing the config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Missing 'a' in sendChatMessage caused AttributeError when a non-owner tried a .video command. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
-f matches the full command line which could kill the parent Python process. -x matches the exact process name only. Addresses review comment by @scottyallen on PR #10 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace time.sleep(2) with a fuser-based polling loop that checks whether any process still holds the video device. Times out after 10s. fuser is part of psmisc which is installed by default on Raspbian. Falls back to a fixed 2s sleep if fuser is not available. Addresses review comment by @scottyallen on PR #10 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ilure Move try block up to cover the with open() write so the temp file gets cleaned up even if out.write() throws (e.g. disk full). Add os.path.exists() guard in finally since file may not exist yet. Addresses review comment by @scottyallen on PR #11 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents file handle leak if writelines() throws an exception. Addresses review comment by @scottyallen on PR #12 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dev alex ffmpeg improvements
TTS improvements to stabiltiy
Fix config file handle leak — f.close missing parentheses
Python 2 rejects non-ASCII characters without an encoding declaration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix Python 2 syntax error: remove non-ASCII em dash from comment
The while loop on line 296 already blocks until networking.authenticated is True, making the if check always pass. Remove the condition and its else branch (sleep fallback) entirely, dedenting the body. Addresses review comment by @scottyallen on PR #18 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Check that the robot connected before starting video as a better way of checking connection status