Path Optimization for Task 1 & Mission Planner Guide
Document Synopsis (2023-04-24) : The work for path optimization with regards to task 1 has various components. The first one being that there needs to be a way to accurately scan the QR code that will be given by the competition organizers. This QR code will contain the list of waypoints that need to be taken into consideration while flying. After, the data will be put through an algorithm that will convert it to a format readable for mission planner ( latitude and longitude values). Finally, there needs to be a python script/module that actually uploads those waypoints to mission planner.
In terms of the integration of these various components, it was agreed upon that the code would be placed in the IMACS GitHub repo in a directory called PathOptimization.
This document also serves as a guide for using mission planner.
What needs to be done: Integrate all these components together, and subsequent user testing.
Mission Planner Guide
Mission Planner is a full featured ground station application for the ArduPilot open source autopilot project. It can be used for a variety of applications, but this section of this document will focus on the aspects related to this current project.
Running a python script in Mission Planner
This is important to upload different commands from your code to Mission Planner for implementation. To run a script in mission planner follow the follow steps:
Open Mission Planner
On the left of your screen below find the tab labeled “Scripts”. Select this
Click “Select Script” and choose the script you want to run
Click “Run Script”. If you want to stop running the script for whatever reason click “Abort”
Using Appropriate Functions With Their Associated Parameters, and Using Classes
Mission Planner has many “built in” classes and functions that can be used for a variety of applications. I would suggest looking through the documentation, or even better looking through the source code. These two resources will help you determine the correct classes, functions, and associated parameters.
Link to Source Code: https://github.com/ArduPilot/MissionPlanner
Link To Documentation: https://ardupilot.org/planner/docs/mission-planner-overview.html
General Tip: Check which third party Python Packages Are Compatible With Mission Planner
When installing third party packages, be sure to determine whether or not they are compatible with Mission Planner. If they are not, your code will not execute in Mission Planner.
Plan for Waypoint Upload Module
Earlier Plan (Pre 2023-04-25) : The earlier plan called for the use of classes to construct each waypoint based on its characteristics (ex. type, latitude, longitude, etc). The instances of the class (aka the object) would be the actual waypoints to be uploaded. However, after consultation with @R D it was determined that this would be very unnecessary. The reason for this was that using classes would allow for parallelization of the data. However, the data that the system is handling is so minute, it would not make much of a difference to parallelize.
Current Plan (2023-04-25): The current plan calls for the waypoint upload script to be organized into one big function. This function would take in a coordinate which is a tuple of lat long. From this, the tuple would be iterated through, and each lat long value would then be used to set the waypoint in MissionPlanner using the appropriate classes. The reference frame, as well as the Command ID would also have to be set.
A very rough idea of how this could look like is shown below..
def upload_waypoint(coordinate: “list[tuple[float]]”)
for coordinate in coordinates:
lat= coordinate[0]
long= coordinate[1]
#Subsequent classes associated to MP would then be used to set the reference frame, command id to then be uploaded to MP
New Change (2023-04-26): During the actual coding process, it was determined that it would be more efficient to have two different functions rather than one. The first function is the create_command function. This function takes in the different characteristics such as command id, latitude, longitude etc to create the actual waypoint. The second function waypoint_upload as per its name deals with actually uploading the waypoint to MissionPlanner. It calls the first function in the module (create_command) to do this. It also uses the built in classes associated to MissionPlanner
New Change: Added create_command function to be used to construct a generic command in Mission Planner.