def get_gimbal_ip(): global gimbal_ip GIMBAL_PORT = 5584 l = listener(GIMBAL_PORT) ip_address = l.read() gimbal_ip = ip_address
def initialise(): sp = sapi.create_sp() device_id = sapi.choose_device(sp) listen = listener(sp, device_id) return listen
def get_gimbal_ip(): global gimbal_ip GIMBAL_PORT = 5584 l = listener(GIMBAL_PORT) ip_address = l.read() gimbal_ip = ip_address threadGimbal = Thread(target=get_gimbal_ip) threadGimbal.start() GS_PORT = 5585 l = listener(GS_PORT) ip_address = l.read() port_number = 5600 print("\n\n\nStarting the first stream...\n\n\n") raspivid_command = "raspivid -n -vf -t 0 -fl -b 10000000 -fps 30 -h 720 -w 1280 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host= " + str( ip_address) + " port=" + str(port_number) + " &" os.system(raspivid_command) state = [False, False, False, False, True] count = 0 current_state = 4 new_state = 0 mavString = "sudo mavproxy.py --master=/dev/ttys0 --baudrate 57600 --out " + ip_address + ":14550 --aircraft MyCopter"