remote control problem
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
|
||||
location /drive/ {
|
||||
location ^~ /drive/ {
|
||||
alias /opt/helva-robot/drive/var/www/drive/;
|
||||
try_files $uri $uri/ /drive/index.html;
|
||||
}
|
||||
|
||||
location /drive-ws {
|
||||
location = /drive-ws {
|
||||
proxy_pass http://127.0.0.1:8002/ws;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 3600;
|
||||
}
|
||||
|
||||
location /drive-health {
|
||||
|
||||
@@ -5,7 +5,7 @@ import serial
|
||||
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
SERIAL_PORT = "/dev/ttyACM0" # ggf. /dev/ttyUSB0
|
||||
SERIAL_PORT = "/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0" # ggf. /dev/ttyUSB0
|
||||
BAUD = 115200
|
||||
|
||||
# Safety: if websocket stops sending, we also stop.
|
||||
@@ -30,7 +30,7 @@ def send_lr(l: int, r: int):
|
||||
def health():
|
||||
return {"ok": True, "serial": SERIAL_PORT}
|
||||
|
||||
@app.websocket("/ws")
|
||||
@app.websocket("/drive-ws")
|
||||
async def ws(websocket: WebSocket):
|
||||
global last_msg_ts
|
||||
await websocket.accept()
|
||||
|
||||
Reference in New Issue
Block a user