It would be really useful if you could give more detail here, maybe some sample code (I've looked everywhere on your github for this, but all examples seem to show sensors working in isolation)? I'm sure this is a very common problem for users. I'm easily able to separately stream and/or log data from the gyroscope and accelerometer, but what is the best way to make sure I am capturing them together for time-series analysis?
Some ideas I'm mulling over:
- timestamp the readings and then compare the times from the two sensors (seems very clunky)
- take the logs in the order they appear (presumably this won't work well if the sensors have different sampling frequencies - could be wrong...)
- graphing/outputting the stream to a graph or text element, then using that to rebuild a dataframe object (kind of like what you do with your example app)
The accelerometer and gyro send data at a fixed rate. If you set the ODR to 25Hz, then the sensor will produce data approximately every 40ms. Knowing this, you can store the data you received in order, and use the sensor's ODR and the data's list index to compute approximately when said data was received relative to T0.
You can see on lines 299 and 300 I'm committing routes for the accelerometer and gyroscope separately.
Just want to check that there's no way to route data from two sensors on the same route? Trying to see if I can begin streaming/logging at the same time.
Simultaneously streaming and logging data is not a recommended use case. If you have a stable BTLE connection, you do not need logging. On the flip side, if you are only intermittently connected, then streaming is not appropriate in that scenario.
Comments