diff --git a/scripts/ISOLATE/e2e_agent_sem_lidar2shenron_package/ConfigureRadar.py b/scripts/ISOLATE/e2e_agent_sem_lidar2shenron_package/ConfigureRadar.py index d3e7d2c..ef84667 100644 --- a/scripts/ISOLATE/e2e_agent_sem_lidar2shenron_package/ConfigureRadar.py +++ b/scripts/ISOLATE/e2e_agent_sem_lidar2shenron_package/ConfigureRadar.py @@ -25,7 +25,7 @@ class radar(): 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 ** (110 / 10) # Calibrated for Iteration 16 + self.gain = 10 ** (120 / 10) # Recalibrated (+10dB) to compensate for 1/R^4 physics fix (Iteration 37) self.angle_fft_size = 256 self.range_res = self.c / (2 * self.B) # range resolution @@ -70,7 +70,7 @@ class radar(): self.chirps = 128 self.nRx = 8 # number of antennas(virtual antennas included, AOA dim) self.noise_amp = 0.005 - self.gain = 10 ** (110 / 10) # Calibrated for Iteration 16 + self.gain = 10 ** (120 / 10) # Recalibrated (+10dB) to compensate for 1/R^4 physics fix (Iteration 37) self.angle_fft_size = 256 self.range_res = self.c / (2 * self.B) # range resolution @@ -115,7 +115,7 @@ class radar(): self.chirps = 128 # Increased to match 2TX MIMO frame depth for 3dB processing gain self.nRx = 6 self.noise_amp = 0.005 - self.gain = 10 ** (110 / 10) # Calibrated for Iteration 16 + self.gain = 10 ** (120 / 10) # Recalibrated (+10dB) to compensate for 1/R^4 physics fix (Iteration 37) self.angle_fft_size = 256 self.range_res = self.c / (2 * self.B) diff --git a/scripts/ISOLATE/sim_radar_utils/plots.py b/scripts/ISOLATE/sim_radar_utils/plots.py index 3215bba..4a8d7c3 100644 --- a/scripts/ISOLATE/sim_radar_utils/plots.py +++ b/scripts/ISOLATE/sim_radar_utils/plots.py @@ -104,11 +104,16 @@ def postprocess_ra(ra_heatmap, range_axis, smooth_sigma=1.0): ra = np.clip(ra, 1e-9, None) # 2. Physics-based dynamic range compression (Linear -> Log) - SYSTEM_GAIN_OFFSET = 68.0 + # SYSTEM_GAIN_OFFSET: Accounts for the absolute scale of the simulated signal. + # Must be updated when radar.gain changes. Formula: 10*log10(gain) - reference_offset + # Baseline: gain=10^(110/10) -> offset=68.0 + # After +10dB recalibration: gain=10^(120/10) -> offset=78.0 + SYSTEM_GAIN_OFFSET = 78.0 ra_db = 10 * np.log10(ra) - SYSTEM_GAIN_OFFSET - # 3. Fixed dynamic range clipping (-5 to 45 dB) - ra_db = np.clip(ra_db, -5, 45) + # 3. Fixed dynamic range clipping (-5 to 55 dB) + # Upper limit raised from 45 to 55 dB to provide headroom after gain recalibration. + ra_db = np.clip(ra_db, -5, 55) # 4. Optional Gaussian smoothing if smooth_sigma > 0: diff --git a/scripts/test_shenron.py b/scripts/test_shenron.py index 167a0fb..8b282a7 100644 --- a/scripts/test_shenron.py +++ b/scripts/test_shenron.py @@ -309,7 +309,7 @@ def run_testbench(iter_name): render_engines[r_type] = { 'rd': FastHeatmapEngine(extent=[-max_vel_cfg, max_vel_cfg, 0, max_r_cfg], cmap='viridis', title=f'{r_type.upper()} Range-Doppler', xlabel='Doppler Velocity [m/s]', ylabel='Range [m]', ylim=[0, 120], interpolation='bicubic'), 'cfar': FastHeatmapEngine(extent=[-max_vel_cfg, max_vel_cfg, 0, max_r_cfg], cmap='plasma', title=f'{r_type.upper()} CFAR Noise Threshold', xlabel='Doppler Velocity [m/s]', ylabel='Range [m]', ylim=[0, 120], interpolation='bicubic'), - 'ra_static': FastHeatmapEngine(extent=[-display_limit_cfg, display_limit_cfg, 0, display_limit_cfg], cmap='jet', vmin=-5, vmax=45, title=f'{r_type.upper()} Range-Azimuth (Absolute)', xlabel='Lateral distance [m]', ylabel='Longitudinal distance [m]', aspect='equal'), + 'ra_static': FastHeatmapEngine(extent=[-display_limit_cfg, display_limit_cfg, 0, display_limit_cfg], cmap='jet', vmin=-5, vmax=55, title=f'{r_type.upper()} Range-Azimuth (Absolute)', xlabel='Lateral distance [m]', ylabel='Longitudinal distance [m]', aspect='equal'), 'ra_dyn': FastHeatmapEngine(extent=[-display_limit_cfg, display_limit_cfg, 0, display_limit_cfg], cmap='jet', title=f'{r_type.upper()} Range-Azimuth (Dynamic)', xlabel='Lateral distance [m]', ylabel='Longitudinal distance [m]', aspect='equal') } @@ -433,7 +433,7 @@ def run_testbench(iter_name): rd_data = np.load(rd_p) # Apply log conversion minus identical system gain offset to maintain -5 to 45 scaling # Simple 10*log10 - SYSTEM_GAIN_OFFSET - rd_db = 10 * np.log10(np.clip(rd_data, 1e-9, None)) - 68.0 + rd_db = 10 * np.log10(np.clip(rd_data, 1e-9, None)) - 78.0 # Updated offset: +10dB from gain recalibration # Flip UD so Range 0 (ego) is at the bottom. Use Cached Renderer. b64 = render_engines[r_type]['rd'].render(np.flipud(rd_db))