updates
This commit is contained in:
@@ -28,15 +28,29 @@ def db20n(x):
|
||||
def main():
|
||||
print('Hello')
|
||||
|
||||
clk = 187.5e6
|
||||
radar = radar_manager.RadarManager()
|
||||
|
||||
clk = radar_manager.TIMING_ENGINE_FREQ
|
||||
|
||||
freqs = np.array([16, 21, 13, 3.25, 3.5, 5, 2])*1e9
|
||||
pri_lsb = 16e-9
|
||||
print(freqs * pri_lsb)
|
||||
|
||||
# Test AD9081 Reg Access
|
||||
print(hex(radar.ad9081_read_reg(0x0A0A)))
|
||||
radar.ad9081_write_reg(0x0A0A, 0x60)
|
||||
print(hex(radar.ad9081_read_reg(0x0A0A)))
|
||||
|
||||
|
||||
# CPI Parameters (timing values are in clk ticks)
|
||||
num_pulses = 128
|
||||
num_samples = 8192
|
||||
start_sample = 0
|
||||
# Should be multiple of udp packet size, currently 4096 bytes, or 1024 samples
|
||||
num_samples = 5000
|
||||
start_sample = 2000
|
||||
tx_num_samples = 1024
|
||||
tx_start_sample = start_sample
|
||||
pri = int(.001 * clk)
|
||||
pri = int(.0004 * clk)
|
||||
print(pri)
|
||||
inter_cpi = 50
|
||||
tx_lo_offset = 10e6
|
||||
rx_lo_offset = 0
|
||||
@@ -46,7 +60,7 @@ def main():
|
||||
print('PRI', pri_float, 'PRF', 1 / pri_float)
|
||||
print('Expected Data Rate', num_samples * 4 / pri_float / 1e6)
|
||||
|
||||
radar = radar_manager.RadarManager()
|
||||
|
||||
|
||||
recorder0 = DataRecorder("192.168.2.128", 1234, packet_size=radar.packet_size)
|
||||
recorder1 = DataRecorder("192.168.3.128", 1235, packet_size=radar.packet_size)
|
||||
@@ -59,7 +73,7 @@ def main():
|
||||
print('Start Running')
|
||||
radar.start_running()
|
||||
# Let it run for a bit
|
||||
time.sleep(5)
|
||||
time.sleep(2)
|
||||
# Stop running
|
||||
radar.stop_running()
|
||||
# Stop the data recorder
|
||||
@@ -84,12 +98,14 @@ def main():
|
||||
else:
|
||||
offset += 4
|
||||
|
||||
num_cpi = 16
|
||||
num_cpi = 1
|
||||
for i in range(num_cpi):
|
||||
# Get Header
|
||||
data = plot_recorder.buffer[offset:offset + ctypes.sizeof(data_structures.CpiHeader)]
|
||||
offset += ctypes.sizeof(data_structures.CpiHeader)
|
||||
headers.append(data_structures.CpiHeader.from_buffer_copy(data))
|
||||
num_pulses = headers[i].num_pulses
|
||||
num_samples = headers[i].num_samples
|
||||
|
||||
# Get CPI
|
||||
data_size = num_pulses * num_samples * 4
|
||||
@@ -117,15 +133,21 @@ def main():
|
||||
vmin = -60
|
||||
vmax = 0
|
||||
|
||||
fid, axs = plt.subplots(2)
|
||||
axs[0].plot(iq.T.real, '.-')
|
||||
axs[0].plot(iq.T.imag, '--.')
|
||||
fid, axs = plt.subplots(3)
|
||||
axs[0].plot(iq.T.real, '-')
|
||||
axs[0].plot(iq.T.imag, '--')
|
||||
axs[0].grid()
|
||||
|
||||
axs[1].imshow(db20n(iq), aspect='auto', interpolation='nearest', vmin=vmin, vmax=vmax)
|
||||
# axs[1].imshow(db20n(iq), aspect='auto', interpolation='nearest', vmin=vmin, vmax=vmax)
|
||||
axs[1].imshow(iq.real, aspect='auto', interpolation='nearest')
|
||||
axs[1].set_ylabel('Pulse Count')
|
||||
axs[1].set_xlabel('Sample Count')
|
||||
|
||||
iq_freq = np.fft.fftshift(np.fft.fft(iq, axis=1), axes=1)
|
||||
freq_axis = (np.arange(num_samples)/num_samples - 0.5) * radar_manager.BASEBAND_SAMPLE_RATE / 1e6
|
||||
axs[2].plot(freq_axis, db20n(iq_freq.T))
|
||||
axs[2].grid()
|
||||
|
||||
|
||||
plt.show()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user