Other Parts Discussed in Thread: AWR1642,
Hi,
I am currently working on extracting the range doppler heatmap data from the awr1642 sensor through UART and wanted to plot the data to ensure the data that I received and processed made sense. When I plot the data, I get the plot below that doesn't make much sense to me (not the same as in the provided demo GUI from matlab). The plot is generated while I am seated behind a desk next to the radar.
(X-axis: Range Bins, Y:Axis: Doppler bins, Data plotted: range doppler data sent from radar)
After examining the raw data sent from the radar through Realterm, I noticed that the values of the heatmap were very high (> 10000), seen on the plot as well. Is this expected or am I missing a step while parsing the data?
I used the following matlab code from the ods_3d_visualizer.m demo lab (under C:\ti\mmwave_automotive_toolbox_3_1_0\labs\lab0004_obstacle_detection\gui) to generate an equivalent version in python:
len = numDopplerBins * numRangeBins * 2;
rangeDoppler = bytevec(idx+(1:len));
idx = idx + len;
rangeDoppler = rangeDoppler(1:2:end) + rangeDoppler(2:2:end)*256;
rangeDoppler = reshape(rangeDoppler, numDopplerBins, numRangeBins);
rangeDoppler = fftshift(rangeDoppler,1);
Code in Python:
numBytes = int(2*configParameters["numRangeBins"]*configParameters["numDopplerBins"])
# Convert the raw data to int16 array
payload = byteBuffer[idX:idX + numBytes]
idX += numBytes
# rangeDoppler = payload.view(dtype=np.uint16)
rangeDoppler = (payload[0:payload.size:2] + payload[1:payload.size:2] * 256)
# Convert the range doppler array to a matrix
rangeDoppler = np.reshape(rangeDoppler, (int(configParameters["numDopplerBins"]), int(configParameters["numRangeBins"])),'F') #Fortran-like reshape
rangeDoppler = np.append(rangeDoppler[int(len(rangeDoppler)/2):], rangeDoppler[:int(len(rangeDoppler)/2)], axis=0) # equivalent to fftshift operation in MATLAB
# Generate the range and doppler arrays for the plot
rangeArray = np.array(range(configParameters["numRangeBins"]))*configParameters["rangeIdxToMeters"]
dopplerArray = np.multiply(np.arange(-configParameters["numDopplerBins"]/2 , configParameters["numDopplerBins"]/2), configParameters["dopplerResolutionMps"])
plt.clf()
cs = plt.contourf(rangeArray,dopplerArray,rangeDoppler)
fig.colorbar(cs, shrink=0.9)
fig.canvas.draw()
plt.pause(0.1)
Attached are two files containing the configuration sent to the radar and the other file containing sample data from the radar, extracted by RealTerm in Hex format. If you could help me in figuring out why my range doppler data is off, that would be greatly appreciated.
Configuration file:
Sample data:
Thank you,
Stan