0
0
Drone Programmingprogramming~10 mins

Waypoint mission creation in Drone Programming - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Waypoint mission creation
Start Mission Setup
Define Waypoints List
Add Waypoints One by One
Set Parameters for Each Waypoint
Upload Mission to Drone
Start Mission Execution
Drone Flies to Each Waypoint in Order
Mission Complete
This flow shows how a waypoint mission is created by defining waypoints, setting parameters, uploading to the drone, and then executing the mission.
Execution Sample
Drone Programming
mission = []
mission.append({'lat': 40.0, 'lon': -74.0, 'alt': 100})
mission.append({'lat': 40.1, 'lon': -74.1, 'alt': 120})
upload_mission(mission)
start_mission()
This code creates a mission with two waypoints, uploads it to the drone, and starts the mission.
Execution Table
StepActionWaypoints ListDrone CommandOutput
1Initialize empty mission list[]NoneMission list is empty
2Add first waypoint[{'lat': 40.0, 'lon': -74.0, 'alt': 100}]NoneWaypoint 1 added
3Add second waypoint[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]NoneWaypoint 2 added
4Upload mission to drone[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]upload_mission(mission)Mission uploaded
5Start mission execution[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]start_mission()Drone starts flying to waypoint 1
6Drone reaches waypoint 1[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]NoneReached waypoint 1
7Drone flies to waypoint 2[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]NoneFlying to waypoint 2
8Drone reaches waypoint 2[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]NoneReached waypoint 2
9Mission complete[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]NoneMission finished
10Exit[{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]NoneAll waypoints visited, mission ends
💡 All waypoints visited, mission ends
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5Final
mission[][{'lat': 40.0, 'lon': -74.0, 'alt': 100}][{'lat': 40.0, 'lon': -74.0, 'alt': 100}, {'lat': 40.1, 'lon': -74.1, 'alt': 120}]Same as after step 3Same as after step 3Same as after step 3
Key Moments - 3 Insights
Why do we need to add waypoints one by one instead of all at once?
Adding waypoints one by one (see steps 2 and 3 in execution_table) helps build the mission list gradually and allows setting parameters for each waypoint clearly.
What happens if we start the mission before uploading it?
If you start the mission before uploading (step 5), the drone has no waypoints to follow, so it won't fly the mission. Uploading (step 4) is necessary to send the mission to the drone.
How does the drone know when the mission is complete?
The drone knows the mission is complete after reaching the last waypoint (step 8), then it stops flying the mission (step 9 and 10).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 3, how many waypoints are in the mission list?
A2
B1
C3
D0
💡 Hint
Check the 'Waypoints List' column at step 3 in the execution_table.
At which step does the drone start flying to the first waypoint?
AStep 4
BStep 6
CStep 5
DStep 7
💡 Hint
Look at the 'Drone Command' and 'Output' columns in the execution_table for when the mission starts.
If we add a third waypoint before uploading, how would the mission list look after step 3?
ATwo waypoints only
BThree waypoints in the list
CEmpty list
DOne waypoint only
💡 Hint
Refer to the variable_tracker and execution_table to understand how waypoints are added.
Concept Snapshot
Waypoint mission creation steps:
1. Create empty mission list
2. Add waypoints with lat, lon, alt
3. Upload mission to drone
4. Start mission execution
5. Drone flies waypoints in order
6. Mission ends after last waypoint
Full Transcript
Waypoint mission creation involves making a list of points the drone will fly to. We start with an empty list, add each waypoint with its location and altitude, then upload this list to the drone. After uploading, we start the mission, and the drone flies to each waypoint one by one. When the drone reaches the last waypoint, the mission is complete and the drone stops flying the mission.