Challenge - 5 Problems
Sensor Calibration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of accelerometer offset correction code
What is the output of this accelerometer offset correction code snippet?
Drone Programming
def calibrate_accel(raw_values, offset): return [v - offset for v in raw_values] raw = [1024, 1030, 1018] offset = 1020 corrected = calibrate_accel(raw, offset) print(corrected)
Attempts:
2 left
💡 Hint
Think about subtracting the offset from each raw value.
✗ Incorrect
The function subtracts the offset (1020) from each raw accelerometer reading, so 1024-1020=4, 1030-1020=10, 1018-1020=-2.
🧠 Conceptual
intermediatePurpose of gyro bias calibration
Why is gyro bias calibration important in drone sensor calibration?
Attempts:
2 left
💡 Hint
Think about what happens if the gyro always reads a small value even when still.
✗ Incorrect
Gyro bias calibration removes constant drift errors that cause the gyro to report rotation even when stationary, improving accuracy.
🔧 Debug
advancedIdentify error in compass calibration code
What error does this compass calibration code raise when run?
Drone Programming
def calibrate_compass(raw_readings, hard_iron_offset): calibrated = [] for x, y, z in raw_readings: calibrated.append((x - hard_iron_offset[0], y - hard_iron_offset[1], z - hard_iron_offset[2])) return calibrated raw = [(30, 45, 60), (32, 47, 62)] offset = [5, 5] result = calibrate_compass(raw, offset) print(result)
Attempts:
2 left
💡 Hint
Check the length of the offset list compared to how many elements you subtract.
✗ Incorrect
The offset list has only 2 elements but the code tries to access offset[2], causing IndexError.
📝 Syntax
advancedSyntax error in gyro calibration function
Which option contains the correct syntax for this gyro calibration function?
Drone Programming
def gyro_calibrate(raw_data, bias): calibrated = [] for reading in raw_data calibrated.append(reading - bias) return calibrated
Attempts:
2 left
💡 Hint
Look carefully at the for loop syntax.
✗ Incorrect
The for loop is missing a colon at the end, causing a syntax error.
🚀 Application
expertCalculate final calibrated gyro reading
Given raw gyro readings [0.05, -0.02, 0.01] rad/s and a bias of [0.01, 0.00, -0.01], what is the final calibrated reading?
Attempts:
2 left
💡 Hint
Subtract bias from each raw reading element-wise.
✗ Incorrect
Subtracting bias from raw readings element-wise: 0.05-0.01=0.04, -0.02-0= -0.02, 0.01-(-0.01)=0.02.
