0
0
Drone Programmingprogramming~10 mins

Search and rescue assistance in Drone Programming - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Search and rescue assistance
Start Mission
Initialize Drone Position
Scan Area
Detect Target?
NoContinue Scanning
|Yes
Mark Target Location
Send Coordinates to Rescue Team
Mission Complete
The drone starts the mission, scans the area repeatedly, detects a target, marks its location, sends coordinates to the rescue team, and then completes the mission.
Execution Sample
Drone Programming
position = (0,0)
target_found = False
while not target_found:
    scan_area()
    if detect_target():
        target_found = True
        send_coordinates(position)
    else:
        position = (position[0] + 1, position[1])
This code moves the drone scanning the area until it finds the target, then sends the target's position.
Execution Table
Steppositiontarget_foundActionOutput
1(0,0)FalseInitialize position and target_foundNone
2(0,0)FalseScan areaNone
3(0,0)FalseDetect target? NoNone
4(1,0)FalseMove position, scan areaNone
5(1,0)FalseDetect target? NoNone
6(2,0)FalseMove position, scan areaNone
7(2,0)TrueDetect target? YesTarget found
8(2,0)TrueSend coordinates to rescue teamCoordinates sent
9(2,0)TrueMission completeNone
💡 Target found at position (2,0), mission ends after sending coordinates.
Variable Tracker
VariableStartAfter Step 4After Step 6After Step 7Final
position(0,0)(1,0)(2,0)(2,0)(2,0)
target_foundFalseFalseFalseTrueTrue
Key Moments - 2 Insights
Why does the drone keep scanning even when the target is not found?
Because in the execution_table rows 3 and 5, the condition 'Detect target? No' causes the loop to continue scanning and moving the position.
What happens immediately after the target is detected?
As shown in row 7 and 8, once the target is detected (target_found=True), the drone sends the coordinates to the rescue team.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the value of 'target_found' at Step 6?
AFalse
BTrue
CNone
DUndefined
💡 Hint
Check the 'target_found' column at Step 6 in the execution_table.
At which step does the drone send the coordinates to the rescue team?
AStep 7
BStep 8
CStep 9
DStep 6
💡 Hint
Look at the 'Action' column in the execution_table for when 'Send coordinates to rescue team' happens.
If the target was never detected, what would happen to the 'position' variable?
AIt would stay at (0,0)
BIt would become None
CIt would keep updating as the drone moves
DIt would reset to start
💡 Hint
Refer to the 'position' changes in variable_tracker and execution_table rows where scanning continues without detection.
Concept Snapshot
Search and rescue assistance:
- Initialize drone position and target_found flag
- Loop: scan area and check for target
- If target found, mark location and send coordinates
- Stop mission after sending info
- Keeps scanning and moving until target detected
Full Transcript
This visual execution shows a drone starting at position (0,0) scanning for a target. It loops scanning and moving position until the target is detected at (2,0). Once detected, it sends the coordinates to the rescue team and ends the mission. Variables 'position' and 'target_found' update step-by-step. The drone continues scanning while target_found is False, moving position each time. When target_found becomes True, it sends coordinates and stops scanning.