-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataProcessing_STOP_RUNNING.js
More file actions
41 lines (30 loc) · 1.21 KB
/
DataProcessing_STOP_RUNNING.js
File metadata and controls
41 lines (30 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* getFootAngleAvg(sum_of_angle, counter)
* Get average of foot angles
* @param sum_of_angle, counter
* @return integer
*/
function getFootAngleAvg(msg, metadata, msgType){
var avg_foot_angle =0;
avg_foot_angle = parseFloat(metadata.sum_of_angle) / parseInt(metadata.counter);
// if the data is from the left foot, change the sign
if(metadata.deviceName == "NewBalance_Left"){
avg_foot_angle = avg_foot_angle*-1;
}
msg.avg_foot_angle = parseFloat(avg_foot_angle.toFixed(2));
return {msg: msg, metadata: metadata, msgType: msgType};
}
/* setMsgForAttributes(total_fsr_1st,total_fsr_2nd,total_fsr_3rd,total_fsr_4th,avg_foot_angle )
* set message to save for shared attribute
* @param total_fsr_1st,total_fsr_2nd,total_fsr_3rd,total_fsr_4th,avg_foot_angle
* @return void
*/
function setMsgForAttributes(msg, metadata, msgType){
var newMsg ={};
var newMsgType = "POST_ATTRIBUTES_REQUEST";
newMsg.total_fsr_1st = metadata.total_fsr_1st;
newMsg.total_fsr_2nd = metadata.total_fsr_2nd;
newMsg.total_fsr_3rd = metadata.total_fsr_3rd;
newMsg.total_fsr_4th = metadata.total_fsr_4th;
newMsg.avg_foot_angle = msg.avg_foot_angle;
return {msg: newMsg, metadata: metadata, msgType: newMsgType};
}