ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Questions about qrb5165-imu-server and specifically ICM42688 sample rates

    VOXL SDK
    3
    5
    488
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      peterkrull
      last edited by

      I saved a log using voxl-logger --preset_odometry with 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 of 1e9/data_imu['timestamp(ns)'].diff()[1:200] which corresponds to the instantaneous frequency between two samples.

      output.png

      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?

      ModeratorM 1 Reply Last reply Reply Quote 0
      • ModeratorM
        Moderator ModalAI Team @peterkrull
        last edited by

        @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.

        P 1 Reply Last reply Reply Quote 0
        • P
          peterkrull @Moderator
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • James StrawsonJ
            James Strawson ModalAI Team
            last edited by

            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.

            P 1 Reply Last reply Reply Quote 0
            • P
              peterkrull @James Strawson
              last edited by

              @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 😁

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB | Contributors