Hello, I have an orange cube connected with a herelink system. I want to create a code in python to control the camera. I have 2 cases:
When the UAV is connected to the battery and the laptop is connected through USB to orange cube, I use the command camera = mavutil.mavlink_connection(‘com4’,baud=115200) and everything it s working perfect.
When the UAV is connected to the battery and the laptop is connected to the wifi hotspot of the herelink controller, Mission Planner/ QGC it s working perfect, but I can t connect the python code.
I used this line when I connect over WIFI
camera = mavutil.mavlink_connection(‘udp:192.168.43.81:14550’)
Can somebody help me with this? Thank you very much
Here is a part of the code:
from multiprocessing import Process,Pool,Value,Manager,Array
from threading import Thread
from time import sleep
from pymavlink import mavutil
from pymavlink.dialects.v20 import ardupilotmega as mavlink2
lege=Array(‘d’,range(14))
lege[0]=1
lege[1]=0 #zoom
lege[2]=0 #layout
lege[3]=0 #thermal
lege[4]=0 #poza
lege[5]=0 #video
lege[6]=0 #paleta
lege[7]=0 #parametru zoom
lege[8]=0
lege[9]=0
lege[10]=0
lege[11]=0
lege[12]=0
lege[13]=0
def conectare_camera(lege):
from pymavlink import mavutil
from pymavlink.dialects.v20 import ardupilotmega as mavlink2
from time import sleep
mavutil.mavlink20=1
mavutil.MAVLINK_DIALECT='common'
#camera = mavutil.mavlink_connection('com4',baud=115200)
camera = mavutil.mavlink_connection('udp:192.168.43.81:14550')
startare=1
i=0
kk=1
while lege[0]==1:
camera.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_ONBOARD_CONTROLLER,
mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)
if startare==1:
startare=0
if i>5:
camera.wait_heartbeat()
if kk==1:
print('Camera este conectata')
kk=0
mesaj_camera = camera.recv_msg()
i=i+1
if i<5:
sleep(1)
if lege[1]==1 and lege[13]==1:
camera.mav.command_long_send(1,
0,
mavutil.mavlink.MAV_CMD_DO_DIGICAM_CONTROL,
0,
0, lege[7], 0, 0, 0, 0, 0)
lege[1]=0
lege[7]=0
lege[13]=0