Min delay/doppler detections and js cleanup

This commit is contained in:
30hours 2023-11-25 22:46:10 +00:00
parent bba352ba78
commit 6eddada856
4 changed files with 40 additions and 17 deletions

View file

@ -94,7 +94,18 @@
</body> </body>
<script src="plot.js"></script> <script>
var host = window.location.hostname;
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
var urlMap = ''
if (isLocalHost) {
urlMap = '//' + host + ':3000/map?timestamp=' + Date.now();
} else {
urlMap = '//' + host + '/api/map?timestamp=' + Date.now();
}
</script>
<script src="js/plot_map.js"></script>
<script src="control.js"></script> <script src="control.js"></script>
</html> </html>

View file

@ -2,24 +2,9 @@ var timestamp = -1;
var nRows = 3; var nRows = 3;
var nCols = 3; var nCols = 3;
var host = window.location.hostname; var host = window.location.hostname;
var timestamp = '';
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112"); var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
var urlMap = ''
if (isLocalHost) {
urlMap = '//' + host + ':3000/map?timestamp=' + Date.now();
} else {
urlMap = '//' + host + '/api/map?timestamp=' + Date.now();
}
var urlTimestamp = '';
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/timestamp?timestamp=' + Date.now();
} else {
urlTimestamp = '//' + host + '/api/timestamp?timestamp=' + Date.now();
}
var data = [ var data = [
{ {
z: [[0, 0, 0], [0, 0, 0], [0, 0, 0]], z: [[0, 0, 0], [0, 0, 0], [0, 0, 0]],
@ -28,6 +13,13 @@ var data = [
} }
]; ];
var urlTimestamp = '';
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/timestamp?timestamp=' + Date.now();
} else {
urlTimestamp = '//' + host + '/api/timestamp?timestamp=' + Date.now();
}
var layout = { var layout = {
autosize: false, autosize: false,
margin: { margin: {

View file

@ -94,6 +94,16 @@
</body> </body>
<script src="plot_maxhold.js"></script> <script>
var host = window.location.hostname;
var isLocalHost = (host === "localhost" || host === "127.0.0.1" || host === "192.168.0.112");
var urlMap = ''
if (isLocalHost) {
urlMap = '//' + host + ':3000/maxhold?timestamp=' + Date.now();
} else {
urlMap = '//' + host + '/api/maxhold?timestamp=' + Date.now();
}
</script>
<script src="../js/plot_map.js"></script>
</html> </html>

View file

@ -35,6 +35,11 @@ Detection *CfarDetector1D::process(Map<std::complex<double>> *x)
// loop over every cell // loop over every cell
for (int i = 0; i < nDopplerBins; i++) for (int i = 0; i < nDopplerBins; i++)
{ {
// skip if less than min Doppler
if (std::abs(x->doppler[i]) < minDoppler)
{
continue;
}
mapRow = x->get_row(i); mapRow = x->get_row(i);
for (int j = 0; j < nDelayBins; j++) for (int j = 0; j < nDelayBins; j++)
{ {
@ -43,6 +48,11 @@ Detection *CfarDetector1D::process(Map<std::complex<double>> *x)
} }
for (int j = 0; j < nDelayBins; j++) for (int j = 0; j < nDelayBins; j++)
{ {
// skip if less than min delay
if (x->delay[j] < minDelay)
{
continue;
}
// get train cell indices // get train cell indices
std::vector<int> iTrain; std::vector<int> iTrain;
for (int k = j-nGuard-nTrain; k < j-nGuard; k++) for (int k = j-nGuard-nTrain; k < j-nGuard; k++)