diff --git a/src/rm_hardware_driver/ros2_hik_camera/src/hik_camera_node.cpp b/src/rm_hardware_driver/ros2_hik_camera/src/hik_camera_node.cpp index bcdfbe2..2c7af06 100644 --- a/src/rm_hardware_driver/ros2_hik_camera/src/hik_camera_node.cpp +++ b/src/rm_hardware_driver/ros2_hik_camera/src/hik_camera_node.cpp @@ -282,7 +282,21 @@ private: // Set pixel format to RGB8 (try to force color output) // PixelType_Gvsp_RGB8_Packed = 0x02100014 - (void)MV_CC_SetEnumValue(camera_handle_, "PixelFormat", PixelType_Gvsp_RGB8_Packed); + int set_ret = MV_CC_SetEnumValue(camera_handle_, "PixelFormat", PixelType_Gvsp_RGB8_Packed); + if (set_ret != MV_OK) { + FYT_WARN("camera_driver", "Failed to set PixelFormat to RGB8: [0x{:x}]", set_ret); + } else { + FYT_INFO("camera_driver", "PixelFormat set to RGB8"); + } + + // Wait for pixel format to take effect + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + // Verify pixel format + MVCC_ENUMVALUE enum_value = {0}; + if (MV_CC_GetEnumValue(camera_handle_, "PixelFormat", &enum_value) == MV_OK) { + FYT_INFO("camera_driver", "Current PixelFormat: 0x{:x}", enum_value.nCurValue); + } // Set exposure / gain (void)MV_CC_SetFloatValue(camera_handle_, "ExposureTime", static_cast(exposure_time_));