Skip to content

Commit

Permalink
feat: add radar config for dream pcd
Browse files Browse the repository at this point in the history
  • Loading branch information
shelta-zhao committed Feb 1, 2025
1 parent 22b2454 commit 9d6767f
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 22 deletions.
Binary file added data/adc_data/dream_pcd_data/frame_1.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,43 @@ readObj:
iqSwap: 0
numLane: 2
chInterleave: 1
dataSizeOneFrame: 2088960
numAdcSamplePerChirp: 512
numChirpsPerFrame: 255
dataSizeOneFrame: 3145728
numAdcSamplePerChirp: 128
numChirpsPerFrame: 384
numTxForMIMO: 3
numRxForMIMO: 4
rangeFFTObj:
radarPlatform: IWR6843ISK
rangeFFTSize: 512
radarPlatform: AWR1843Boosting
rangeFFTSize: 128
dcOffsetCompEnable: 1
rangeWindowEnable: 1
FFTOutScaleOn: 0
scaleFactorRange: 0.0078125
rangeResolution: 0.039275899192114445
maxRange: 10.054630193181298
scaleFactorRange: 0.03125
rangeResolution: 0.12499218702877946
maxRange: 7.999499969841885
dopplerFFTObj:
dopplerFFTSize: 128
dopplerWindowEnable: 0
FFTOutScaleOn: 0
scaleFactorDoppler: 0.03125
velocityResolution: 0.022884368906116316
maximumVelocity: 2.91775703552983
velocityResolution: 0.03867281888183667
maximumVelocity: 7.425181225312642
detectObj:
detectMethod: 1
numAntenna: 12
refWinSize:
- 5
- 3
- 8
- 4
guardWinSize:
- 3
- 2
- 8
- 0
K0:
- 5
- 4
- 3
maxEnable: 0
rangeBinSize: 0.039275899192114445
velocityBinSize: 0.015196651226717867
rangeFFTSize: 512
rangeBinSize: 0.12499218702877946
velocityBinSize: 0.05800922832275501
rangeFFTSize: 128
dopplerFFTSize: 128
powerThre: 0
discardCellLeft: 0
Expand Down Expand Up @@ -73,8 +73,8 @@ DOAObj:
- 0
- - 7
- 0
DOAFFTSize: 180
antenna_DesignFreq: 60000000004.4704
DOAFFTSize: 128
antenna_DesignFreq: 77000000000.0
antPos:
- 0
- 1
Expand All @@ -89,7 +89,7 @@ DOAObj:
- 10
- 11
antenna_azimuthonly: 0
antDis: 0.5174049166030632
antDis: 0.5117
method: 1
angles_DOA_azi:
- -80
Expand Down
103 changes: 103 additions & 0 deletions data/radar_config/1843_coherentEle/radar_params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
readObj:
iqSwap: 0
numLane: 2
chInterleave: 1
dataSizeOneFrame: 196608
numAdcSamplePerChirp: 128
numChirpsPerFrame: 24
numTxForMIMO: 3
numRxForMIMO: 4
rangeFFTObj:
radarPlatform: AWR1843Boosting
rangeFFTSize: 128
dcOffsetCompEnable: 1
rangeWindowEnable: 1
FFTOutScaleOn: 0
scaleFactorRange: 0.03125
rangeResolution: 0.09375
maxRange: 6.0
dopplerFFTObj:
dopplerFFTSize: 128
dopplerWindowEnable: 0
FFTOutScaleOn: 0
scaleFactorDoppler: 0.03125
velocityResolution: 1.165316453336068
maximumVelocity: 13.983797440032816
detectObj:
detectMethod: 1
numAntenna: 12
refWinSize:
- 8
- 4
guardWinSize:
- 8
- 0
K0:
- 5
- 3
maxEnable: 0
rangeBinSize: 0.09375
velocityBinSize: 0.10924841750025638
rangeFFTSize: 128
dopplerFFTSize: 128
powerThre: 0
discardCellLeft: 0
discardCellRight: 0
numRxAnt: 4
TDM_MIMO_numTX: 3
minDisApplyVmaxExtend: 10
applyVmaxExtend: 0
DOAObj:
D:
- - 0
- 0
- - 1
- 0
- - 2
- 0
- - 3
- 0
- - 2
- 1
- - 3
- 1
- - 4
- 1
- - 5
- 1
- - 4
- 0
- - 5
- 0
- - 6
- 0
- - 7
- 0
DOAFFTSize: 128
antenna_DesignFreq: 79000000000.0
antPos:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
antenna_azimuthonly: 0
antDis: 0.5117
method: 1
angles_DOA_azi:
- -80
- 80
angles_DOA_ele:
- -20
- 20
gamma: 1.0471285480508996
sidelobeLevel_dB:
- 1
- 0
5 changes: 4 additions & 1 deletion dislab_mmwavePCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
from utility.tool_box import parse_arguments
from pipeline.adc_to_pcd import adc_to_pcd
from pipeline.dreamPCD_pipeline import dream_pcd_pipeline


