Complete the code to initialize the optical flow sensor.
optical_flow_sensor = OpticalFlowSensor([1])The optical flow sensor is connected to port 0 for indoor positioning.
Complete the code to read the optical flow data.
flow_data = optical_flow_sensor.[1]()start() instead of read() does not return data.The read() method retrieves the current optical flow data from the sensor.
Fix the error in the code to calculate displacement from flow data.
displacement = flow_data.[1] * time_intervaldistance attribute directly causes incorrect calculation.The velocity attribute gives the flow velocity, which multiplied by time gives displacement.
Fill both blanks to update the drone's position using optical flow data.
new_position = (current_position[0] + displacement[1], current_position[1] + displacement[2])
Displacement is a tuple; index 0 is x-axis, index 1 is y-axis displacement.
Fill all three blanks to filter optical flow data for valid movement detection.
filtered_flow = {k: v for k, v in flow_data.items() if v[1] [2] and v[3] 0}This filters values greater than -1 and less than 0 to detect valid negative movement.
