Open johnnyhoichuen opened 1 year ago
Interesting! This code is from the mobile-ar-sensor-logger, so I have not developed it myself. I intend to build and try your pull request on my phone so then I can try this myself as well.
From the code I guess this means that either
I ran the above test before the changes made on #10 (the original code).
I do see that the IMU frequency is 100Hz. I'd love to see the result on your phone just to make sure it was not device specific.
Sorry, I have not yet had time to look at this. I'm currently finishing up my PhD and am a bit short on time. Just wanted to let you know it is not forgotten.
@DavidGillsjo @johnnyhoichuen bug here lead to "left val = right val" when linearinterpolation: https://github.com/DavidGillsjo/VideoIMUCapture-Android/blob/721f62d9585f7b8663a21d10c6d56cd95f30bdcd/android_app/app/src/main/java/se/lth/math/videoimucapture/IMUManager.java#L275
I am not familiar with java,but I guess in java, pass a non-basic type object like an array(timestamp is a basic type, so its ok), means like pass the address of the object. So each time the sensorpacket in accdata or gyrodata will point to the newest value.
You can try copy the value of event.values as below:
float[] val = Arrays.copyOf(event.values, event.values.length);
SensorPacket sp = new SensorPacket(event.timestamp, val);
Thanks @Shengnan-Zhu, great catch! Have you verified that is solves the bug? If you have an implementation you are very welcome to submit a pull request.
If this is the issue, it seems like Marslogger - which I forked this code from - might have this bug as well.
I'll defend my PhD by the end of this week, after that I should be able to find some time for this bug.
I was checking the interpolation codes and I realise the leftAccel and rightAccel is always the same which eventually causing the interpolated acc_data equals to leftAccel and rightAccel.
I wonder if it only happens on my device (Samsung S8, Android 9) only.
Inside syncInertialData() in IMUManager