Hi. I’m using pymavlink on python3.
When I send a message using pymavlink, my drone didn’t receive again.
I’m using LTE connection between drone and my pc(pymavlink)
The first case is when I turn on my drone and my source code, and send a mission to my drone, it works fine.
But second time to mission updoad when using pymavlink, my drone doesn’t receive mission.
So I turn on QGC and check alarm, it makes operation timeout error.
But I uploaded the mission via QGC and start the flight, it works fine.
And second case, I create first misison via QGC and start the flight.
The mission is ended, I turn on my source code and upload mission, it dosen’t work.
I don’t know why it is working fine.
I’m guessing the sending mission part has a error, but I can’t figuring out.
I’m using pymavlink version 2.4.29,
drone’s px4 firmware version is 1.12.3
Here is part of my source code.
for waypoint in enumerate(self.mywindow.waypoints):
frame = mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT
seq = waypoint[0]
lat, lon = waypoint[1]
altitude = 10
autocontinue = 1
current = 0
param1 = 15.0 # minimum pitch
speed = 3
if seq == 0: # first waypoint to takeoff
current = 1
p = mavutil.mavlink.MAVLink_mission_item_message(mav.target_system, mav.target_component, seq, frame,
mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, current,
autocontinue,
param1, 0, 0, float('nan'), lat, lon, altitude)
self.wp.add(p)
# change speed command
s = mavutil.mavlink.MAVLink_mission_item_message(mav.target_system, mav.target_component, 0, mavutil.mavlink.MAV_FRAME_MISSION,
mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, 0, 1, 1, speed,
0, 0, 0, 0, 0)
self.wp.add(s)
elif seq == len(self.mywindow.waypoints) - 1: # last waypoint to land
p = mavutil.mavlink.MAVLink_mission_item_message(mav.target_system, mav.target_component, seq, frame,
mavutil.mavlink.MAV_CMD_NAV_LAND, current,
autocontinue,
0, 0, 0, float('nan'), lat, lon, 0)
self.wp.add(p)
else:
p = mavutil.mavlink.MAVLink_mission_item_message(mav.target_system, mav.target_component, seq, frame,
mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, current,
autocontinue
, 0, 0, 0, float('nan'), lat, lon, altitude)
self.wp.add(p)
# Send Waypoint to airframe
# mav.waypoint_clear_all_send()
mav.waypoint_count_send(self.wp.count())
for i in range(self.wp.count()):
print(i)
msg = mav.recv_match(type=['MISSION_REQUEST'], blocking=True)
print(msg.seq)
mav.mav.send(self.wp.wp(msg.seq))
print('Sending waypoint {0}'.format(msg.seq))
msg = mav.recv_match(type=['MISSION_ACK'], blocking=True)
print(msg.type) #0 #MAV_MISSION_RESULT #MAV_MISSION_ACCEPTED