Given the motor speeds below, what direction will the drone move?
motor_speeds = {'front_left': 1200, 'front_right': 1200, 'rear_left': 1300, 'rear_right': 1300}Higher speed on rear motors lifts the rear more, causing the drone to tilt forward.
The rear motors have higher speed (1300 > 1200), providing more lift at the rear, tilting the nose down so the drone moves forward.
Consider this motor speed setup:
motor_speeds = {'front_left': 1400, 'front_right': 1200, 'rear_left': 1200, 'rear_right': 1400}What rotation will the drone perform?
Opposite motors spinning faster cause rotation.
The front-left and rear-right motors spin faster, creating torque that rotates the drone clockwise.
What error will this code cause when adjusting motor speeds?
def adjust_speeds(speeds):
for motor in speeds:
speeds[motor] += 100
return speeds
motors = {'front_left': 1200, 'front_right': 1200, 'rear_left': 1200}
adjust_speeds(motors)Check if the code modifies the dictionary keys or values during iteration.
The code correctly updates each motor's speed by adding 100. No keys are added or removed during iteration, so no error occurs.
If all four motors increase speed by the same amount, what happens to the drone?
Think about lift force when all motors push equally.
Increasing all motor speeds equally increases lift, causing the drone to rise straight up without tilting or rotating.
Given this code snippet, what is the final speed of the front_left motor?
base_speed = 1000
throttle = 200
pitch = -50
motor_speeds = {
'front_left': base_speed + throttle + pitch,
'front_right': base_speed + throttle - pitch,
'rear_left': base_speed + throttle - pitch,
'rear_right': base_speed + throttle + pitch
}Calculate base_speed + throttle + pitch carefully.
front_left speed = 1000 + 200 + (-50) = 1150.
