0
0
Drone Programmingprogramming~10 mins

Line following with camera in Drone Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to capture an image from the drone's camera.

Drone Programming
image = drone.camera.[1]()
Drag options to blanks, or click blank then click option'
Astart
Bcapture
Cmove
Dfly
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'fly' or 'move' which are for drone movement, not camera capture.
Using 'start' which might start the camera but doesn't capture an image.
2fill in blank
medium

Complete the code to convert the captured image to grayscale.

Drone Programming
gray_image = drone.camera.[1](image)
Drag options to blanks, or click blank then click option'
Agrayscale
Bblur
Ccolorize
Dresize
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'colorize' which adds color instead of removing it.
Using 'blur' which softens the image but doesn't convert to grayscale.
3fill in blank
hard

Fix the error in the code to detect edges in the grayscale image.

Drone Programming
edges = drone.camera.[1](gray_image)
Drag options to blanks, or click blank then click option'
Adetect_edges
Bcapture
Cblur
Dresize
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'blur' which smooths the image but doesn't detect edges.
Using 'resize' which changes image size but not edges.
4fill in blank
hard

Fill both blanks to create a dictionary of line positions and their lengths from detected edges.

Drone Programming
line_data = {pos: [1] for pos in edges if edges[pos] [2] 0}
Drag options to blanks, or click blank then click option'
Aedges[pos]
B==
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which only includes edges exactly zero length.
Using '<' which includes edges less than zero, which is invalid.
5fill in blank
hard

Fill all three blanks to control the drone's movement based on line position and length.

Drone Programming
if line_data.get([1]) [2] [3]:
    drone.move_forward()
Drag options to blanks, or click blank then click option'
A'center'
B>
C10
D'left'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'left' instead of 'center' to check line position.
Using '<' instead of '>' which reverses the condition.