From 8b5d6bd68ab2f6a21dff9d8ec6c4300a0d0b3aba Mon Sep 17 00:00:00 2001 From: SamerKhshiboun Date: Wed, 18 Jan 2023 16:00:52 +0200 Subject: [PATCH 1/2] if default profile is not defined, take the first available profile as default --- realsense2_camera/src/profile_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/realsense2_camera/src/profile_manager.cpp b/realsense2_camera/src/profile_manager.cpp index cb85375f73..a70fd3dc31 100644 --- a/realsense2_camera/src/profile_manager.cpp +++ b/realsense2_camera/src/profile_manager.cpp @@ -113,7 +113,10 @@ rs2::stream_profile ProfilesManager::getDefaultProfile() } } if (!(default_profile.get())) - throw std::runtime_error("No default profile found"); + { + ROS_INFO_STREAM("No default profile found. Setting the first available profile as the default one.") + default_profile = _all_profiles.front(); + } return default_profile; } From f000930509873294476de63dddb78d9dab73580f Mon Sep 17 00:00:00 2001 From: SamerKhshiboun Date: Wed, 18 Jan 2023 17:02:49 +0200 Subject: [PATCH 2/2] fix compilation errors --- realsense2_camera/src/profile_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/realsense2_camera/src/profile_manager.cpp b/realsense2_camera/src/profile_manager.cpp index a70fd3dc31..a6f11489d6 100644 --- a/realsense2_camera/src/profile_manager.cpp +++ b/realsense2_camera/src/profile_manager.cpp @@ -114,7 +114,7 @@ rs2::stream_profile ProfilesManager::getDefaultProfile() } if (!(default_profile.get())) { - ROS_INFO_STREAM("No default profile found. Setting the first available profile as the default one.") + ROS_INFO_STREAM("No default profile found. Setting the first available profile as the default one."); default_profile = _all_profiles.front(); }