Skip to content

Comments

[RSDK-13174] Fixing spammy color and depth timestamps differ logs#62

Merged
SebastianMunozP merged 7 commits intoviam-modules:mainfrom
SebastianMunozP:fix-color-depth-timestamp-smappy-log
Feb 6, 2026
Merged

[RSDK-13174] Fixing spammy color and depth timestamps differ logs#62
SebastianMunozP merged 7 commits intoviam-modules:mainfrom
SebastianMunozP:fix-color-depth-timestamp-smappy-log

Conversation

@SebastianMunozP
Copy link
Contributor

@SebastianMunozP SebastianMunozP commented Jan 15, 2026

After some debugging and experimentation, this is the list of improvements as part of this work

  1. Enable OB_MULTI_DEVICE_SYNC_MODE_STANDALONE: If color and depth frames uses the same FPS, this option sync's them, in my testing, this reduced the average time difference from 4.5us to 1.9us, more info here.
  2. Use GlobalTimestamps: If supported (which both our cameras do), this allows us to get the frame timestamps at the source (i.e. the device) but on the host time domain, more info here.
  3. Only considering time differences between color/depth > 2ms as troublesome
  4. Throttle the logs: Log all troublesome difference at the debug level, but only once per minute at the warn level.

With these improvements, we are getting frames more in sync and I'm not seeing any more logs.

@SebastianMunozP SebastianMunozP changed the title Fixing spammy color and depth timsteamps differ logs [RSDK-13174] Fixing spammy color and depth timsteamps differ logs Jan 15, 2026
if (ts > 0) {
return ts;
}
return frame->getSystemTimeStampUs();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to your description, it sounds like we shouldn't use system timestamp bc it's unreliable

why are we still using it as a fallback when somehow getGlobalTimeStampUs is LEQ 0?

also, how can getGlobalTimeStampUs be LEQ 0? have you observed this happening

could it happen when global timestamp is not enabled on the system?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we log a single, not noisy warning that color-depth timestamp comparisons are not supported when global timestamp isn't available? Instead of falling back to the unreliable system timestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, another option would be to support system timestamp and put a threshold of perhaps 400ms between frames. My thinking is that it may be better to have that rough measurement than nothing, but totally open to discuss it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I researched this further, even with GlobalTimestamps we are still seeing differences between the frames. I know this is a known issue at Orbbec, I just sent them an email to ask about it. In the meantime, I'm going to use GlobalTimestamps, throttle this log to once per minute, and log always on debug level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I prefer to keep support for System Timestamps for know, to be future proof for cameras we may support in the future that doesn't support GlobalTimestamps.

Copy link
Collaborator

@hexbabe hexbabe Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we log once per five minutes and keep it at the info level?

would that be considered "spammy" still?..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the latest improvements, on this PR, we should not see any more timestamp differ logs, I'll set this to 5 minutes but raise this to warn instead of info.

@hexbabe
Copy link
Collaborator

hexbabe commented Jan 15, 2026

the Astra2 device does support this feature

what about in the models we unofficially support?

@oliviamiller
Copy link
Collaborator

In my testing, the Astra2 device does support this feature, so the spammy logs are no longer seen.

When you say this do you mean Astra2 doesn't support using the Global timestamp?

@oliviamiller
Copy link
Collaborator

This old thread may be relevant: orbbec/OrbbecSDK_v2#92 We haven't tested their suggested fix yet if you want to try it, but if this works thats fine too

@SebastianMunozP
Copy link
Contributor Author

In my testing, the Astra2 device does support this feature, so the spammy logs are no longer seen.

When you say this do you mean Astra2 doesn't support using the Global timestamp?

I'm sorry I wasn't clear enough, I mean that Astra2 does support using the Global timestamp.

@SebastianMunozP
Copy link
Contributor Author

the Astra2 device does support this feature

what about in the models we unofficially support?

Good call, the only other model we currently support is the Gemini35Le, and we officially support it (documentation here).

I tested with it and it also supports global timestamps, so at this moment both our cameras support it.

@SebastianMunozP SebastianMunozP force-pushed the fix-color-depth-timestamp-smappy-log branch from 327f21c to 39ec6f6 Compare January 16, 2026 20:01
@seanavery
Copy link

seanavery commented Jan 20, 2026

@oliviamiller Is there any documentation on what the OB_MULTI_DEVICE_SYNC_MODE_STANDALONE flag does? The timestamps on color/depth are differing on a single camera module right?

@oliviamiller
Copy link
Collaborator

yes, docs here. "The Color and Depth should be set to same frame rates, the Color and Depth will be synchronized."

@oliviamiller Is there any documentation on what the OB_MULTI_DEVICE_SYNC_MODE_STANDALONE flag does? The timestamps on color/depth are differing on a single camera module right?

@seanavery
Copy link

@oliviamiller Ty for the docs. But still confused on why this was suggested... I believe this is referring to syncing multiple orbec modules with hardware pwm input over VSYNC_IN pins, right? But the problem here is color/depth are not synced on a single orbecc camera.

@oliviamiller
Copy link
Collaborator

@oliviamiller Ty for the docs. But still confused on why this was suggested... I believe this is referring to syncing multiple orbec modules with hardware pwm input over VSYNC_IN pins, right? But the problem here is color/depth are not synced on a single orbecc camera.

yes that is what the ob_multi_device_sync_mode enum does, but the OB_MULTI_DEVICE_SYNC_MODE_STANDALONE option indicates that the device isn't syncing with any other cameras. Im assuming the default is OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN which indicates

The device does not synchronize with other devices 
The Color and Depth can be set to different frame rates.

@SebastianMunozP SebastianMunozP changed the title [RSDK-13174] Fixing spammy color and depth timsteamps differ logs [RSDK-13174] Fixing spammy color and depth timestamps differ logs Feb 3, 2026
@SebastianMunozP
Copy link
Contributor Author

@oliviamiller Ty for the docs. But still confused on why this was suggested... I believe this is referring to syncing multiple orbec modules with hardware pwm input over VSYNC_IN pins, right? But the problem here is color/depth are not synced on a single orbecc camera.

yes that is what the ob_multi_device_sync_mode enum does, but the OB_MULTI_DEVICE_SYNC_MODE_STANDALONE option indicates that the device isn't syncing with any other cameras. Im assuming the default is OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN which indicates

The device does not synchronize with other devices 
The Color and Depth can be set to different frame rates.

Hello, I just tested this OB_MULTI_DEVICE_SYNC_MODE_STANDALONE feature and I'm seeing a big improvement in our color/depth frame syncronization:

With it being set:

  Average:             1938 µs (1.94 ms)
  Std Dev:             522 µs (0.52 ms)
  Min:                 1871 µs (1.87 ms)
  Max:                 9222 µs (9.22 ms)

Without it (using default OB_MULTI_DEVICE_SYNC_MODE_FREE_RUN mode)

  Average:             4551 µs (4.55 ms)
  Std Dev:             4354 µs (4.35 ms)
  Min:                 97 µs (0.10 ms)
  Max:                 17037 µs (17.04 ms)

Copy link
Collaborator

@hexbabe hexbabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great findings with the sync mode!

@SebastianMunozP SebastianMunozP merged commit f105429 into viam-modules:main Feb 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants