Detecting Optical Flow Sensor Failures in ArduPilot Logs
drone engineeringArduPilotoptical flowsensor troubleshooting

Detecting Optical Flow Sensor Failures in ArduPilot Logs

LogHat Engineering TeamMarch 28, 20266 min read

Key Takeaway

Detecting optical flow sensor failures in ArduPilot logs enhances drone navigation.

TL;DR: To detect optical flow sensor failures in ArduPilot logs, look for ERR Subsys=16 ECode=0, indicating no issues detected with parachute functionality, or check the EKF performance with XKF3.IVN values. Ensure FS_EKF_ACTION is set to 0 (Disabled) or 1 (Warning only) to allow RTL activation without disarming; setting it to 2 (Disarm), 3 (Land), or 4 (Alt Hold) prevents RTL from activating. **Remember that MODE Rsn=5 indicates an EKF failsafe, which may also prevent normal RTL functionality.**

How Can You Detect Optical Flow Sensor Failures in ArduPilot Logs?

Diagnosing RTL issues related to optical flow sensors is critical for ensuring safety and operational reliability. These sensors enable precise positioning and altitude control, which are essential during return-to-launch (RTL) scenarios. By analyzing log data, we can identify potential issues that may compromise the performance of these sensors. Understanding how to interpret log messages can help us diagnose RTL issues in ArduPilot effectively.

OPTICAL_FLOW_SENSOR
TimeUS
X
Y
Z
Quality
  • TimeUS: Timestamp of the reading in microseconds.
  • X: Optical flow measurement along the X-axis.
  • Y: Optical flow measurement along the Y-axis.
  • Z: Altitude measurement.
  • Quality: Indicator of the sensor's operational quality.
Key Takeaway: Optical flow sensors are vital for accurate navigation, and diagnosing their failures involves examining specific log messages and indicators.

How to Identify Sensor Failures in Logs?

Identifying optical flow sensor failures begins with reviewing the log data for anomalies that indicate sensor malfunctions. Typical symptoms include erratic or zero readings in the log files. You should also monitor the quality of the sensor readings, as a low quality score can highlight potential issues.

OPTICAL_FLOW_SENSOR X 0 Y 0 Z 0 Quality 0

Key indicators of sensor malfunction include:

  • Consistently zero values in X and Y, such as OPTICAL_FLOW_SENSOR X 0 Y 0.
  • Quality values indicating poor sensor performance, e.g., Quality 0.
  • Sudden spikes or drops in Z readings that do not correlate with real-world movements, such as Z 1000 followed by Z 0.
Key Takeaway: Look for zero or erratic readings in the log for indicators of optical flow sensor failures.

How to Confirm Sensor Issues in Mission Planner?

Using Mission Planner, you can access and visualize log data to confirm sensor issues. Follow this path:

Flight Data → DataFlash Logs → Review a Log

To effectively diagnose problems, plot the following fields together:

  • OPTICAL_FLOW_SENSOR.X
  • OPTICAL_FLOW_SENSOR.Y
  • OPTICAL_FLOW_SENSOR.Quality
  • CTUN.Alt

Analyzing these fields together can reveal discrepancies that point towards sensor malfunction. You can also compare sensor readings with expected values based on drone behavior. For example, if OPTICAL_FLOW_SENSOR.X and OPTICAL_FLOW_SENSOR.Y are consistently zero while the drone is in motion, this indicates a failure in the optical flow sensor.

Key Takeaway: Use Mission Planner to plot sensor fields and identify discrepancies that may indicate failures.

How to Confirm Sensor Issues in MAVExplorer?

MAVExplorer provides a command-line interface to analyze flight logs. To examine optical flow sensor performance, you can use the following command:

MAV> graph OPTICAL_FLOW_SENSOR.X OPTICAL_FLOW_SENSOR.Y

This command generates a plot of the optical flow readings along the X and Y axes. Look for trends or sudden changes in readings, which may indicate sensor issues. Additionally, you can combine this analysis with other sensor data to confirm your findings. For example, checking CTUN.Alt alongside optical flow measurements can help clarify potential discrepancies.

