Merge branch 'api' of github.com:SemvdH/5g_drone_ROS2 into api

This commit is contained in:
Sem van der Hoeven
2023-05-25 16:31:15 +02:00
4 changed files with 36 additions and 2 deletions

22
config/params.yaml Normal file
View File

@@ -0,0 +1,22 @@
/**:
ros__parameters:
video_device: "/dev/video0"
framerate: 10.0
io_method: "mmap"
frame_id: "camera"
pixel_format: "yuyv" # see usb_cam/supported_formats for list of supported formats
image_width: 2320
image_height: 1744
camera_name: "drone_camera"
camera_info_url: "package://usb_cam/config/camera_info.yaml"
brightness: -1
contrast: -1
saturation: -1
sharpness: -1
gain: -1
auto_white_balance: true
white_balance: 4000
autoexposure: true
exposure: 100
autofocus: false
focus: -1

View File

@@ -84,7 +84,7 @@ class ApiListener(Node):
async def handle_api(self):
self.get_logger().info('Starting API')
self.server = await websockets.serve(self.api_handler, '0.0.0.0', 9001)
self.get_logger().info('API started')
self.get_logger().info('API started on port 9001')
await self.server.wait_closed()
def process_image_request(self, message_json):

12
websocket-client-test.py Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env python
import asyncio
from websockets.sync.client import connect
def hello():
with connect("ws://localhost:8765") as websocket:
websocket.send("Hello world!")
message = websocket.recv()
print(f"Received: {message}")
hello()