VideoIMUCapture-Android icon indicating copy to clipboard operation
VideoIMUCapture-Android copied to clipboard

Linear interpolation not working

Open johnnyhoichuen opened this issue 2 years ago • 5 comments

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

image

johnnyhoichuen avatar Jan 31 '23 12:01 johnnyhoichuen

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

  1. Your device's accelerometer reuse values, maybe it does not support 100Hz and simple send the latest sampled in the buffer?
  2. Something is not right the mAccelData buffer.

DavidGillsjo avatar Feb 01 '23 09:02 DavidGillsjo

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.

johnnyhoichuen avatar Feb 01 '23 13:02 johnnyhoichuen

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 avatar May 09 '23 14:05 DavidGillsjo

@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);

Shengnan-Zhu avatar May 25 '23 12:05 Shengnan-Zhu

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.

DavidGillsjo avatar May 29 '23 08:05 DavidGillsjo