Key Takeaway: Use MAVExplorer to graph optical flow sensor data, aiding in the diagnosis of potential sensor failures.

What Causes Optical Flow Sensor Failures?

  1. Loose connections: Physical disconnections or loose wiring can lead to intermittent readings or complete failures.
  2. Sensor calibration issues: Improperly calibrated sensors can produce inaccurate data, impacting navigation and stability.
  3. Firmware incompatibility: Outdated or incompatible firmware can lead to sensor malfunctions, especially after updates.
  4. Environmental interference: Conditions like rapid movement or poor lighting can affect sensor performance, leading to erroneous readings.
  5. Hardware failure: Physical damage or wear can lead to a complete sensor failure, requiring replacement.
Key Takeaway: Understanding the common causes of optical flow sensor failures aids in identifying and addressing issues quickly.

What are the Fixes for Optical Flow Sensor Failures?

  1. Check physical connections: Examine wiring and ensure that the optical flow sensor is securely connected.
  2. Recalibrate the sensor: Follow the manufacturer's instructions to recalibrate the optical flow sensor.
  3. Update firmware: Ensure that the firmware is up-to-date and compatible with the optical flow sensor.
  4. Inspect for environmental factors: Test the sensor in different lighting conditions to rule out interference.
  5. Replace the sensor: If hardware failure is suspected, consider replacing the optical flow sensor.
Key Takeaway: Implement these fixes to resolve optical flow sensor issues and ensure reliable drone navigation.

When This Isn't Actually an Optical Flow Sensor Failure

  • Drifting in loiter mode may be caused by GPS issues rather than optical flow sensor failures.
  • Erratic behavior could result from a faulty IMU or other sensors, not just the optical flow sensor.
  • Unexpected altitude changes may be attributed to barometer malfunctions rather than optical flow errors.
Key Takeaway: Distinguishing between actual optical flow sensor failures and other potential issues is crucial for accurate troubleshooting.

When LogHat Helps — and When It Doesn't

LogHat assists in quickly identifying and diagnosing optical flow sensor issues by analyzing log data for specific patterns and anomalies. However, it cannot replace hands-on inspections of hardware or calibrations needed to address physical sensor problems. For example, while LogHat can highlight unusual trends in sensor performance, it may not detect loose connections or physical damage. Therefore, combining LogHat analysis with physical checks is essential for comprehensive troubleshooting.

Key Takeaway: Utilize LogHat for efficient log analysis but also conduct thorough hardware checks for comprehensive troubleshooting.
How can I tell if my optical flow sensor is malfunctioning?

Look for zero readings or erratic behavior in logs, specifically in the OPTICAL_FLOW_SENSOR data fields. Consistent zero values, as well as low quality ratings, are strong indicators of malfunction.

What should I do if my drone drifts in loiter mode?

Check sensor calibration and connections, and review logs for errors. It may also be necessary to inspect GPS data and ensure the drone is receiving a strong signal.

How can I improve my optical flow sensor's performance?

Ensure the sensor is calibrated properly and check for environmental factors that may be interfering with its operation, such as lighting conditions or obstacles.

What error codes indicate optical flow sensor issues?

Look for ERR Subsys=16 or erratic values in the OPTICAL_FLOW_SENSOR logs. Additionally, monitor the quality readings for further insights into sensor performance.

Can I use LogHat to analyze optical flow sensor data?

Yes, LogHat can analyze logs for indicators of optical flow sensor performance, helping to identify potential issues and improve overall reliability.

If you're encountering optical flow sensor failures in your ArduPilot logs, we encourage you to utilize LogHat for detailed analysis and insights. This tool can significantly aid in troubleshooting, ensuring your drone remains operational and safe. For further assistance or to share your experiences, connect with us through our support channels.

About the author

LE

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

drone engineeringArduPilotoptical flowsensor troubleshooting

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