if __name__ == "__main__":
Expand All @@ -31,7 +32,9 @@
# ====================================================================================
# Add your own code here to process the PCD data
# ====================================================================================
pass
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
dream_pcd_pipeline(args.yaml_path, device, save=args.save, display=args.display)

else:

print("Invalid pipeline option. Please choose 1 for the traditional pipeline.")
Expand Down
77 changes: 77 additions & 0 deletions pipeline/dreamPCD_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""
Author : Shelta Zhao(赵小棠)
Email : xiaotang_zhao@outlook.com
Copyright (C) : NJU DisLab, 2025.
Description : DREAM-PCD pipeline to generate Point Cloud Data (PCD) from raw radar data.
"""

import os
import sys
import yaml
import numpy as np
from tqdm import tqdm

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
from handler.param_process import get_radar_params
from handler.adc_load import get_regular_data
from module.fft_process import FFTProcessor
from module.cfar_process import CFARProcessor
from module.doa_process import DOAProcessor
from utility.visualizer_box import PCD_display


def dream_pcd_pipeline(adc_list, device, save=False, display=False):
"""
Generate Point Cloud Data (PCD) from raw radar data.
Parameters:
adc_list (str): The list of ADC data to be processed.
device (str): The device to perform the computation on ('cpu' or 'cuda').
save (bool): Whether to save the results to a file.
display (bool): Whether to display the results.
Returns:
point_cloud_data (np.ndarray): The generated Point Cloud Data (PCD) from the raw radar data.
"""

# Parse data config & Get radar params
with open(f"{adc_list}.yaml", "r") as file:
adc_list = yaml.safe_load(file)

# Process each data in the list
for adc_data in adc_list:

# Print the current data info
print(f"Processing data: {adc_data['prefix']} | {adc_data['config']} | {adc_data['radar']}")

# Generate regular data & radar params
data_path = os.path.join("data/adc_data", f"{adc_data['prefix']}/{adc_data['index']}")
config_path = os.path.join("data/radar_config", adc_data["config"])

radar_params = get_radar_params(config_path, adc_data['radar'])
regular_data, _ = get_regular_data(data_path, radar_params['readObj'], 'all', timestamp=True)

# Update the radar parameters
radar_params['detectObj']['refWinSize'] = [8,4]
radar_params['detectObj']['guardWinSize'] = [8,0]
radar_params['detectObj']['K0'] = [5,3]
radar_params['detectObj']['discardCellLeft'] = 10
radar_params['detectObj']['discardCellRight'] = 20

# Generate all module instances
fft_processor = FFTProcessor(radar_params['rangeFFTObj'], radar_params['dopplerFFTObj'], device)
cfar_processor = CFARProcessor(radar_params['detectObj'], device)
doa_processor = DOAProcessor(radar_params['DOAObj'], device)

# Perform Range & Doppler FFT
fft_output = fft_processor.run(regular_data)
print(fft_output.shape)
# Perform CFAR Detection
cfar_output = cfar_processor.run(fft_output)
print(cfar_output.shape)
# Perform DOA Estimation
doa_output = doa_processor.run(cfar_output)
print(doa_output.shape)
# Display the results
if display:
PCD_display(doa_output, radar_params['DOAObj']['angles_DOA_azi'], radar_params['DOAObj']['angles_DOA_ele'])

0 comments on commit 9d6767f

Please sign in to comment.