Hello,
I have tried to add a simple node.js code inside <var processRangeDopplerHeatMap = function (bytevec, byteVecIdx, Params)> of the mmWave.js file within <mmWave_Demo_Visualizer> in order to write to a simple string to a file (presumably in the same directory), but no file is created. I have tried it manually and using GUI composer. My final goal is to try to get rangeDoppler matrix without having to write a TLV parser.
Is there a reason why it wouldn't work?
Here is the sample of the modified code
var processRangeDopplerHeatMap = function (bytevec, byteVecIdx, Params) { var elapsed_time = {}; // for profile this code only var subFrameNum = Params.currentSubFrameNumber; if (subFrameNum != Params.subFrameToPlot) return; if (Params.guiMonitor[subFrameNum].rangeDopplerHeatMap == 1) { var start_time = new Date().getTime(); // %Get the whole log magnitude range dopppler matrix var numBytes = Params.dataPath[subFrameNum].numDopplerBins * Params.dataPath[subFrameNum].numRangeBins * 2; var rangeDoppler = bytevec.slice(byteVecIdx, byteVecIdx + numBytes); // rangeDoppler = rangeDoppler(1:2:end) + rangeDoppler(2:2:end)*256; rangeDoppler = math.add( math.subset(rangeDoppler, math.index(math.range(0, numBytes, 2))), math.multiply(math.subset(rangeDoppler, math.index(math.range(1, numBytes, 2))), 256) ); rangeDoppler = MyUtil.reshape(rangeDoppler, Params.dataPath[subFrameNum].numDopplerBins, Params.dataPath[subFrameNum].numRangeBins); // rangeDoppler = fftshift(rangeDoppler,1); //////////////////////////////////////////////////////////////////////////////////////////////////// var fs = require("fs"); var data = "New File Contents"; fs.writeFile("temp.txt", data, function(err, data) { if (err) console.log(err); console.log("Successfully Written to File."); }); //////////////////////////////////////////////////////////////////////////////////////////////////// rangeDoppler = rangeDoppler.slice((rangeDoppler.length + 1) / 2).concat(rangeDoppler.slice(0, (rangeDoppler.length + 1) / 2)); var range = math.dotMultiply(math.range(0, Params.dataPath[subFrameNum].numRangeBins - 1, true), Params.dataPath[subFrameNum].rangeIdxToMeters); range = math.subtract(range, Params.compRxChanCfg.rangeBias); //correct regardless of state (measurement or compensation) math.forEach(range, function (value, idx, ary) { ary[idx] = math.max(ary[idx], 0); }); var dopplermps = math.dotMultiply(math.range(-Params.dataPath[subFrameNum].numDopplerBins / 2, Params.dataPath[subFrameNum].numDopplerBins / 2 - 1, true), Params.dataPath[subFrameNum].dopplerResolutionMps); templateObj.$.ti_widget_plot3.data[0].x = range.valueOf(); templateObj.$.ti_widget_plot3.data[0].y = dopplermps.valueOf(); templateObj.$.ti_widget_plot3.data[0].z = rangeDoppler; templateObj.$.ti_widget_plot3.redrawdata(); elapsed_time.rangeDopplerHeatMap = new Date().getTime() - start_time; } return elapsed_time; };