clean up apilistener

This commit is contained in:
Sem van der Hoeven
2023-06-13 22:02:30 +02:00
parent 9a81018c1d
commit 6d74605582

View File

@@ -17,21 +17,8 @@ import threading
import json import json
from enum import Enum from enum import Enum
from functools import partial from functools import partial
import base64
import cv2
from functools import partial from functools import partial
# communication: client always sends commands that have a command id.
# server always sends messages back that have a message type
# TODO send video https://github.com/Jatin1o1/Python-Javascript-Websocket-Video-Streaming-/tree/main
RES_4K_H = 3496
RES_4K_W = 4656
# TODO change video to be handled by camera controller through websocket with different port
class RequestCommand(Enum): class RequestCommand(Enum):
""" """
Enum for the commands that can be sent to the API Enum for the commands that can be sent to the API
@@ -51,7 +38,6 @@ class ResponseMessage(Enum):
MOVE_DIRECTION_RESULT = 2 MOVE_DIRECTION_RESULT = 2
FAILSAFE = 3 FAILSAFE = 3
class ApiListener(Node): class ApiListener(Node):
""" """
Node that listens to the client and sends the commands to the drone Node that listens to the client and sends the commands to the drone
@@ -451,7 +437,6 @@ class ApiListener(Node):
self.get_logger().error(str(e)) self.get_logger().error(str(e))
self.websocket = None self.websocket = None
def main(args=None): def main(args=None):
"""Main function""" """Main function"""
rclpy.init(args=args) rclpy.init(args=args)
@@ -464,6 +449,5 @@ def main(args=None):
api_listener.destroy_node() api_listener.destroy_node()
rclpy.shutdown() rclpy.shutdown()
if __name__ == '__main__': if __name__ == '__main__':
main() main()