Hello,
I am trying to run a script with pymavlink commands including arm, take-off and send some waypoints to a simulated hexa-copter from the mission planner’s SITL. Arm kai take-off are successful, the simulated copter responds, but it does not respond after waypoint commands are sent. I am attaching the code from the waypoint loader snapshot, can you see a fault in the implementation? Thank you.
lat = (-33.95063, -34.029480, -34.438282)
lon = (148.958650, 149.319995, 149.243922)
alt = (10, 10, 10)
N = len(lat)
loader = mavwp.MAVWPLoader()
seq = 1
frame = mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT
for i in range(N):
wp = mavutil.mavlink.MAVLink_mission_item_message(master.target_system,
master.target_component,
seq,
frame,
mavutil.mavlink.MAV_CMD_NAV_WAYPOINT,
0, 0, 0, 0, 0, 0,
lat[i],lon[i],alt[i])
print(wp)
loader.add(wp)
seq += 1
#send waypoints to vehicle
master.waypoint_clear_all_send()
master.waypoint_count_send(loader.count())
for i in range(loader.count()):
msg = master.recv_match(type=['MISSION_REQUEST'],blocking=True)
master.mav.send(loader.wp(msg.seq))
print(loader.wp(msg.seq))
print('Sending waypoint {0}'.format(msg.seq))