fix: enhance error logging by formatting error messages with status

This commit is contained in:
ob-yalian
2026-05-29 09:59:03 +08:00
parent 4005d4accf
commit ba7184e96d
3 changed files with 9 additions and 6 deletions
+5 -3
View File
@@ -297,7 +297,8 @@ void OBLidarNode::setupProfiles() {
} catch (const ob::Error &ex) {
RCLCPP_ERROR_STREAM(
logger_, "Failed to get " << stream_name_[elem] << " profile: " << ex.getMessage());
logger_, "Failed to get " << stream_name_[elem]
<< " profile: " << orbbec_camera::formatObErrorWithStatus(ex));
RCLCPP_ERROR_STREAM(logger_, "Stream: " << magic_enum::enum_name(elem.first)
<< ", Stream Index: " << elem.second
<< ", Scan Rate: " << rate_[elem]
@@ -1262,8 +1263,9 @@ void OBLidarNode::calcAndPublishStaticTransform() {
RCLCPP_INFO_STREAM(logger_, "Using GYRO extrinsic for IMU");
} catch (const ob::Error &e2) {
RCLCPP_ERROR_STREAM(
logger_, "Failed to get "
<< frame_id << " extrinsic from both ACCEL and GYRO: " << e2.getMessage());
logger_, "Failed to get " << frame_id
<< " extrinsic from both ACCEL and GYRO: "
<< orbbec_camera::formatObErrorWithStatus(e2));
ex = OBExtrinsic({{1, 0, 0, 0, 1, 0, 0, 0, 1}, {0, 0, 0}});
}
}