Camera Lens Health Monitor and Intermittent Fault Triage for a Driver-Assist Vehicle
System DesignModel answerLast updated
Design a sensor layout, lens-obstruction detector and fallback logic for a driver-assist vehicle, then plan how to track down a camera fault that fires about once an hour in clear weather.
Context
You are on the software team for an electric utility vehicle that offers two driver-assistance modes:
- Highway assist (Level 2+): lane centering, adaptive cruise control and automatic lane changes.
- Low-speed maneuvering: parking help and slow off-road or trail driving.
Exterior camera lenses can be compromised by mud, snow, dust, direct sunlight and condensation. You need to design three things: the sensor layout, an on-vehicle detector for lens problems, and a manager that reduces driving-assist capability safely when a sensor is impaired.
What the design must cover
- Sensors and placement. Choose cameras and complementary sensors (radar, ultrasonic, etc.) for full 360-degree coverage, with redundancy for forward highway driving.
- Lens health detection. Describe a real-time pipeline that labels each camera as
Clear,Partially Occluded,Fully OccludedorBlinded/Glare. - Degradation behavior. Specify how features step down when a critical sensor is impaired or lost. Discuss fail-operational versus fail-safe behavior and the timing of handing control back to the driver.
- Event snapshots. Define lightweight diagnostic captures (sensor metadata, synchronized timestamps, small context frames) taken whenever a health state changes.
Constraints
- The detector runs on the automotive SoC's accelerator and may use less than 5% of the perception compute budget.
- Full occlusion must be reported within 1.0 second.
- Cellular telemetry must stay under 20 MB per driving hour in normal operation.
Field problem to troubleshoot
A fleet technician reports that on a group of validation vehicles, the front wide camera raises a Fully Occluded event about every 60 minutes (plus or minus 2 minutes). It happens in bright, clear daylight, and each time the highway steering assist briefly disengages.
Explain how you would work with the technician to:
- Form testable root-cause hypotheses.
- Reproduce and isolate the problem without endangering test drivers.
- Decide which telemetry, logs and time-synchronized bus traces (CAN, Ethernet, PTP timestamps) you need.
- Validate a fix and check for regressions before wide release.
Give a structured answer with concrete numbers and trade-offs.
Hints
Hint 1
Start by turning the constraints into numbers: how many frames fit in 1.0 s at 30 fps, and what 20 MB per hour means as an average data rate. These set the voting window and the snapshot size and frequency.
Hint 2
For each forward-highway function, ask which two independent sources protect it. Camera plus camera and camera plus radar cover different failure modes, so think about which one backs lateral control and which backs longitudinal control.
Hint 3
A fault recurring every hour in perfect weather is unlikely to be environmental. Ask whether the period is tied to uptime or to wall-clock time, and consider counters, buffers, clock adjustments, or periodic background jobs. Also ask whether the detector is judging real image content or a missing or invalid frame.
Hint 4
For safe reproduction, move from least to most risky: replay recorded footage on a bench, inject faults to speed up the timer, then a stationary vehicle, then a closed track with steering actuation disabled.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
1. Pin down requirements
- Highway assist up to about 130 km/h, low-speed maneuvering below about 15 km/h. The driver is the fallback, so the system is fail-degraded, not fully fail-operational.
- Around 10 cameras at 30 fps (2-8 MP). The front wide camera is roughly 120 degrees FOV.
- 1.0 s equals 30 frames, so the detector has a small frame budget for voting.
- 20 MB/hour is about 5.6 KB/s on average.
- Question to ask: is redundancy needed for lateral control, longitudinal control, or both? It drives the fallback design.
2. Sensor layout
| Zone | Sensors | Role |
|---|---|---|
| Forward | Narrow (~30 degrees, long range), main (~60 degrees), wide (~120 degrees) cameras at the windshield; long-range radar in the bumper | Overlapping vision plus an independent radar for cruise control |
| Front corners | Corner radar, fender cameras | Cut-ins, lane changes |
| Sides | Mirror or pillar cameras | Blind spot, lane change |
| Rear | Rear camera, rear corner radar | Approaching traffic |
| Near field | About 12 ultrasonics, 4 surround fisheye cameras | Parking, trails |
Principle: each forward function has two independent sources. Camera-camera protects steering, camera-radar protects speed control. Windshield cameras sit in the wiper sweep, which handles most mud. Bumper sensors need washers or heaters.
3. Lens health detection
Input integrity first. Check sequence numbers, timestamp monotonicity, link CRC and exposure metadata. A missing or invalid frame is a data fault, not an occlusion. This matters for the field bug.
Cheap inputs. Use a low-resolution ISP output (e.g. 320x200 luma) and free ISP statistics (exposure histogram, saturation counts, sharpness). Never process full-resolution frames.
Per-tile features on an 8x8 grid: Laplacian variance (blur), edge density, histogram entropy, fractions of near-black and saturated pixels, and temporal variance (static tiles while the car moves suggest a blocked lens).
Classifier. A small gradient-boosted model or tiny CNN over 64 tiles x ~6 features, well under 1% of compute.
Frame labels:
- Fully occluded: at least ~85% of tiles dead.
- Partially occluded: a contiguous dead region.
- Blinded/glare: saturated, low-entropy tiles around a bright blob that matches the sun's position.
Cross-checks:
- Optical flow versus wheel speed: no flow at highway speed means blocked.
- Radar targets projected into the image with no visual edges there.
- Disagreement with overlapping cameras (narrow sees lane lines, wide does not).
Temporal logic. A 0.5 s sliding vote (e.g. 12 of 15 frames) plus cross-check asserts under 1.0 s. Clearing needs about 3 s of healthy frames (asymmetric hysteresis), avoiding flapping.
4. Degradation manager
A deterministic state machine in a safety-rated supervisor:
- Nominal: all features.
- Wide camera lost, narrow and main fine: keep cruise control and reduced lane centering, disable automatic lane changes, show an advisory.
- Forward vision lost: keep speed control on radar, issue an immediate take-over request (visual and audible), hold the last valid path for at most ~4 s, then ramp steering torque out over ~1 s.
- No driver response in ~10 s or radar also lost: minimal-risk maneuver: in-lane deceleration around 2-3 m/s^2, hazards on, emergency call once stopped.
Re-engagement requires sustained healthy status and an explicit driver action. No automatic resume.
5. Snapshots and bandwidth
On each health transition capture roughly: 2 KB metadata, five small JPEG frames (about 75 KB, from -2 s to +1 s), 10 KB features, 40 KB bus slice, so ~130 KB per event. 20 MB allows about 150 events per hour in theory. Cap at ~50 per hour, deduplicate repeats, and defer bulk data to Wi-Fi.
6. Troubleshooting the hourly fault
Reading the signature. Periodic, daylight-independent, 60 +/- 2 min: a time-triggered software or system event, not weather. Jitter suggests the timer is anchored to boot or ignition, not wall-clock.
| Hypothesis | Mechanism | Discriminating test |
|---|---|---|
| Counter or ring-buffer wrap | 108,000 frames at 30 fps is exactly 60 min; a wrap serves stale or zeroed data | Events align with uptime; preload counter near wrap on bench |
| Clock step (gPTP/NTP) | Non-monotonic timestamps cause dropped frames and black placeholders | Log sync offset, check for master changes |
| Sensor recalibration | Dark calibration frames | Check exposure and gain metadata on flagged frames |
| Storage flush or log rotation | I/O stall causes frame drops or repeats | Correlate with syslog and iowait |
| Thermal or fan cycle | Interference causes link CRC errors | Fan PWM versus serializer error counters |
Working with the technician. Ask them to record ignition time, wall-clock time, ambient temperature and software build for every event. Plot events against uptime and against wall-clock; the axis with the tight spread identifies the timer source. Compare across vehicles and builds.
Safe reproduction. Escalate gradually:
- Hardware-in-the-loop bench with recorded clear-day video fed to the production ECU, soaked for hours, with accelerated fault injection (counter preset, clock step, forced log rotation).
- Stationary vehicle or dynamometer.
- Closed track in shadow mode with steering actuation disabled.
Never debug with live lateral control on public roads.
Data needed, all on one synchronized timebase: raw frames from 2 s before to 1 s after, per-tile features and classifier outputs, frame sequence numbers, timestamps and drops, sync offset history, link error counters, exposure and gain, CPU, memory and I/O load, thermal and fan data, CAN speed, and supervisor state transitions.
Validating the fix.
- Confirm root cause by reproducing on the bench, applying the fix, and showing the fault disappears; also show it returns if the fix is reverted.
- Add the fix's real cause to the detector: treat invalid or missing frames as a data fault with its own handling, and require cross-sensor confirmation before declaring full occlusion.
- Run a regression suite with real occlusion clips (mud, snow, glare) to confirm detection latency stays under 1.0 s and no true positives are lost.
- Soak at least several multiples of the fault period (e.g. 8+ hours) across multiple units.
- Staged rollout: a few vehicles in shadow mode, then a small fleet cohort, then wide release, with a monitored event-rate metric and a rollback path.
Common mistakes
- Treating a missing frame as an occluded lens.
- Using a single sensor modality to confirm a fault.
- Symmetric hysteresis causing flapping.
- Allowing automatic resume of lateral control.
- Reproducing on public roads with live steering.
- Skipping the uptime-versus-wall-clock analysis.