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.
162 lines
6.4 KiB
162 lines
6.4 KiB
import numpy as np
|
|
# from numba.experimental import jitclass
|
|
from mat4py import loadmat
|
|
import pdb
|
|
|
|
class radar():
|
|
|
|
"""
|
|
class to define the radar object with it's settings and to extract time intervals for updating the scene.
|
|
Also contains voxel filter specs
|
|
"""
|
|
def __init__(self, radartype):
|
|
self.radartype = radartype
|
|
# Defaults for single-TX operation; overridden by specific radar profiles.
|
|
self.nTx = 1
|
|
self.total_tx = 1
|
|
self.elevation_tx_index = None
|
|
self.active_tx_indices = [0]
|
|
self.bpm_mode = 0
|
|
self.bpm_decode = 0
|
|
self.tx_positions_m = np.array([0.0])
|
|
|
|
if radartype == "ti_cascade":
|
|
self.center = np.array([0.0, 4.0]) # center of radar
|
|
self.elv = np.array([0.5]) # self position in z-axis
|
|
self.orientation = 90 # orientation of radar
|
|
|
|
self.f = 77e9
|
|
self.B = 0.256e9 # Bandwidth
|
|
self.c = 3e8
|
|
self.N_sample = 256
|
|
self.samp_rate = 15e6
|
|
self.doppler_mode = 1
|
|
self.chirps = 3 # 128
|
|
self.nRx = 86 #16 # number of antennas(virtual antennas included, AOA dim)
|
|
self.noise_amp = 0.005 #0.0001(concrete+metal) # 0.00001(metal) #0.005(after skyward data)
|
|
self.gain = 10 ** (105 / 10) #190(concrete+metal) # 210(metal)
|
|
self.angle_fft_size = 256
|
|
|
|
self.range_res = self.c / (2 * self.B) # range resolution
|
|
self.max_range = self.range_res * self.N_sample
|
|
|
|
self.idle = 0 ## Idle time
|
|
self.chirpT = self.N_sample / self.samp_rate ## Time of chirp
|
|
self.chirp_rep = 12*27e-6
|
|
|
|
Ts = 1 / self.samp_rate
|
|
self.t = np.arange(0, self.chirpT, Ts)
|
|
self.tau_resolution = 1 / self.B
|
|
self.k = self.B / self.chirpT
|
|
|
|
self.voxel_theta = 2.0 # 0.5 # 0.1
|
|
self.voxel_phi = 2.0 # 0.5 # 0.1
|
|
self.voxel_rho = 0.05 # 0.1 # 0.05
|
|
|
|
elif radartype == "ti_mrr_bpm_2tx4rx":
|
|
# TI MRR-like profile with 2TX BPM MIMO over 4 RX.
|
|
# Uses azimuth TXs (TX1, TX3). Elevated TX (TX2) is excluded.
|
|
self.center = np.array([0.0, 4.0])
|
|
self.elv = np.array([0.5])
|
|
self.orientation = 90
|
|
|
|
self.f = 76.01e9
|
|
self.B = 4.0e6 * 60e-6 # slope(4MHz/us) * ramp(60us) ~= 240MHz
|
|
self.c = 3e8
|
|
self.N_sample = 256
|
|
self.samp_rate = 4.652e6
|
|
self.doppler_mode = 1
|
|
# 256 physical chirps -> 128 BPM-decoded Doppler bins.
|
|
self.chirps = 256
|
|
self.nRx = 4
|
|
self.nTx = 2
|
|
self.total_tx = 3
|
|
self.elevation_tx_index = 1
|
|
self.active_tx_indices = [0, 2] # TX1 and TX3
|
|
self.bpm_mode = 1
|
|
self.bpm_decode = 0
|
|
self.noise_amp = 0.005
|
|
self.gain = 10 ** (105 / 10)
|
|
self.angle_fft_size = 32
|
|
|
|
self.range_res = self.c / (2 * self.B)
|
|
self.max_range = self.range_res * self.N_sample
|
|
|
|
# TI values are in 10 ns LSB: idle=500, ramp_end=6000 -> 5us and 60us.
|
|
self.idle = 500 * 10e-9
|
|
self.chirpT = 6000 * 10e-9
|
|
# PRI for chirp type 0 with BPM (multiply by number of TXs).
|
|
self.chirp_rep = self.nTx * (self.idle + self.chirpT)
|
|
|
|
Ts = 1 / self.samp_rate
|
|
self.t = np.arange(0, self.chirpT, Ts)
|
|
self.tau_resolution = 1 / self.B
|
|
self.k = self.B / self.chirpT
|
|
|
|
_lambda = self.c / self.f
|
|
# TX1/TX3 spacing in azimuth is approximated as lambda in this simulator.
|
|
self.tx_positions_m = np.array([0.0, _lambda])
|
|
|
|
self.voxel_theta = 2.0
|
|
self.voxel_phi = 2.0
|
|
self.voxel_rho = 0.05
|
|
|
|
elif radartype == "radarbook":
|
|
self.center = np.array([0.0, 4.0]) # center of radar
|
|
self.elv = np.array([0.5]) # self position in z-axis
|
|
self.orientation = 90 # orientation of radar
|
|
|
|
self.f = 24e9
|
|
self.B = 0.250e9 # Bandwidth
|
|
self.c = 3e8
|
|
self.N_sample = 256
|
|
self.samp_rate = 1e6
|
|
self.doppler_mode = 1
|
|
self.chirps = 128
|
|
self.nRx = 8 # number of antennas(virtual antennas included, AOA dim)
|
|
self.noise_amp = 0.005 #0.0001(concrete+metal) # 0.00001(metal) #0.005(after skyward data)
|
|
self.gain = 10 ** (105 / 10) #190(concrete+metal) # 210(metal)
|
|
self.angle_fft_size = 256
|
|
|
|
self.range_res = self.c / (2 * self.B) # range resolution
|
|
self.max_range = self.range_res * self.N_sample
|
|
|
|
|
|
self.chirpT = self.N_sample / self.samp_rate ## Time of chirp
|
|
self.chirp_rep = 0.75e-3
|
|
self.idle = self.chirp_rep - self.chirpT## Idle time
|
|
|
|
Ts = 1 / self.samp_rate
|
|
self.t = np.arange(0, self.chirpT, Ts)
|
|
self.tau_resolution = 1 / self.B
|
|
self.k = self.B / self.chirpT
|
|
|
|
self.voxel_theta = 2 # 0.5 # 0.1
|
|
self.voxel_phi = 2 # 0.5 # 0.1
|
|
self.voxel_rho = 0.05 # 0.1 # 0.05
|
|
|
|
else:
|
|
raise Exception("Incorrect radartype selected")
|
|
|
|
def get_noise(self):
|
|
if self.radartype == "ti_cascade":
|
|
# noise_prop = loadmat('/radar-imaging-dataset/mmfn_project/mmfn_scripts/team_code/e2e_agent_sem_lidar2shenron_package/noise_data/noise_adc.mat')
|
|
# real_fft_ns = np.random.normal(noise_prop['noise_mean_real'], noise_prop['noise_std_real']).T
|
|
# complex_fft_ns = np.random.normal(noise_prop['noise_mean_real'], noise_prop['noise_std_real']).T
|
|
# final_noise = real_fft_ns + 1j * complex_fft_ns
|
|
# # signal_Noisy = np.fft.ifft(final_noise, radar.N_sample, 1) #* 10**4.5
|
|
# # signal_Noisy = final_noise
|
|
# signal_Noisy = 0*final_noise
|
|
|
|
# for low resolution 16 channels
|
|
signal_Noisy = np.random.normal(0,1,size=(self.nRx,self.N_sample))
|
|
signal_Noisy = 0*(signal_Noisy + 1j*signal_Noisy)
|
|
|
|
elif self.radartype == "radarbook":
|
|
signal_Noisy = np.random.normal(0,1,size=(self.nRx,self.N_sample))
|
|
signal_Noisy = 0*(signal_Noisy + 1j*signal_Noisy)
|
|
|
|
else:
|
|
raise Exception("Incorrect radartype selected")
|
|
|
|
return signal_Noisy
|