2.6 KiB
2.6 KiB
| name | description | user_invocable | arg_hint |
|---|---|---|---|
| pi | Interact with the raspberry pi sandbox - capture images, analyze scenes, transfer files, run commands. Use when working with the pi, camera, or servos. | true | capture | analyze | look | send <file> | get <file> | exec <cmd> |
/pi
Raspberry Pi 3B+ sandbox toolkit. The pi is at 10.0.0.11 (user: pi). SSH key auth is set up - use regular ssh/scp/rsync via Bash, no need for ssh-mcp.
connection
PI="pi@10.0.0.11"
ssh $PI '<command>'
scp $PI:<remote> <local>
scp <local> $PI:<remote>
rsync -avz $PI:<remote_dir>/ <local_dir>/
hardware
- USB camera at /dev/video0
- Pan servo: GPIO 17, Tilt servo: GPIO 18, Trigger: GPIO 27
- Servos NOT currently wired up
- pigpiod must be started before servo use:
sudo systemctl start pigpiod
commands
/pi capture [width] [height]
Take a photo and save locally.
ssh pi@10.0.0.11 'python3 ~/pi-sandbox/tools/capture.py 640 480' | base64 -d > ~/pi-sandbox/latest.jpg
Or for full resolution, capture on pi then scp:
ssh pi@10.0.0.11 'python3 -c "
import cv2
cap = cv2.VideoCapture(0)
cap.set(3, 640); cap.set(4, 480)
_, f = cap.read()
cap.release()
cv2.imwrite(\"/tmp/cap.jpg\", f)
"'
scp pi@10.0.0.11:/tmp/cap.jpg ~/pi-sandbox/latest.jpg
Then use Read tool on ~/pi-sandbox/latest.jpg to view it.
/pi analyze
Quick scene analysis - brightness, contrast, edge density, saturation.
ssh pi@10.0.0.11 'python3 ~/pi-sandbox/tools/analyze.py 640'
/pi look
Capture + analyze + view. Combines capture and analyze.
/pi send <local_file> <remote_dest>
Send a file TO the pi:
scp <local_file> pi@10.0.0.11:<remote_dest>
Or for directories:
rsync -avz <local_dir>/ pi@10.0.0.11:<remote_dir>/
/pi get <remote_file> [local_dest]
Get a file FROM the pi:
scp pi@10.0.0.11:<remote_file> <local_dest>
/pi exec
Run something on the pi:
ssh pi@10.0.0.11 '<command>'
helper scripts on pi
~/pi-sandbox/tools/capture.py [w] [h]- capture photo, output base64~/pi-sandbox/tools/analyze.py [w]- capture + opencv stats (text output)~/pi-sandbox/sentry.py- motion detection, saves to ~/pi-sandbox/captures/
constraints
- camera runs ~4fps at 640x480 on the pi 3b+
- opencv 3.2 (uses 3-value findContours return)
- tflite-runtime 2.5.0 available
project files
- pi:
~/pi-sandbox/- main workspace - pi:
~/pi-sandbox/tools/- helper scripts - pi:
~/pi-sandbox/captures/- motion detection captures - pi:
~/cat-deterrent/- old cat deterrent code (has detector.py, servo.py) - local:
~/pi-sandbox/- local workspace + received files