0
0
Drone Programmingprogramming~10 mins

Communication between drones 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 message from one drone to another.

Drone Programming
drone1.send_message([1])
Drag options to blanks, or click blank then click option'
Areceive_message()
B"Hello Drone 2"
Cconnect()
Dstatus()
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function call instead of a message string.
Forgetting to put the message in quotes.
2fill in blank
medium

Complete the code to receive a message on drone2.

Drone Programming
message = drone2.[1]()
Drag options to blanks, or click blank then click option'
Asend_message
Bconnect
Creceive_message
Ddisconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using send_message() instead of receive_message().
Using connection functions instead of message functions.
3fill in blank
hard

Fix the error in the code to broadcast a message to all drones.

Drone Programming
network.[1]("Start mission")
Drag options to blanks, or click blank then click option'
Abroadcast_message
Bsend_message
Creceive_message
Dconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using send_message() which sends to one drone only.
Using receive_message() which is for receiving.
4fill in blank
hard

Fill both blanks to check if drone3 is connected and then send a message.

Drone Programming
if drone3.[1]():
    drone3.[2]("Ready")
Drag options to blanks, or click blank then click option'
Ais_connected
Bsend_message
Creceive_message
Dconnect
Attempts:
3 left
💡 Hint
Common Mistakes
Using connect() instead of is_connected() to check status.
Using receive_message() instead of send_message() to send.
5fill in blank
hard

Fill all three blanks to create a dictionary of drone IDs and their last received messages if the message length is greater than 5.

Drone Programming
messages = {drone.[1]: drone.[2]() for drone in fleet if len(drone.[3]()) > 5}
Drag options to blanks, or click blank then click option'
Aid
Breceive_message
Dsend_message
Attempts:
3 left
💡 Hint
Common Mistakes
Using send_message() instead of receive_message().
Using wrong attribute for drone ID.