Bird
Raised Fist0
Drone Programmingprogramming~10 mins

Mission upload and execution in Drone Programming - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Concept Flow - Mission upload and execution
Prepare Mission Data
Upload Mission to Drone
Drone Confirms Upload
Start Mission Execution
Drone Executes Waypoints
Mission Complete
Send Completion Status
The mission data is prepared and uploaded to the drone, which confirms receipt. Then the drone starts executing the mission step-by-step until completion, finally sending back a status.
Execution Sample
Drone Programming
mission = ["WP1", "WP2", "WP3"]
drone.upload(mission)
if drone.confirmed():
    drone.start()
    while drone.has_next():
        drone.execute_next()
This code uploads a list of waypoints to the drone, waits for confirmation, then starts and executes each waypoint in order.
Execution Table
StepActionCondition/EvaluationResult/Output
1Prepare mission listmission = ["WP1", "WP2", "WP3"]Mission data ready
2Upload missiondrone.upload(mission)Mission sent to drone
3Check confirmationdrone.confirmed() == TrueUpload confirmed
4Start missiondrone.start()Drone begins mission
5Check if next waypoint existsdrone.has_next() == TrueReady to execute WP1
6Execute next waypointdrone.execute_next()Executed WP1
7Check if next waypoint existsdrone.has_next() == TrueReady to execute WP2
8Execute next waypointdrone.execute_next()Executed WP2
9Check if next waypoint existsdrone.has_next() == TrueReady to execute WP3
10Execute next waypointdrone.execute_next()Executed WP3
11Check if next waypoint existsdrone.has_next() == FalseNo more waypoints
12Mission completeAll waypoints executedMission finished, status sent
💡 Loop ends when drone.has_next() returns False after last waypoint
Variable Tracker
VariableStartAfter Step 5After Step 7After Step 9Final
mission["WP1", "WP2", "WP3"]["WP1", "WP2", "WP3"]["WP1", "WP2", "WP3"]["WP1", "WP2", "WP3"]["WP1", "WP2", "WP3"]
current_waypointNone"WP1""WP2""WP3"None
drone.confirmedFalseTrueTrueTrueTrue
drone.has_nextTrueTrueTrueFalseFalse
Key Moments - 3 Insights
Why does the loop stop after executing WP3?
Because at step 11, drone.has_next() returns False, meaning no more waypoints are left to execute, so the loop ends.
What happens if drone.confirmed() returns False?
The mission does not start because the code checks confirmation before starting; without confirmation, the drone won't execute the mission.
Why do we check drone.has_next() before executing each waypoint?
To ensure there is a next waypoint to execute and avoid errors from trying to execute when none remain, as shown in steps 5, 7, 9, and 11.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the result of step 6?
AMission sent to drone
BExecuted WP1
CUpload confirmed
DNo more waypoints
💡 Hint
Check the 'Result/Output' column for step 6 in the execution_table.
At which step does the drone confirm the mission upload?
AStep 3
BStep 2
CStep 4
DStep 5
💡 Hint
Look at the 'Action' and 'Condition/Evaluation' columns around step 3 in the execution_table.
If the mission had 4 waypoints instead of 3, how would the variable 'drone.has_next' change after step 9?
AIt would be False
BIt would be None
CIt would be True
DIt would cause an error
💡 Hint
Refer to variable_tracker and execution_table steps for how 'drone.has_next' changes with waypoints.
Concept Snapshot
Mission upload and execution:
1. Prepare mission data (waypoints list).
2. Upload mission to drone and wait for confirmation.
3. Start mission only if confirmed.
4. Loop through waypoints: check next, execute next.
5. Stop when no waypoints remain.
6. Send completion status.
Full Transcript
This visual execution shows how a drone mission is uploaded and executed step-by-step. First, the mission data is prepared as a list of waypoints. Then the mission is uploaded to the drone. The drone confirms the upload before starting. Once confirmed, the drone starts the mission and executes each waypoint one by one. After each waypoint, it checks if more remain. When no waypoints remain, the mission ends and a completion status is sent. Variables like current waypoint and confirmation status change as the mission progresses. Key moments include understanding why the loop stops after the last waypoint and why confirmation is required before starting. The quiz questions help reinforce these steps by referencing the execution table and variable changes.

Practice

