0
0
Drone Programmingprogramming~20 mins

Camera gimbal control in Drone Programming - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Gimbal Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Gimbal pitch angle adjustment output
What is the output of this code controlling the gimbal pitch angle?
Drone Programming
gimbal_pitch = 10
command = 'up'
if command == 'up':
    gimbal_pitch += 5
elif command == 'down':
    gimbal_pitch -= 5
print(gimbal_pitch)
A15
B5
CError
D10
Attempts:
2 left
💡 Hint
Check how the pitch angle changes when the command is 'up'.
🧠 Conceptual
intermediate
1:30remaining
Understanding gimbal stabilization purpose
Why do camera gimbals stabilize the camera during drone flight?
ATo keep the camera steady despite drone movements
BTo increase drone speed
CTo reduce battery consumption
DTo improve drone GPS accuracy
Attempts:
2 left
💡 Hint
Think about what happens to a camera when the drone moves suddenly.
🔧 Debug
advanced
2:30remaining
Fix the gimbal yaw control error
What error does this code produce when trying to set the gimbal yaw angle?
Drone Programming
gimbal_yaw = 0
def set_yaw(angle):
    if angle >= -90 and angle <= 90:
        gimbal_yaw = angle
set_yaw(45)
print(gimbal_yaw)
ATypeError because of wrong variable type
BSyntaxError due to missing colon
CNameError because gimbal_yaw is not defined
DNo error, prints 45
Attempts:
2 left
💡 Hint
Check the if statement syntax carefully.
📝 Syntax
advanced
2:30remaining
Identify the correct gimbal pitch control syntax
Which option correctly sets the gimbal pitch to 30 degrees using a function?
A
def set_pitch(angle):
    pitch == angle
set_pitch(30)
print(pitch)
B
def set_pitch(angle):
    pitch = angle
set_pitch(30)
print(pitch)
C
def set_pitch(angle):
    global pitch
    pitch = angle
set_pitch(30)
print(pitch)
D
def set_pitch(angle):
    pitch = angle
print(pitch)
set_pitch(30)
Attempts:
2 left
💡 Hint
Consider variable scope inside and outside the function.
🚀 Application
expert
3:00remaining
Calculate final gimbal roll angle after commands
Given the initial roll angle is 0, and the commands ['left', 'left', 'right', 'left'] change the roll by -10, -10, +10, -10 degrees respectively, what is the final roll angle?
A0
B-10
C-30
D-20
Attempts:
2 left
💡 Hint
Add each command's effect step by step starting from 0.