CARLA ? C-Shenron based Simualtor for Sensor data generation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

6.0 KiB

RARDCFAR_guide.md

C-Shenron Radar Metrology Debugging & Correction Guide


1. System Architecture (Your Implementation)

Signal Chain

LiDAR → Physics Engine → Raw ADC → Range FFT → Doppler FFT → Angle FFT → CFAR → Point Cloud

Your Actual Implementation (Code Verified)

Range FFT

fft(data * rangeWin * velWin, axis=0)

Doppler FFT

fftshift(fft(rangeProfile, axis=1), axis=1)

RD Heatmap

avgDopplerProfile = np.mean(dopplerProfile, axis=2)
rd_heatmap = |avgDopplerProfile|^2

RA Heatmap

ra_heatmap_raw = np.mean(dopplerProfile, axis=1)
ra_heatmap = |FFT(ra_heatmap_raw)|^2

2. Current Observations (From Your Output)

Correct

  • Range axis correct
  • RD vertical column at V=0
  • CFAR pipeline working
  • FFT chain structurally valid

Issues

Component Issue
RD No Doppler spread
RA Horizontal banding + no angular separation
CFAR Over-detecting static clutter
RA Phase cancellation artifacts

3. ROOT CAUSE ANALYSIS (CODE LEVEL)


ISSUE 1 — RA Banding (CRITICAL)

Problem Line:

ra_heatmap_raw = np.mean(dopplerProfile, axis=1)

Why This is WRONG

You are doing:

Coherent integration across Doppler (complex mean)

This causes:

🔴 Phase cancellation

For moving targets:

[ \sum e^{j\phi_k} ≈ 0 ]

→ Signal disappears


Result:

  • Horizontal banding
  • Missing targets
  • Weak angular structure

FIX (MANDATORY)

Replace with:

ra_heatmap_raw = np.sum(np.abs(dopplerProfile), axis=1)

Why This Works

  • Preserves energy
  • Removes phase sensitivity
  • Matches real radar power integration

ISSUE 2 — Missing Window on Angle FFT

Current:

fft(pointSel, axis=1)

Problem:

  • No spatial window → sidelobes
  • Poor angular resolution
  • Leakage → smearing

FIX

Apply Hann window:

window = np.hanning(N_antennas)
pointSel_windowed = pointSel * window

Then:

fft(pointSel_windowed, axis=1)

ISSUE 3 — Doppler Collapse

Problem Location:

avgDopplerProfile = np.mean(dopplerProfile, axis=2)

Why This is WRONG

  • Averaging complex signals across antennas
  • Phase misalignment → cancellation

Result:

  • Everything collapses to V=0
  • No velocity separation

FIX

Use power summation:

rd_heatmap = np.sum(np.abs(dopplerProfile)**2, axis=2)

Why:

  • Preserves Doppler energy
  • Matches real radar processing

ISSUE 4 — CFAR Too Permissive

Config:

threshold: 20
win_param: [9, 9, 3, 3]

Problem:

  • Large window → over-smoothing
  • Static clutter dominates noise estimate

Symptoms:

  • Entire vertical column detected
  • Poor selectivity

FIX

Adjust:

win_param: [6, 6, 2, 2]
threshold: 25–35

Optional Upgrade:

Switch to:

  • OS-CFAR (better robustness)
  • Or adaptive threshold per range band

ISSUE 5 — Velocity Axis Compression

Code:

velAxis = ...

Problem:

  • Likely too wide range
  • Real velocities compressed near zero

FIX

Limit:

vel_min = -20 m/s
vel_max = +20 m/s

ISSUE 6 — RA Formation Order

Current Flow:

Doppler → mean → angle FFT

Correct Flow:

Doppler → magnitude → sum → angle FFT

4. CORRECTED PIPELINE


RD Generation

rd_heatmap = np.sum(np.abs(dopplerProfile)**2, axis=2)

RA Generation

ra_heatmap_raw = np.sum(np.abs(dopplerProfile), axis=1)

window = np.hanning(N_ant)
ra_heatmap_raw *= window

ra_heatmap = np.abs(fftshift(fft(ra_heatmap_raw, axis=1)))**2

Angle Estimation

aoaProfile = fft(pointSel * window, axis=1)

5. VALIDATION CHECKLIST


RD

  • Static → vertical line
  • Moving → offset blobs
  • No collapse to center

RA

  • Left/right separation
  • Matches LiDAR geometry
  • No horizontal banding

CFAR

  • Sparse detections
  • Peaks only
  • No full-column activation

6. KEY INSIGHT (IMPORTANT)


Your Current System

FFT pipeline is correct BUT integration strategy is wrong


Core Problem

You are doing:

Coherent integration where incoherent is required


Radar Rule

Stage Integration Type
FFT Coherent
Power Incoherent

7. Shenron vs Your System

Component Shenron Your Current
Integration Incoherent Coherent
RA Energy field Phase-sensitive
RD Power-based ⚠️ Mixed
CFAR Tuned ⚠️ Over-permissive

8. Expected Outcome After Fix


RD

  • Clear moving targets
  • Velocity separation visible

RA

  • Clean blobs
  • Angular localization restored

CFAR

  • Sparse detections
  • True target extraction

9. Next Steps


Immediate

  1. Fix RD power calculation
  2. Fix RA incoherent integration
  3. Add Hann window

Then

  1. Tune CFAR
  2. Validate against LiDAR

Optional (Advanced)

  • Add antenna array geometry
  • Add beam pattern
  • Add noise model

10. Offer

If you want:

👉 I can rewrite your RadarProcessor into a correct, production-grade version 👉 Or debug further edge cases (multipath, clutter, velocity aliasing)


FINAL TAKEAWAY

Your system is architecturally correct But one fundamental mistake (coherent averaging) is breaking RA and RD fidelity.

Fix that → your system will jump to near Shenron-quality radar output.


End of Document