Merge pull request '降低小车延迟,提升小车操控性' (#8) from zyp into main

main
pa2ltb7y5 3 days ago
commit 11003f4be2

@ -32,7 +32,7 @@ picam2 = None
def cameraon():
global picam2
picam2 = Picamera2()
picam2.configure(picam2.create_video_configuration(main={"format": 'XRGB8888', "size": (640, 480)}))
picam2.configure(picam2.create_video_configuration(main={"format": 'XRGB8888', "size": (320, 240)}))
picam2.start()
@ -70,7 +70,7 @@ def gen_frames(): # generate frame by frame from camera
@app.route('/control/sendit', methods=['POST'])
def send_command():
# 定义目标 IP 地址、端口和路由
ip = "192.168.60.204"
ip = "192.168.100.101"
port = 3000
route = "sendit2"
@ -105,7 +105,8 @@ def capture_image():
# 将帧保存为图片
try:
cv2.imwrite(photo_path, frame)
return f"Photo saved at {photo_path}"
return send_file(photo_path, as_attachment=True)
except Exception as e:
return f"Failed to save photo: {str(e)}"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 17 KiB

@ -59,8 +59,8 @@ class CAR:
self.back()
def left(self): # 左转
base.send_command({"T":1,"L":-0.2,"R":0.2})
time.sleep(0.5)
base.send_command({"T":1,"L":-0.1,"R":0.1})
time.sleep(0.3)
base.send_command({"T":1,"L":0,"R":0})
print("run: move left")
@ -70,8 +70,8 @@ class CAR:
self.left()
def right(self): # 右转
base.send_command({"T":1,"L":0.2,"R":-0.2})
time.sleep(0.5)
base.send_command({"T":1,"L":0.1,"R":-0.1})
time.sleep(0.3)
base.send_command({"T":1,"L":0,"R":0})
print("run: move right")

@ -4,6 +4,8 @@
<!-- Required meta tags -->
<link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" media="screen">
<script src="http://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
<!-- <link href="./css/bootstrap.min.css" rel="stylesheet" media="screen">
<script src="./js/jquery.min.js"></script> -->
<meta charset="utf-8">
<title>Live Video Based on Flask</title>
<link rel="stylesheet" href='/style.css'/>

Loading…
Cancel
Save