Consider this simplified code snippet that reads acceleration data from an IMU sensor and prints the magnitude of acceleration vector.
accel_x = 0.3
accel_y = 0.4
accel_z = 0.12
magnitude = (accel_x**2 + accel_y**2 + accel_z**2)**0.5
print(f"Acceleration magnitude: {magnitude:.2f} g")What will be printed?
accel_x = 0.3 accel_y = 0.4 accel_z = 0.12 magnitude = (accel_x**2 + accel_y**2 + accel_z**2)**0.5 print(f"Acceleration magnitude: {magnitude:.2f} g")
Remember to square each component, add them, then take the square root.
The magnitude is calculated as the square root of the sum of squares: sqrt(0.3² + 0.4² + 0.12²) = sqrt(0.09 + 0.16 + 0.0144) = sqrt(0.2644) ≈ 0.514. Rounded to two decimals is 0.51.
Choose the best description of what an IMU does in a drone system.
Think about sensors that detect movement and rotation.
An IMU uses accelerometers and gyroscopes to measure linear acceleration and angular velocity, helping the drone understand its orientation and motion.
Look at this code snippet that tries to calculate the average of IMU gyro readings but raises an error. What is the cause?
gyro_readings = [0.01, 0.02, 0.015]
avg_gyro = sum(gyro_readings) / len(gyro)
print(f"Average gyro: {avg_gyro}")gyro_readings = [0.01, 0.02, 0.015] avg_gyro = sum(gyro_readings) / len(gyro) print(f"Average gyro: {avg_gyro}")
Check variable names carefully.
The variable 'gyro' is not defined; the list is named 'gyro_readings'. Using 'len(gyro)' causes a NameError.
Choose the correct Python dictionary syntax to store IMU data for acceleration and gyroscope readings.
Remember dictionary syntax uses colons between keys and values, and curly braces.
Option D uses correct dictionary syntax with curly braces and colons. Option D misses a closing brace. Option D uses list brackets incorrectly. Option D uses '=' instead of ':'.
An IMU with 3-axis accelerometer and 3-axis gyroscope is used to estimate drone orientation. How many unique orientation states (degrees of freedom) can it determine without external references?
Think about rotation axes versus position tracking.
A 3-axis IMU measures angular velocity and acceleration along three axes, allowing calculation of 3 degrees of freedom: roll, pitch, and yaw. It cannot measure position (3 more degrees) without extra sensors.
