I’m developing an application using Python Buildozer. It seems that pymavlink doesn’t support connecting to the USB port on Android. If anyone knows about this issue, I would appreciate their knowledge on the subject. As a solution, I thought about bridging the USB port with the UDP port. I’ve developed the following code, but it seems to be stuck on the STAT_RUNTIME screen in Mission Planner. Upon further research, I discovered that this is due to the telemetry being one-way. I believe I mistakenly made it one-way as well and couldn’t achieve bidirectional communication. If anyone has knowledge and experience regarding this issue, could they please assist me?
import serial
import socket
usb_port = 'COM5'
baud_rate = 57600
udp_host = 'localhost'
udp_port = 14558
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
ser = serial.Serial(usb_port, baud_rate)
while True:
usb_data = ser.read(1024)
usb_data_str = None
udp_socket.sendto(usb_data, (udp_host, udp_port))
mission_planner_data, _ = udp_socket.recvfrom(1024)
ser.write(mission_planner_data)