0
0
Drone Programmingprogramming~10 mins

MAVLink message structure 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 define the MAVLink message ID.

Drone Programming
message_id = [1]
Drag options to blanks, or click blank then click option'
A0x10
B0xFF
C0x01
D0x00
Attempts:
3 left
💡 Hint
Common Mistakes
Using decimal numbers instead of hexadecimal.
Using an invalid message ID.
2fill in blank
medium

Complete the code to set the payload length of the MAVLink message.

Drone Programming
payload_length = [1]
Drag options to blanks, or click blank then click option'
A12
B0
C255
D8
Attempts:
3 left
💡 Hint
Common Mistakes
Setting payload length to zero.
Using too large a number for payload length.
3fill in blank
hard

Fix the error in the code to correctly calculate the checksum of the MAVLink message.

Drone Programming
checksum = crc_accumulate([1], message_bytes)
Drag options to blanks, or click blank then click option'
A0xFF
B0x00
C0x55
D0xFFFF
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero as initial CRC value.
Using 0xFFFF which is too large for 8-bit CRC.
4fill in blank
hard

Fill both blanks to create a MAVLink message header with start byte and system ID.

Drone Programming
header = [[1], [2]]
Drag options to blanks, or click blank then click option'
A0xFE
B0x01
C0x10
D0x00
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong start byte.
Confusing system ID with message ID.
5fill in blank
hard

Fill all three blanks to build a MAVLink message dictionary with keys: 'msg_id', 'length', and 'payload'.

Drone Programming
mavlink_msg = {'msg_id': [1], 'length': [2], 'payload': [3]
Drag options to blanks, or click blank then click option'
A0x10
B8
Cb'\x01\x02\x03\x04\x05\x06\x07\x08'
Db'\x00\x00\x00\x00'
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching payload length and actual bytes.
Using string instead of bytes for payload.