mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-11 23:09:51 +08:00
[tool]Fix the crash problem caused by multi_save_rgbir_node when saving images
This commit is contained in:
@@ -163,15 +163,15 @@ void OBCameraNodeDriver::init() {
|
|||||||
net_device_port_ = static_cast<int>(declare_parameter<int>("net_device_port", 0));
|
net_device_port_ = static_cast<int>(declare_parameter<int>("net_device_port", 0));
|
||||||
enumerate_net_device_ = declare_parameter<bool>("enumerate_net_device", false);
|
enumerate_net_device_ = declare_parameter<bool>("enumerate_net_device", false);
|
||||||
uvc_backend_ = declare_parameter<std::string>("uvc_backend", "libuvc");
|
uvc_backend_ = declare_parameter<std::string>("uvc_backend", "libuvc");
|
||||||
if(uvc_backend_=="libuvc"){
|
if (uvc_backend_ == "libuvc") {
|
||||||
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_LIBUVC);
|
|
||||||
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:"<<uvc_backend_);
|
|
||||||
}else if(uvc_backend_=="v4l2"){
|
|
||||||
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_V4L2);
|
|
||||||
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:"<<uvc_backend_);
|
|
||||||
}else{
|
|
||||||
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_LIBUVC);
|
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_LIBUVC);
|
||||||
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:"<<uvc_backend_);
|
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:" << uvc_backend_);
|
||||||
|
} else if (uvc_backend_ == "v4l2") {
|
||||||
|
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_V4L2);
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:" << uvc_backend_);
|
||||||
|
} else {
|
||||||
|
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_LIBUVC);
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:" << uvc_backend_);
|
||||||
}
|
}
|
||||||
ctx_->enableNetDeviceEnumeration(enumerate_net_device_);
|
ctx_->enableNetDeviceEnumeration(enumerate_net_device_);
|
||||||
ctx_->setDeviceChangedCallback([this](const std::shared_ptr<ob::DeviceList> &removed_list,
|
ctx_->setDeviceChangedCallback([this](const std::shared_ptr<ob::DeviceList> &removed_list,
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ class MultiCameraSubscriber : public rclcpp::Node {
|
|||||||
std::string ir_filename = folder + "/ir#left_SN" + serial_index + "_Index" +
|
std::string ir_filename = folder + "/ir#left_SN" + serial_index + "_Index" +
|
||||||
std::to_string(usb_index) + time_domain_ +
|
std::to_string(usb_index) + time_domain_ +
|
||||||
ir_current_timestamps[i] + "_f" + std::to_string(i) + "_s" +
|
ir_current_timestamps[i] + "_f" + std::to_string(i) + "_s" +
|
||||||
ir_timestamps[i] + "_e" + left_ir_meta_exposure[i] + "_g" +
|
ir_timestamps[i] + "_e" + left_ir_meta_exposure[i] + "_d" +
|
||||||
left_ir_meta_gain[i] + "_.jpg";
|
left_ir_meta_gain[i] + "_.jpg";
|
||||||
if (ir_images[i].empty()) {
|
if (ir_images[i].empty()) {
|
||||||
RCLCPP_INFO_STREAM(rclcpp::get_logger("multi_camera_subscriber"), "over ");
|
RCLCPP_INFO_STREAM(rclcpp::get_logger("multi_camera_subscriber"), "over ");
|
||||||
@@ -247,7 +247,7 @@ class MultiCameraSubscriber : public rclcpp::Node {
|
|||||||
std::string color_filename =
|
std::string color_filename =
|
||||||
folder + "/color_SN" + serial_index + "_Index" + std::to_string(usb_index) +
|
folder + "/color_SN" + serial_index + "_Index" + std::to_string(usb_index) +
|
||||||
time_domain_ + color_current_timestamps[i] + "_f" + std::to_string(i) + "_s" +
|
time_domain_ + color_current_timestamps[i] + "_f" + std::to_string(i) + "_s" +
|
||||||
color_timestamps[i] + "_e" + color_meta_exposure[i] + "_g" + color_meta_gain[i] + "_.jpg";
|
color_timestamps[i] + "_e" + color_meta_exposure[i] + "_d" + color_meta_gain[i] + "_.jpg";
|
||||||
if (color_images[i].empty()) {
|
if (color_images[i].empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user