Hey all,
I am trying to write a MAVProxy module to communicate with another application I have made. I am struggling to understand how to set waypoints within a module. Looking at the ‘misseditor’ module it seems to be using the ‘wp’ module to set the waypoints, however after attempting to copy sections of code I thought were doing this task it still does not work. The original code in ‘misseditor’ I think is adding waypoints is this:
elif event.get_type() == me_event.MEE_WRITE_WP_NUM:
w = mavutil.mavlink.MAVLink_mission_item_message(
self.mp_misseditor.target_system,
self.mp_misseditor.target_component,
event.get_arg("num"),
event.get_arg("frame"),
event.get_arg("cmd_id"),
0, 1,
event.get_arg("p1"), event.get_arg("p2"),
event.get_arg("p3"), event.get_arg("p4"),
event.get_arg("lat"), event.get_arg("lon"),
event.get_arg("alt"))
self.mp_misseditor.module('wp').wploader.add(w)
self.mp_misseditor.master.mav.send(
self.mp_misseditor.module('wp').wploader.wp(w.seq))
#tell the wp module to expect some waypoints
self.mp_misseditor.module('wp').loading_waypoints = True
My code in my module is this below, it does add a point to the map, however it does not save it to the flight controller.
w = mavutil.mavlink.MAVLink_mission_item_message(0, 0, 1, 10, 16,
0, 1, 0, 0, 0, 0, -35.372532, 149.163345, 120.000000)
self.module('wp').wploader.add(w)
self.master.mav.send(self.module('wp').wploader.wp(w.seq))
#tell the wp module to expect some waypoints
self.module('wp').loading_waypoints = True
Any help would be great. Thanks