diff --git a/carsrun/__pycache__/car.cpython-311.pyc b/carsrun/__pycache__/car.cpython-311.pyc index 3141b73..9a4351c 100644 Binary files a/carsrun/__pycache__/car.cpython-311.pyc and b/carsrun/__pycache__/car.cpython-311.pyc differ diff --git a/carsrun/appCam.py b/carsrun/appCam.py index e43927e..ccb94b7 100644 --- a/carsrun/appCam.py +++ b/carsrun/appCam.py @@ -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)}" diff --git a/carsrun/captured_photo.jpg b/carsrun/captured_photo.jpg index a171472..d30d6e0 100644 Binary files a/carsrun/captured_photo.jpg and b/carsrun/captured_photo.jpg differ diff --git a/carsrun/car.py b/carsrun/car.py index 81f8b14..d988ed6 100644 --- a/carsrun/car.py +++ b/carsrun/car.py @@ -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") diff --git a/carsrun/templates/index-t.html b/carsrun/templates/index-t.html index 8a987bd..e6e01e8 100644 --- a/carsrun/templates/index-t.html +++ b/carsrun/templates/index-t.html @@ -4,6 +4,8 @@ +