03-09-2020 01:10
03-09-2020 01:10
Hi everyone,
I got a problem when I collect accelerometer and gyroscope data in real-time. I found that the totoal number of accelerometer data and gyroscope data are not the same.
For example,
"let acc = new Accelerometer({ frequency: 6, batch: 6});"
"let gyro = new Gyroscope({ frequency: 6, batch: 6 });"
I set the frequency is 6, but the accelerometer data will be more than gyroscope data. I dont know why.
Could you help me?
Answered! Go to the Best Answer.
03-11-2020 22:07 - edited 03-11-2020 22:08
03-11-2020 22:07 - edited 03-11-2020 22:08
I've never had data recorded at twice the requested frequency. Is there a chance you've registered for the relevant events twice?
I'd be checking the reading timestamps as well.
I can get the watch to send messages to the companion up to about 20 times a second, so once a second should be fine. File transfer may be slower.
03-09-2020 02:22
03-09-2020 02:22
I found that, sometimes, accelerometer frequency will be 12 and gyroscope frequency is still 6.
03-09-2020 03:31
03-09-2020 03:31
@Aemonzzx You posted your question in a forum designed for users having device problems. You sound like a developer and that your question should be moved to a Developer forum. I can do that, but the question is where? Web API or SDK?
Laurie | Maryland
Sense 2, Luxe, Aria 2 | iOS | Mac OS
Take a look at the Fitbit help site for further assistance and information.
03-09-2020 04:43
03-09-2020 04:43
Thank you very much. It should be SDK question.
03-09-2020 12:11
03-09-2020 12:11
@Aemonzzx Moved to the correct forum. I hope you get the help you need.
Laurie | Maryland
Sense 2, Luxe, Aria 2 | iOS | Mac OS
Take a look at the Fitbit help site for further assistance and information.
03-09-2020 17:43
03-09-2020 17:43
It might be interesting to inspect the timestamps of the individual readings. I've occasionally seen successive readings with identical timestamps (perhaps due to sampling too quickly, which you're not doing).
Accelerometer timestamps seem to be quantised into multiples of 8 msec (on Versa 2), but such fine quantisation shouldn't be significant at your sampling frequency.
03-10-2020 00:20
03-10-2020 00:20
Hi, Gondwana,
does accelerometer data and gyroscope data can be synced? and then I can use WebAPI with my versa to get the data?
Thank you.
03-10-2020 00:28
03-10-2020 00:28
You can't get accelerometer or gyroscope data from the Web API.Those sensors would generate too much data to be synced (except for short periods).
There's a rough outline of how to get those data, as well as some teasers, here.
03-11-2020 20:27
03-11-2020 20:27
Thank you.
By the way, how can I get the data more stable?
I use Versa to send the data to my companion app every second, and then my phone will upload data to database.
I think one of the problem is the Versa reads data too fast. It reads data twice in a time interval and send it to companion app.
03-11-2020 22:07 - edited 03-11-2020 22:08
03-11-2020 22:07 - edited 03-11-2020 22:08
I've never had data recorded at twice the requested frequency. Is there a chance you've registered for the relevant events twice?
I'd be checking the reading timestamps as well.
I can get the watch to send messages to the companion up to about 20 times a second, so once a second should be fine. File transfer may be slower.
03-12-2020 08:04
03-12-2020 08:04
Hi, is it possible to solve this problem???
I set the frequncy as 10 readings per second. I got the data to generated into a csv file and then counted the number of data at each time. However, there are 20 data at these time and some are only 1 data. I checked Fitbit Studio console, at 16:59:33, it only send 10 times. why???
is it hard to get a stable data?
03-12-2020 12:53
03-12-2020 12:53
I've never had any trouble getting fairly 'stable' data. The interval between readings fluctuates slightly (16 ms?), but that can't explain what you're seeing.
Writing to file is a relatively slow operation, although I would have thought that 10 times per second should have been okay. You could try saving 10 readings in memory, and only updating the file once per second. Better, use sensor 'batch' mode unless you really need readings straight away.
I'll confess that I'm not sure exactly what some of your images are about.
I still think you should examine the timestamps of your readings to see if you're getting duplicates (which I've occasionally seen!) and to check the actual frequency.
03-20-2020 02:17 - edited 03-20-2020 02:21
03-20-2020 02:17 - edited 03-20-2020 02:21
Is it possible to read accelerometer and gyroscope data at the same time?
The code is :
However, in the json file, the gyroscope data is always more than accelerometer data.
I think when it writes a json file, there are 20 gyroscope data but accelerometer data only has 10 or less than 10.
03-20-2020 13:01
03-20-2020 13:01
I really think you should treat the gyro.onreading and accel.onreading events as separate. There's no guarantee they'll occur at identical times; it's almost certain that they won't.
03-25-2020 19:01 - edited 03-25-2020 19:35
03-25-2020 19:01 - edited 03-25-2020 19:35
But why sometimes there are more than 6 data per second or less than 6. I set the frequency as 6. I check the timestamps. The time difference is not exactly one second
03-25-2020 19:26
03-25-2020 19:26
It seems to me that sensor data is collected internally at a fixed frequency. When we sample it, we can only obtain samples at multiples of that internal frequency, rather than exactly what we specify. That may be why there's occasionally more or less samples than you expect.
Example the reading timestamps and see if this explains it.
03-25-2020 20:04
03-25-2020 20:04
Is it possible to add some functions, like timesleep or something, to collect data at a specified sample rate?
Can we use other method to collect a group of data at a specified sample rate instead of BatchedAccelerometerReading?
03-26-2020 21:59 - edited 03-26-2020 22:00
03-26-2020 21:59 - edited 03-26-2020 22:00
Do you know how to convert timestamp to date?
03-26-2020 22:17
03-26-2020 22:17
There is no direct conversion. timestamps start from an arbitrary point in time.
03-27-2020 18:41
03-27-2020 18:41
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let temp_lasttime = 0;
let temp_currenttime = 0;
let date = 0;
accel.onactivate=()=> {
date = Date.now();
}
...
for (let index = 0 ;index <accel.readings.timestamp.length ; index++){
if (temp_lasttime == 0){
temp_lasttime = accel.readings.timestamp[index];
}
temp_currenttime = accel.readings.timestamp[index];
date = date + temp_currenttime - temp_lasttime;
temp_lasttime = temp_currenttime;
}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Whether this date is the time when the sensor reads the data??