(1/5)
1. What does uploading a mission to a drone usually do?
easy
A. It immediately starts the drone's engines.
B. It charges the drone's battery.
C. It returns the drone to its home location.
D. It sends the flight plan to the drone for automatic flying.

Solution

  1. Step 1: Understand mission upload meaning

    Uploading a mission means sending the flight plan to the drone's system.
  2. Step 2: Identify what happens after upload

    The drone receives the plan but does not start flying until commanded.
  3. Final Answer:

    It sends the flight plan to the drone for automatic flying. -> Option D
  4. Quick Check:

    Uploading mission = send flight plan [OK]
Hint: Uploading means sending the flight plan, not starting flight [OK]
Common Mistakes:
  • Confusing upload with starting the drone
  • Thinking upload charges the battery
  • Assuming upload returns drone home
2. Which of the following is the correct syntax to start a mission after uploading it in drone programming?
easy
A. drone.startMission()
B. drone.uploadMission()
C. drone.beginFlight()
D. drone.executePlan()

Solution

  1. Step 1: Identify method to start mission

    The method to start flying the uploaded mission is usually named startMission().
  2. Step 2: Differentiate from upload method

    uploadMission() uploads the plan but does not start flight.
  3. Final Answer:

    drone.startMission() -> Option A
  4. Quick Check:

    Start mission method = startMission() [OK]
Hint: Start mission uses startMission(), not uploadMission() [OK]
Common Mistakes:
  • Using uploadMission() to start flight
  • Confusing method names like beginFlight() which is invalid
  • Assuming executePlan() is standard method
3. Given this code snippet:
drone.uploadMission(missionPlan)
drone.startMission()
print(drone.status())

What is the expected output if the mission starts successfully?
medium
A. "Mission started"
B. "Mission uploaded"
C. "Mission completed"
D. "Error: No mission uploaded"

Solution

  1. Step 1: Analyze code sequence

    The mission is uploaded first, then started, so the drone should be flying.
  2. Step 2: Check status output meaning

    Calling drone.status() after startMission() should return "Mission started" indicating flight began.
  3. Final Answer:

    "Mission started" -> Option A
  4. Quick Check:

    Status after startMission() = "Mission started" [OK]
Hint: Status after startMission() shows "Mission started" [OK]
Common Mistakes:
  • Confusing upload status with start status
  • Expecting "Mission completed" immediately
  • Assuming error without upload
4. Identify the error in this code snippet:
drone.startMission()
drone.uploadMission(missionPlan)
medium
A. Missing drone initialization causes failure.
B. Uploading mission twice is not allowed.
C. Starting mission before uploading causes an error.
D. No error; code runs fine.

Solution

  1. Step 1: Check order of operations

    Mission must be uploaded before starting; here startMission() is called first.
  2. Step 2: Understand consequence

    Starting mission without upload means no flight plan, causing an error.
  3. Final Answer:

    Starting mission before uploading causes an error. -> Option C
  4. Quick Check:

    Upload before startMission() [OK]
Hint: Upload mission before starting flight to avoid errors [OK]
Common Mistakes:
  • Calling startMission() before uploadMission()
  • Assuming no initialization error
  • Thinking multiple uploads cause error here
5. You want to upload a mission and monitor its progress until completion. Which code sequence correctly achieves this?
1. drone.uploadMission(plan)
2. drone.startMission()
3. while not drone.isMissionComplete():
       print(drone.getProgress())
4. print("Mission complete!")
hard
A. Mission cannot be monitored programmatically after upload.
B. This sequence correctly uploads, starts, monitors, and confirms mission completion.
C. The loop should check drone.status() == "started" instead of isMissionComplete().
D. You must call drone.monitorMission() before startMission().

Solution

  1. Step 1: Verify mission upload and start

    Uploading the plan then starting the mission is the correct order.
  2. Step 2: Confirm monitoring loop logic

    The loop checks if mission is complete and prints progress until done, then confirms completion.
  3. Final Answer:

    This sequence correctly uploads, starts, monitors, and confirms mission completion. -> Option B
  4. Quick Check:

    Upload -> start -> monitor -> complete [OK]
Hint: Upload first, then start, then monitor until complete [OK]
Common Mistakes:
  • Trying to monitor before starting mission
  • Checking wrong status in loop
  • Assuming mission can't be monitored