Petr Jankuj
Petr Jankuj

Reputation: 37

Why the accelerometer logs contains two x,y,z values for one timestamp?

I am going through logs done by a sample movesense app and the accelerometer logs contain values like this:

{
    "Body": {
        "Timestamp": 110033,
        "ArrayAcc": [{
            "x": 0.60114991664886475,
            "y": 6.7324004173278809,
            "z": 3.0943653583526611
        }, {
            "x": 0.78317141532897949,
            "y": 7.0437526702880859,
            "z": 3.3697926998138428
        }]
    },
    "Uri": "ECKIAEBA141A/Meas/Acc/26",
    "Method": "PUT"
}

Why the array contains two values from one timestamp?

Upvotes: 1

Views: 501

Answers (3)

PetriL
PetriL

Reputation: 1309

Good answers above. To (hopefully) clarify the situation: the reason for multiple measurements in one package with only one timestamp is the saving of the computing resources on many levels:

  • Inside sensor the RAM is precious and this avoids 0-7 * 4 bytes per each copy of the result.
  • When storing the data using DataLogger, the extra 28 bytes per measurement would cost ~20% of the data storage
  • The BLE bandwith is also limited resource and the same data needs to be transferred over BLE when subscribing from the mobile side. Here as well each byte counts
  • We thought of the alternative of returning only one measurement per notification but it would have caused too many notifications per second in cases where the samplerate is big (>400Hz) which could have lead to badly performing system. Also the above memory savings would have been lost.

Judging all this the downside of having to interpolate ts for the remaining measurements was deemed far less costly.

Full Disclosure: I work for the Movesense team

Upvotes: 2

Esperanz0
Esperanz0

Reputation: 1586

This is because of precision Hz to timestamp in ms.

13Hz should contain 1 value.

26Hz - 2 values.

52Hz - 4 values.

104Hz and + - 8 values.

UPDATE: @Dotevo please check again because I see correct values in my post.

52Hz Example:

  Mds SDSInternalCallback()  taskId:20 sdsCallType:2 header:
SdsHeader{status=0, uri='MDS/EventListener/20', reason='CUSTOM_STATUS', contentLength=415, contentType='null', location='', taskId=0}
 dataBody:{"Body": {"Timestamp": 916161, "ArrayAcc": 
    [{"x": -0.1892065554857254, "y": -0.29937744140625, "z": 10.03513240814209}, 
    {"x": -0.25387206673622131, "y": -0.3544628918170929, "z": 10.071057319641113}, 
    {"x": -0.19878663122653961, "y": -0.32572266459465027, "z": 10.049502372741699}, 
    {"x": -0.16286133229732513, "y": -0.31135255098342896, "z": 10.075847625732422}]},
 "Uri": "ECKI89CB9A98/Meas/Acc/52", "Method": "PUT"}

104Hz:

Mds SDSInternalCallback()  taskId:20 sdsCallType:2 header:
 SdsHeader{status=0, uri='MDS/EventListener/20', reason='CUSTOM_STATUS', contentLength=742, contentType='null', location='', taskId=0} dataBody:{"Body": {"Timestamp": 725, "ArrayAcc":
 [{"x": -0.21076172590255737, "y": -0.26345217227935791, "z": 10.063872337341309}, 
 {"x": -0.23950196802616119, "y": -0.30656251311302185, "z": 9.9680719375610352}, 
{"x": -0.22992187738418579, "y": -0.33530274033546448, "z": 10.061477661132812},
 {"x": -0.19399659335613251, "y": -0.26345217227935791, "z": 10.025551795959473},
 {"x": -0.15328125655651093, "y": -0.28021728992462158, "z": 10.054292678833008}, 
 {"x": -0.19399659335613251, "y": -0.28021728992462158, "z": 10.008787155151367},
 {"x": -0.19878663122653961, "y": -0.32572266459465027, "z": 10.013577461242676},
 {"x": -0.19160157442092896, "y": -0.30656251311302185, "z": 10.02076244354248}]}, 
 "Uri": "ECKI89CB9A98/Meas/Acc/104", "Method": "PUT"}

Upvotes: 1

Dotevo
Dotevo

Reputation: 510

@Esperanz0 wrote almost the truth. It is a little more complicated and packages are joined into bucket because of BLE throughput. What is important that number of probes can be different. For example if some ResourceClient is requesting data with "204Hz" then another:

104Hz has 4 values

52Hz has 2 values

26Hz has one value

13Hz has one value

e.t.c.

So you should be prepared for a different size of bucket anyway.

Upvotes: 0

Related Questions