0
0
Drone Programmingprogramming~10 mins

Sending custom MAVLink commands 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 custom MAVLink command using the drone object.

Drone Programming
drone.[1](command_long_encode(0, 0, command_id, 0, param1, param2, param3, param4, param5, param6, param7))
Drag options to blanks, or click blank then click option'
Asend_mavlink
Bdisconnect
Cconnect
Dreceive_mavlink
Attempts:
3 left
💡 Hint
Common Mistakes
Using receive_mavlink instead of send_mavlink
Trying to connect or disconnect instead of sending commands
2fill in blank
medium

Complete the code to import the MAVLink command encoder function.

Drone Programming
from pymavlink.dialects.v20 import common as mavlink
command_long_encode = [1]
Drag options to blanks, or click blank then click option'
Amavlink.MAVLink_command_long_encode
Bmavlink.MAVLink_command_short_encode
Cmavlink.MAVLink_heartbeat_encode
Dmavlink.MAVLink_param_request_read_encode
Attempts:
3 left
💡 Hint
Common Mistakes
Using command_short_encode which is for short commands
Using heartbeat or param request functions by mistake
3fill in blank
hard

Fix the error in the code to correctly send a MAVLink command with parameters.

Drone Programming
drone.send_mavlink(command_long_encode(0, 0, [1], 0, 1, 2, 3, 4, 5, 6, 7))
Drag options to blanks, or click blank then click option'
AMAV_CMD_DO_CHANGE_SPEED
BMAV_CMD_NAV_TAKEOFF
CMAV_CMD_COMPONENT_ARM_DISARM
DMAV_CMD_DO_SET_MODE
Attempts:
3 left
💡 Hint
Common Mistakes
Using a navigation command instead of an arm/disarm command
Using a mode set command without proper parameters
4fill in blank
hard

Fill both blanks to create a dictionary of commands with their parameter count.

Drone Programming
commands = { [1]: 7, [2]: 3 }
Drag options to blanks, or click blank then click option'
AMAV_CMD_DO_SET_MODE
BMAV_CMD_NAV_LAND
CMAV_CMD_COMPONENT_ARM_DISARM
DMAV_CMD_NAV_TAKEOFF
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up commands and their parameter counts
Using commands that don't fit the parameter counts given
5fill in blank
hard

Fill all three blanks to filter commands with 5 or more parameters.

Drone Programming
filtered = {cmd: params for cmd, params in commands.items() if params [1] 5 [2] cmd != [3]
Drag options to blanks, or click blank then click option'
A>
B>=
Cand
DMAV_CMD_NAV_LAND
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '>=' which excludes commands with exactly 5 parameters
Not excluding the land command properly