3.3 KiB
3.3 KiB
Helva Roboter
We build a robot with raspberry and arduino.
Checkout Repo
cd /opt
git checkout https://git.dyn.mcf.at/Max/helva-robot.git
Raspberry Face
Install Packages
sudo apt update
sudo apt install -y nginx python3 python3-venv
sudo mkdir -p /opt/face
sudo chown -R $USER:$USER /opt/face
python3 -m venv /opt/face/venv
/opt/face/venv/bin/pip install --upgrade pip
/opt/face/venv/bin/pip install fastapi uvicorn
Exchange Nginx Web-Folder
sudo rm -r /var/www/html
sudo ln -s /opt/helva-robot/face/var/www/html/ /var/www/
Permissions of Webfolder
sudo chown -R www-data:www-data /var/www/html
Nginx Vhost
sudo ln -s /opt/helva-robot/face/etc/nginx/sites-available/face /etc/nginx/sites-enabled/
Restart nginx
sudo systemctl restart nginx
Test Face Server
In Browser
From Somewhere
Neutral + wander
curl -X POST http://<pi>/api/state -H "Content-Type: application/json" \
-d '{"emotion":"neutral","intensity":0.6,"look":null}'
Angry + starring right
curl -X POST http://<pi>/api/state -H "Content-Type: application/json" \
-d '{"emotion":"angry","intensity":0.9,"look":{"x":0.9,"y":0.0}}'
start Talking
curl -X POST http://<pi>/api/state -H "Content-Type: application/json" \
-d '{"talk":{"enabled":true}}'
talk faster and stronger
curl -X POST http://<pi>/api/state -H "Content-Type: application/json" \
-d '{"talk":{"enabled":true,"rate_hz":5.5,"amount":1.0,"jitter":0.35}}'
stop talking
curl -X POST http://<pi>/api/state -H "Content-Type: application/json" \
-d '{"talk":{"enabled":false}}'
emotion + talk
curl -X POST http://<pi>/api/state -H "Content-Type: application/json" \
-d '{"emotion":"happy","intensity":0.85,"talk":{"enabled":true,"rate_hz":4.2,"amount":0.95}}'
blink + happy
curl -X POST http://<pi>/api/state -H "Content-Type: application/json" \
-d '{"emotion":"happy","blink":true,"intensity":0.85}'
systemd Service
sudo ln -s /opt/helva-robot/face/etc/systemd/system/face.service /etc/systemd/system/
sudo chown -R www-data:www-data /opt/face
sudo chmod -R 755 /opt/face
Start: sudo systemctl daemon-reload sudo systemctl enable --now face.service sudo systemctl status face.service --no-pager
Debug Face
SSE-Stream going to browser?
curl -N http://127.0.0.1:8001/events | head
is nginx delivering /events through
curl -N http://localhost/events | head
check Endpoint /api/state
directly
curl -s -X POST http://127.0.0.1:8001/api/state
-H "Content-Type: application/json"
-d '{"emotion":"happy","intensity":0.9,"blink":true}' | jq
throught nginx
curl -s -X POST http://localhost/api/state
-H "Content-Type: application/json"
-d '{"emotion":"happy","intensity":0.9,"blink":true}'
check python face server
sudo systemctl status face.service --no-pager
sudo journalctl -u face.service -n 50 --no-pager
restart/reload face server service
sudo systemctl daemon-reload
sudo systemctl restart face.service
check listening Port
sudo ss -ltnp | grep :8001
restart/status of face service
sudo systemctl restart face.service
sudo systemctl status face.service --no-pager