Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. Software Development
  3. VOXL SDK
  4. Questions about qrb5165-imu-server and specifically ICM42688 sample rates

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

Scheduled Pinned Locked Moved VOXL SDK
5 Posts 3 Posters 1.9k Views
  • 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 Offline
    P Offline
    peterkrull
    wrote on last edited by
    #1

    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
    0
    • P peterkrull

      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 Offline
      ModeratorM Offline
      Moderator
      ModalAI Team
      wrote on last edited by
      #2

      @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
      0
      • ModeratorM Moderator

        @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 Offline
        P Offline
        peterkrull
        wrote on last edited by
        #3

        @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
        0
        • James StrawsonJ Offline
          James StrawsonJ Offline
          James Strawson
          ModalAI Team
          wrote on last edited by
          #4

          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
          0
          • James StrawsonJ James Strawson

            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 Offline
            P Offline
            peterkrull
            wrote on last edited by
            #5

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

            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
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            ModalAI
            Categories Recent Tags ModalAI.com Docs
            © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups