Skip to content

Commit 1e3edfa

Browse files
author
obyalian
committed
Add static transform accel_gyro_optical_frame
1 parent 9bebd0d commit 1e3edfa

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

orbbec_camera/src/ob_camera_node.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,21 +1472,24 @@ void OBCameraNode::stopStreams() {
14721472
if ((interleave_ae_mode_ == "hdr") || (interleave_ae_mode_ == "laser")) {
14731473
try {
14741474
RCLCPP_INFO_STREAM(logger_, "current interleave_ae_mode_: " << interleave_ae_mode_);
1475-
if (device_->isPropertySupported(OB_PROP_FRAME_INTERLEAVE_ENABLE_BOOL, OB_PERMISSION_WRITE)) {
1475+
if (device_->isPropertySupported(OB_PROP_FRAME_INTERLEAVE_ENABLE_BOOL,
1476+
OB_PERMISSION_WRITE)) {
14761477
interleave_frame_enable_ = false;
14771478
RCLCPP_INFO_STREAM(logger_, "Enable enable_interleave_depth_frame to "
14781479
<< (interleave_frame_enable_ ? "true" : "false"));
14791480
TRY_TO_SET_PROPERTY(setBoolProperty, OB_PROP_FRAME_INTERLEAVE_ENABLE_BOOL,
14801481
interleave_frame_enable_);
14811482
}
14821483
} catch (const ob::Error &e) {
1483-
RCLCPP_WARN_STREAM(logger_, "Failed to disable interleave frame during shutdown: " << e.getMessage());
1484+
RCLCPP_WARN_STREAM(
1485+
logger_, "Failed to disable interleave frame during shutdown: " << e.getMessage());
14841486
} catch (...) {
14851487
RCLCPP_WARN_STREAM(logger_, "Failed to disable interleave frame during shutdown");
14861488
}
14871489
}
14881490
} else {
1489-
RCLCPP_WARN_STREAM(logger_, "Device or pipeline not available during stop - likely disconnected");
1491+
RCLCPP_WARN_STREAM(logger_,
1492+
"Device or pipeline not available during stop - likely disconnected");
14901493
}
14911494
} catch (const ob::Error &e) {
14921495
RCLCPP_ERROR_STREAM(logger_, "Failed to stop pipeline: " << e.getMessage());
@@ -1736,7 +1739,8 @@ void OBCameraNode::getParameters() {
17361739
setAndGetNodeParameter<int>(depth_ae_roi_right_, "depth_ae_roi_right", -1);
17371740
setAndGetNodeParameter<int>(depth_ae_roi_bottom_, "depth_ae_roi_bottom", -1);
17381741
setAndGetNodeParameter<int>(depth_brightness_, "depth_brightness", -1);
1739-
setAndGetNodeParameter<int>(mean_intensity_set_point_, "mean_intensity_set_point", depth_brightness_);
1742+
setAndGetNodeParameter<int>(mean_intensity_set_point_, "mean_intensity_set_point",
1743+
depth_brightness_);
17401744
setAndGetNodeParameter<std::string>(depth_precision_str_, "depth_precision", "");
17411745
setAndGetNodeParameter<bool>(enable_ir_auto_exposure_, "enable_ir_auto_exposure", true);
17421746
setAndGetNodeParameter<int>(ir_exposure_, "ir_exposure", -1);
@@ -1946,7 +1950,8 @@ void OBCameraNode::onTemperatureUpdate(diagnostic_updater::DiagnosticStatusWrapp
19461950
// Check to ensure we're not shutting down and device is valid
19471951
std::lock_guard<decltype(device_lock_)> lock(device_lock_);
19481952
if (!device_ || !is_running_.load() || !is_camera_node_initialized_.load()) {
1949-
status.summary(diagnostic_msgs::msg::DiagnosticStatus::STALE, "Device disconnected or shutting down");
1953+
status.summary(diagnostic_msgs::msg::DiagnosticStatus::STALE,
1954+
"Device disconnected or shutting down");
19501955
return;
19511956
}
19521957

@@ -3480,6 +3485,13 @@ void OBCameraNode::calcAndPublishStaticTransform() {
34803485
CHECK_NOTNULL(depth_to_other_extrinsics_publishers_[GYRO]);
34813486
depth_to_other_extrinsics_publishers_[GYRO]->publish(ex_msg);
34823487
}
3488+
if (enable_sync_output_accel_gyro_) {
3489+
tf2::Quaternion zero_rot;
3490+
zero_rot.setRPY(0.0, 0.0, 0.0);
3491+
tf2::Vector3 zero_trans(0, 0, 0);
3492+
publishStaticTF(node_->now(), zero_trans, zero_rot, optical_frame_id_[GYRO],
3493+
accel_gyro_frame_id_);
3494+
}
34833495
}
34843496

34853497
void OBCameraNode::publishStaticTransforms() {

0 commit comments

Comments
 (0)