
Detecting Optical Flow Sensor Failures in ArduPilot Logs
Key Takeaway
Detect optical flow sensor failures in ArduPilot logs for better drone performance.
TL;DR: Detect optical flow sensor failures in ArduPilot logs by identifying ERR Subsys=19 ECode=2 for sensor issues. Inspect flow_x, flow_y, and quality values to confirm sensor health, and recalibrate if readings are zero or drifting.
What Optical Flow Sensor Data Looks Like in the Log
In ArduPilot logs, optical flow data is recorded under the OPTICAL_FLOW message. This message typically includes fields that give insight into the sensor's performance and health.
OPTICAL_FLOW TimeUS flow_x flow_y quality
TimeUS: Timestamp of the reading in microseconds.flow_x: Horizontal flow measurement in pixels per second.flow_y: Vertical flow measurement in pixels per second.quality: Indicator of the sensor's reliability, with values typically ranging from 0 to 255.
Key Takeaway: Monitoring the OPTICAL_FLOW message allows us to assess the health and performance of the optical flow sensor effectively.
Confirming it in Mission Planner
To verify optical flow sensor data in Mission Planner, follow these steps:
- Open Mission Planner and connect to your drone.
- Navigate to the Flight Data tab.
- Click on DataFlash Logs in the side menu.
- Select Review a Log and choose the appropriate log file.
Once in the log review section, plot the following fields together:
OPTICAL_FLOW.flow_xOPTICAL_FLOW.flow_yOPTICAL_FLOW.quality
Key Takeaway: Plotting the relevant flow fields in Mission Planner enables us to visually assess the performance of the optical flow sensor during flight.
Confirming it in MAVExplorer
In MAVExplorer, you can use the following command to graph optical flow data:
MAV> graph OPTICAL_FLOW.flow_x OPTICAL_FLOW.flow_y
This command will plot the horizontal and vertical flow measurements, allowing you to visually inspect the sensor's performance. Look for consistent non-zero values and check for any sudden drops that may indicate sensor issues.
Key Takeaway: Using MAVExplorer to graph flow data provides a clear view of the sensor's performance, helping to confirm sensor health quickly.
Why Optical Flow Sensor Failures Happen — Ranked by Frequency
- Zero Readings: If both
flow_xandflow_yare zero, it indicates the sensor may not be detecting any movement. This often means the sensor is malfunctioning or improperly calibrated. - Inconsistent Quality Values: Low
qualityvalues indicate unreliable data. If you notice values dropping significantly, it can signal a need for recalibration or replacement. - Drifting in Loiter Mode: A drone that drifts while in loiter mode may have a faulty optical flow sensor, causing inaccurate position hold. This often relates to either sensor failure or issues with the calibration.
- Environmental Factors: Poor lighting or surfaces that are too reflective can affect sensor readings. It’s essential to ensure the flying area is suitable for optical flow operation.
Key Takeaway: Understanding common causes of optical flow failures helps in diagnosing issues effectively and guiding troubleshooting efforts.
Fixes for Optical Flow Sensor Issues
- Check and recalibrate the sensor: Use the
OPTICAL_FLOW_CALIBRATEprocedure to ensure accurate readings. - Inspect the sensor's mounting: Ensure the sensor is securely mounted and not obstructed, which may affect its performance.
- Update firmware: Ensure that the autopilot firmware is updated to the latest version to benefit from fixes and improvements related to optical flow.
- Adjust
OPTICAL_FLOW_ENABLE: Ensure this parameter is enabled to allow the sensor to function properly. - Evaluate the environment: Ensure the flying environment is suitable for optical flow, avoiding excessively reflective surfaces and poor lighting.
Key Takeaway: Implementing these fixes can restore the proper function of the optical flow sensor, ensuring reliable drone navigation.
When This Isn't Actually an Optical Flow Sensor Issue
- GPS Glitches: If your drone is experiencing navigation issues, it could be a GPS glitch rather than an optical flow failure. Check for
ERR Subsys=11 ECode=2in the logs. - Barometer Issues: Problems with altitude hold may relate to barometer failures indicated by
ERR Subsys=18, not the optical flow sensor. - Thrust Loss: If the drone is drifting downwards, it might be due to thrust loss (check
ERR Subsys=25), rather than optical flow problems.
Key Takeaway: Distinguishing between actual optical flow sensor failures and other issues helps in accurate diagnostics and troubleshooting.
When LogHat Helps — and When It Doesn't
LogHat excels in processing and analyzing flight logs, highlighting trends and issues with optical flow sensors effectively. However, it cannot perform physical inspections or calibrations of the sensor, which may be necessary for resolving certain issues.
Key Takeaway: While LogHat provides valuable insights into optical flow sensor performance, physical inspection and calibration remain essential for comprehensive troubleshooting.
How can I tell if my optical flow sensor is working?
Check for non-zero readings in theflow_x and flow_y data in logs. If both values are zero, it may indicate a malfunction.Why is my drone drifting in loiter mode with optical flow?
This may indicate a faulty sensor or incorrect calibration. Ensure that the sensor is functioning properly and check for any obstructions.What steps can I take to troubleshoot optical flow issues?
Inspect the sensor's mounting, recalibrate it, and ensure firmware is up to date. Additionally, verify that theOPTICAL_FLOW_ENABLE parameter is set correctly.How does lighting affect optical flow sensor performance?
Poor lighting can lead to inaccurate readings, as the sensor relies on contrast to detect movement. Ensure you are flying in suitable conditions.What environmental factors should I consider for optical flow sensors?
Avoid excessively reflective surfaces and ensure adequate lighting to maintain reliable sensor performance.How can I confirm optical flow data in MAVExplorer?
Use the commandMAV> graph OPTICAL_FLOW.flow_x OPTICAL_FLOW.flow_y to visualize the sensor's performance.What is the significance of the quality value in optical flow logs?
Thequality value indicates the reliability of the sensor's readings; values closer to 255 represent higher reliability.If you're facing ongoing challenges with optical flow sensor failures or want to enhance your log analysis capabilities, consider trying LogHat for comprehensive insights and support. Our platform is designed to help drone engineers and enthusiasts navigate complex log data efficiently.
About the author
LogHat Engineering Team
The LogHat engineering team — drone-systems engineers who build and operate the LogHat flight analytics platform. Posts in this byline are written and reviewed by team members working on the parsers, analysis engine, and Vector AI that the post describes.
Tagged
Try LogHat
Analyze your flight logs in seconds
Upload a .bin, .tlog, .log, or .ulg file. Get AI crash analysis, 3D replay, and forensic PDF reports instantly.
Try LogHat Free