Commit afda8d30 by ken

试试看吧

parent 3159ba42
...@@ -3,7 +3,7 @@ const depthByRest = require('./zb'); ...@@ -3,7 +3,7 @@ const depthByRest = require('./zb');
let total = 0; let total = 0;
let total2 = 0; let total2 = 0;
let time = 0; let time = 0;
let lastData = null;
setInterval(()=>{ setInterval(()=>{
run(); run();
...@@ -20,7 +20,14 @@ function run() { ...@@ -20,7 +20,14 @@ function run() {
total += after - before; total += after - before;
time ++; time ++;
total2 += ((after - before) - total / time) * ((after - before) - total / time); total2 += ((after - before) - total / time) * ((after - before) - total / time);
console.log('平均值:' + (total / time) + ' 标准差:' + Math.sqrt(total2 / time)); // console.log('平均值:' + (total / time) + ' 标准差:' + Math.sqrt(total2 / time));
// console.log(data);
if (lastData) {
if (JSON.stringify(lastData) != JSON.stringify(data)) {
console.log("diff@" + data.timestamp)
}
lastData = data;
}
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment