Skip to content

Commit 917ac05

Browse files
committed
fixed crash
1 parent 7b13193 commit 917ac05

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

orbbec_camera/src/ob_camera_node.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -922,13 +922,13 @@ void OBCameraNode::setupDiagnosticUpdater() {
922922
if (diagnostic_period_ <= 0.0) {
923923
return;
924924
}
925-
try{
926-
RCLCPP_INFO_STREAM(logger_, "Publish diagnostics every " << diagnostic_period_ << " seconds");
927-
auto info = device_->getDeviceInfo();
928-
std::string serial_number = info->serialNumber();
929-
diagnostic_updater_ = std::make_unique<diagnostic_updater::Updater>(node_, diagnostic_period_);
930-
diagnostic_updater_->setHardwareID(serial_number);
931-
diagnostic_updater_->add("Temperatures", this, &OBCameraNode::onTemperatureUpdate);
925+
try {
926+
RCLCPP_INFO_STREAM(logger_, "Publish diagnostics every " << diagnostic_period_ << " seconds");
927+
auto info = device_->getDeviceInfo();
928+
std::string serial_number = info->serialNumber();
929+
diagnostic_updater_ = std::make_unique<diagnostic_updater::Updater>(node_, diagnostic_period_);
930+
diagnostic_updater_->setHardwareID(serial_number);
931+
diagnostic_updater_->add("Temperatures", this, &OBCameraNode::onTemperatureUpdate);
932932
} catch (const std::exception &e) {
933933
RCLCPP_ERROR_STREAM(logger_, "Failed to setup diagnostic updater: " << e.what());
934934
}
@@ -1092,6 +1092,9 @@ void OBCameraNode::publishPointCloud(const std::shared_ptr<ob::FrameSet> &frame_
10921092

10931093
void OBCameraNode::publishDepthPointCloud(const std::shared_ptr<ob::FrameSet> &frame_set) {
10941094
(void)frame_set;
1095+
if (!depth_cloud_pub_) {
1096+
return;
1097+
}
10951098
if (depth_cloud_pub_->get_subscription_count() == 0 || !enable_point_cloud_) {
10961099
return;
10971100
}
@@ -1189,6 +1192,9 @@ void OBCameraNode::publishDepthPointCloud(const std::shared_ptr<ob::FrameSet> &f
11891192
}
11901193

11911194
void OBCameraNode::publishColoredPointCloud(const std::shared_ptr<ob::FrameSet> &frame_set) {
1195+
if (!depth_registration_cloud_pub_) {
1196+
return;
1197+
}
11921198
if (depth_registration_cloud_pub_->get_subscription_count() == 0 ||
11931199
!enable_colored_point_cloud_) {
11941200
return;

0 commit comments

Comments
 (0)