0
0
Drone Programmingprogramming~10 mins

Command acknowledgment handling 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 send a command and wait for acknowledgment.

Drone Programming
send_command([1])
wait_for_ack()
Drag options to blanks, or click blank then click option'
ALAND
BTAKE_OFF
CMOVE_FORWARD
DHOVER
Attempts:
3 left
💡 Hint
Common Mistakes
Using a movement command instead of a takeoff command.
Not sending any command before waiting for acknowledgment.
2fill in blank
medium

Complete the code to check if the acknowledgment status is successful.

Drone Programming
if ack_status == [1]:
    print('Command acknowledged')
Drag options to blanks, or click blank then click option'
ASUCCESS
BERROR
CTIMEOUT
DPENDING
Attempts:
3 left
💡 Hint
Common Mistakes
Checking for ERROR instead of SUCCESS.
Using PENDING which means acknowledgment is not yet received.
3fill in blank
hard

Fix the error in the acknowledgment timeout handling code.

Drone Programming
if ack_received is not [1]:
    retry_command()
Drag options to blanks, or click blank then click option'
ATrue
BNone
CFalse
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Checking if ack_received is not False which is the opposite logic.
Using None or 0 which are not boolean values here.
4fill in blank
hard

Fill both blanks to create a dictionary of commands with their acknowledgment status.

Drone Programming
ack_dict = {cmd: [1] for cmd in commands if ack_status[cmd] [2] 'SUCCESS'}
Drag options to blanks, or click blank then click option'
Aack_status[cmd]
B!=
C==
Dcmd
Attempts:
3 left
💡 Hint
Common Mistakes
Using the command name as the value instead of the acknowledgment status.
Using the wrong comparison operator like !=.
5fill in blank
hard

Fill all three blanks to filter commands and create a dictionary with uppercase command names and their acknowledgment status.

Drone Programming
filtered_ack = [1]([2]: ack_status[[3]] for [3] in commands if ack_status[[3]] == 'SUCCESS')
Drag options to blanks, or click blank then click option'
Adict
Bcmd.upper()
Ccmd
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using list instead of dict which creates a list, not a dictionary.
Using the command name directly instead of uppercase for keys.