Complete the code to send a command and wait for acknowledgment.
send_command([1])
wait_for_ack()The send_command function requires a command like TAKE_OFF to initiate the drone's takeoff and then waits for acknowledgment.
Complete the code to check if the acknowledgment status is successful.
if ack_status == [1]: print('Command acknowledged')
ERROR instead of SUCCESS.PENDING which means acknowledgment is not yet received.The acknowledgment status SUCCESS means the command was accepted by the drone.
Fix the error in the acknowledgment timeout handling code.
if ack_received is not [1]: retry_command()
ack_received is not False which is the opposite logic.None or 0 which are not boolean values here.The code checks if acknowledgment was not received (ack_received is not True) to retry the command.
Fill both blanks to create a dictionary of commands with their acknowledgment status.
ack_dict = {cmd: [1] for cmd in commands if ack_status[cmd] [2] 'SUCCESS'}!=.The dictionary comprehension maps each command to its acknowledgment status only if the status equals 'SUCCESS'.
Fill all three blanks to filter commands and create a dictionary with uppercase command names and their acknowledgment status.
filtered_ack = [1]([2]: ack_status[[3]] for [3] in commands if ack_status[[3]] == 'SUCCESS')
list instead of dict which creates a list, not a dictionary.The code creates a dictionary with uppercase command names as keys and their acknowledgment status as values, filtering only successful acknowledgments.