Added validation and documentation that a device being configured for master mode must also enable the color camera
This commit is contained in:
Родитель
0b3d1ab548
Коммит
6ee5a47dcb
|
@ -587,7 +587,9 @@ typedef enum
|
|||
{
|
||||
K4A_WIRED_SYNC_MODE_STANDALONE, /**< Neither 'Sync In' or 'Sync Out' connections are used. */
|
||||
K4A_WIRED_SYNC_MODE_MASTER, /**< The 'Sync Out' jack is enabled and synchronization data it driven out the
|
||||
connected wire.*/
|
||||
connected wire. While in master mode the color camera must be enabled as part of the
|
||||
multi device sync signalling logic. Even if the color image is not needed, the color
|
||||
camera must be running.*/
|
||||
K4A_WIRED_SYNC_MODE_SUBORDINATE /**< The 'Sync In' jack is used for synchronization and 'Sync Out' is driven for the
|
||||
next device in the chain. 'Sync Out' is a mirror of 'Sync In' for this mode.
|
||||
*/
|
||||
|
|
|
@ -570,6 +570,13 @@ static k4a_result_t validate_configuration(k4a_context_t *device, const k4a_devi
|
|||
if (K4A_SUCCEEDED(result) && config->wired_sync_mode == K4A_WIRED_SYNC_MODE_MASTER)
|
||||
{
|
||||
result = K4A_RESULT_FROM_BOOL(sync_out_cable_present == true);
|
||||
|
||||
if (K4A_SUCCEEDED(result) && config->color_resolution == K4A_COLOR_RESOLUTION_OFF)
|
||||
{
|
||||
LOG_ERROR("Device wired_sync_mode is set to K4A_WIRED_SYNC_MODE_MASTER, so color camera must be used "
|
||||
"on master device. Color_resolution can not be set to K4A_COLOR_RESOLUTION_OFF.");
|
||||
return K4A_RESULT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,3 +156,72 @@ TEST_F(multidevice_ft, DISABLED_stream_two_2_then_1)
|
|||
k4a_device_close(m_device1);
|
||||
m_device1 = NULL;
|
||||
}
|
||||
|
||||
TEST_F(multidevice_ft, DISABLED_ensure_color_camera_is_enabled)
|
||||
{
|
||||
bool master_device_found = false;
|
||||
bool subordinate_device_found = false;
|
||||
uint32_t devices_present = k4a_device_get_installed_count();
|
||||
ASSERT_LE((uint32_t)2, devices_present);
|
||||
|
||||
for (uint32_t x = 0; x < devices_present; x++)
|
||||
{
|
||||
ASSERT_EQ(K4A_RESULT_SUCCEEDED, k4a_device_open(x, &m_device1));
|
||||
|
||||
bool sync_in_cable_present;
|
||||
bool sync_out_cable_present;
|
||||
|
||||
k4a_device_configuration_t config = K4A_DEVICE_CONFIG_INIT_DISABLE_ALL;
|
||||
|
||||
config.color_format = K4A_IMAGE_FORMAT_COLOR_MJPG;
|
||||
config.color_resolution = K4A_COLOR_RESOLUTION_OFF;
|
||||
config.depth_mode = K4A_DEPTH_MODE_NFOV_2X2BINNED;
|
||||
config.camera_fps = K4A_FRAMES_PER_SECOND_30;
|
||||
|
||||
ASSERT_EQ(K4A_RESULT_SUCCEEDED,
|
||||
k4a_device_get_sync_jack(m_device1, &sync_in_cable_present, &sync_out_cable_present));
|
||||
|
||||
if (sync_out_cable_present)
|
||||
{
|
||||
// Negative test
|
||||
config.wired_sync_mode = K4A_WIRED_SYNC_MODE_MASTER;
|
||||
ASSERT_EQ(K4A_RESULT_FAILED, k4a_device_start_cameras(m_device1, &config));
|
||||
k4a_device_stop_cameras(m_device1);
|
||||
|
||||
// Positive Test
|
||||
config.wired_sync_mode = K4A_WIRED_SYNC_MODE_STANDALONE;
|
||||
ASSERT_EQ(K4A_RESULT_SUCCEEDED, k4a_device_start_cameras(m_device1, &config));
|
||||
k4a_device_stop_cameras(m_device1);
|
||||
|
||||
master_device_found = true;
|
||||
}
|
||||
|
||||
if (sync_in_cable_present)
|
||||
{
|
||||
// Positive Test
|
||||
config.wired_sync_mode = K4A_WIRED_SYNC_MODE_SUBORDINATE;
|
||||
ASSERT_EQ(K4A_RESULT_SUCCEEDED, k4a_device_start_cameras(m_device1, &config));
|
||||
k4a_device_stop_cameras(m_device1);
|
||||
|
||||
// Positive Test
|
||||
config.wired_sync_mode = K4A_WIRED_SYNC_MODE_STANDALONE;
|
||||
ASSERT_EQ(K4A_RESULT_SUCCEEDED, k4a_device_start_cameras(m_device1, &config));
|
||||
k4a_device_stop_cameras(m_device1);
|
||||
|
||||
subordinate_device_found = true;
|
||||
}
|
||||
|
||||
if (subordinate_device_found && sync_out_cable_present)
|
||||
{
|
||||
// Done with the test
|
||||
break;
|
||||
}
|
||||
|
||||
k4a_device_close(m_device1);
|
||||
m_device1 = NULL;
|
||||
}
|
||||
|
||||
// Make sure we found both devices.
|
||||
ASSERT_EQ(master_device_found, true);
|
||||
ASSERT_EQ(subordinate_device_found, true);
|
||||
}
|
Загрузка…
Ссылка в новой задаче