Questions about qrb5165-imu-server and specifically ICM42688 sample rates
-
I saved a log using
voxl-logger --preset_odometrywith the intent of creating some data sets to try other VIO solutions. I was curious about the sample rate (before I thought about looking in/etc/modalai/voxl-imu-server.conf, where it is configured to 1000 Hz) and decided to calculate it based on the actual data. The image shows a sequence of1e9/data_imu['timestamp(ns)'].diff()[1:200]which corresponds to the instantaneous frequency between two samples.
First I noticed that there is an offset from the 1000 Hz configured, which according to icm42688.c on line 117, the IMU should be able to reach. I find that the mean of this frequency, which is around 1023.89, is suspiciously related to the inverse of the
#define STARTING_CLOCK_RATIO 0.9765625(which is excactly 1/1.024) parameter in the ICM42688 driver. Is this supposed to mean that the IMU runs at a deterministic 1.024x too fast, or am I missing something?The second thing I notice is that the frequency (and in turn the delta-time) varies a lot. I see that the timestamp from the sensor itself it not used, but that they are instead generated manually using the
rc_ts_filter_...functions. I imagine that the sensor itself is a lot more consistent than this, even if the actual frequency might have some bias. So is this timestamp misleading? Too rough of an approximation? -
I saved a log using
voxl-logger --preset_odometrywith the intent of creating some data sets to try other VIO solutions. I was curious about the sample rate (before I thought about looking in/etc/modalai/voxl-imu-server.conf, where it is configured to 1000 Hz) and decided to calculate it based on the actual data. The image shows a sequence of1e9/data_imu['timestamp(ns)'].diff()[1:200]which corresponds to the instantaneous frequency between two samples.
First I noticed that there is an offset from the 1000 Hz configured, which according to icm42688.c on line 117, the IMU should be able to reach. I find that the mean of this frequency, which is around 1023.89, is suspiciously related to the inverse of the
#define STARTING_CLOCK_RATIO 0.9765625(which is excactly 1/1.024) parameter in the ICM42688 driver. Is this supposed to mean that the IMU runs at a deterministic 1.024x too fast, or am I missing something?The second thing I notice is that the frequency (and in turn the delta-time) varies a lot. I see that the timestamp from the sensor itself it not used, but that they are instead generated manually using the
rc_ts_filter_...functions. I imagine that the sensor itself is a lot more consistent than this, even if the actual frequency might have some bias. So is this timestamp misleading? Too rough of an approximation?@peterkrull These IMU have inaccuracies in their clocks. The code you are referring to is trying to calculate and adjust for those inaccuracies to provide a more consistent measurement. Otherwise, there would be gaps. The frequency offset could be different for each power cycle or each IMU, so it is generated online.
-
@peterkrull These IMU have inaccuracies in their clocks. The code you are referring to is trying to calculate and adjust for those inaccuracies to provide a more consistent measurement. Otherwise, there would be gaps. The frequency offset could be different for each power cycle or each IMU, so it is generated online.
@Moderator I would just have expected the frequency graph to be smoother. I guess I could adjust the phase_constant and scale_constant parameters if it even turns out to be an issue. I am still a bit confused by the
STARTING_CLOCK_RATIO 0.9765625== 1/1.024 thing. Do these IMUs come from the factory with a clock that is biased like that, and is it just chance that a good initialization for the clock ratio is 1e3/(2^10)? -
0.9765625 = 32/32.768
The ICM42688 will run at roughly 32khz +- a few percent when running off its own internal oscillator. Optionally, you can drive it from a standard 32.768khz crystal which is what we opted to do on VOXL2 so the sample rate is consistent between boards.
-
0.9765625 = 32/32.768
The ICM42688 will run at roughly 32khz +- a few percent when running off its own internal oscillator. Optionally, you can drive it from a standard 32.768khz crystal which is what we opted to do on VOXL2 so the sample rate is consistent between boards.
@James-Strawson That makes a ton of sense, thanks for the explanation! Also just noticed that it mentions this right above the definition. I should just learn to use my eyes

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login