orbbec / OrbbecSDK-dev

Orbbec SDK Open Source Repo
https://www.orbbec.com
Other
5 stars 2 forks source link

Reading sync port connections #10

Open Suedocode opened 1 day ago

Suedocode commented 1 day ago

In the k4a library, you are able to query the status of the sync port connections, and analytically assign the sync mode settings. [is_sync_in_connected(), is_sync_out_connected()]

  if (mDev.is_sync_in_connected()) {
    mConfig.wired_sync_mode = K4A_WIRED_SYNC_MODE_SUBORDINATE;
  } else if (mDev.is_sync_out_connected()) {
    mConfig.wired_sync_mode = K4A_WIRED_SYNC_MODE_MASTER;
  } else {
    mConfig.wired_sync_mode = K4A_WIRED_SYNC_MODE_STANDALONE;
  }

Orbbec uses ethernet to distribute the sync signals though. There doesn't seem to be a way to query the sync connections. Given that, the sync connections have to be known outside of the software in order to decide which sync configurations should be used. If the sync configurations are distributed but no sync signal exists or the wrong primary is assigned, the cameras won't stream because they will never receive the trigger signal.

Could we get an API to at least query the existence of a sync cable?

Is there a suggested way to know which Femto is hooked up to the SYNC_OUT of the hub? Our current proposal is to finish the installation of a unit and stream from the sensors. If the configuration is correct, all will stream. If not, one camera will show the white led, while the others flash orange. Adjust the sync cables to assign that one the "Primary In", and restart the unit.

//first enumerated device gets PRIMARY, assumes device enumeration indexes are consistent
static OBMultiDeviceSyncMode get_sync_mode() {
  static OBMultiDeviceSyncMode mode = OB_MULTI_DEVICE_SYNC_MODE_PRIMARY;

  auto out = mode;
  mode = OB_MULTI_DEVICE_SYNC_MODE_SECONDARY_SYNCED;
  return out;
}

In the mean time, I will test using OB_MULTI_DEVICE_SYNC_MODE_SECONDARY_SYNCED to allow subordinate designated cameras to continue streaming when there is no sync cable connected. I'd prefer to use the more rigorous OB_MULTI_DEVICE_SYNC_MODE_SECONDARY in applicable situations, but it's difficult without being able to query the sync connection state.

EDIT: OB_MULTI_DEVICE_SYNC_MODE_SECONDARY_SYNCED refuses to stream as well. The incorrect camera was assigned the primary, but I thought that a failure to receive a trigger signal would continue streaming anyway (though obviously not with multi device synced frames). Is this feature available to Femto?

Environment: Ubuntu 22.04.5 LTS (x86_64) g++ 11.4.0 OrbbecSDK-dev https://github.com/orbbec/OrbbecSDK-dev/commit/bd2d4dd41d6214c9d8bfe3365efa865d5fe8df9f Femto: Firmware v1.2.9

hzcyf commented 20 hours ago

Thank you for your valuable feedback and suggestions.

  1. The Femto Mega currently does not support the OB_MULTI_DEVICE_SYNC_MODE_SECONDARY_SYNCED mode.
  2. We will discuss the additional issues and suggestions you’ve raised within our team. We’ll keep you updated with any developments.