mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-07 21:37:46 +08:00
Fix crash and change parameter order in gemini435_le launch file by repositioning time_sync_period argument
This commit is contained in:
@@ -193,13 +193,6 @@ class OBCameraNode {
|
||||
|
||||
void getDepthStatus(orbbec_camera_msgs::msg::DeviceStatus& status_msg) {
|
||||
fps_delay_status_depth_->fillDepthStatus(status_msg);
|
||||
status_msg.header.frame_id = camera_link_frame_id_;
|
||||
}
|
||||
|
||||
void publishDeviceStatus(const orbbec_camera_msgs::msg::DeviceStatus& msg) {
|
||||
if (device_status_pub_) {
|
||||
device_status_pub_->publish(msg);
|
||||
}
|
||||
}
|
||||
|
||||
bool checkUserCalibrationReady() {
|
||||
@@ -245,8 +238,6 @@ class OBCameraNode {
|
||||
|
||||
void setupDiagnosticUpdater();
|
||||
|
||||
void setupPeriodicHostTimeSync();
|
||||
|
||||
void onTemperatureUpdate(diagnostic_updater::DiagnosticStatusWrapper& status);
|
||||
|
||||
void setupCameraCtrlServices();
|
||||
@@ -776,9 +767,7 @@ class OBCameraNode {
|
||||
// soft ware trigger
|
||||
rclcpp::TimerBase::SharedPtr software_trigger_timer_;
|
||||
rclcpp::TimerBase::SharedPtr diagnostic_timer_;
|
||||
rclcpp::TimerBase::SharedPtr sync_timer_;
|
||||
std::chrono::milliseconds software_trigger_period_{33};
|
||||
std::chrono::milliseconds time_sync_period_{6000};
|
||||
bool enable_heartbeat_ = false;
|
||||
bool enable_color_undistortion_ = false;
|
||||
std::shared_ptr<image_publisher> color_undistortion_publisher_;
|
||||
@@ -835,6 +824,5 @@ class OBCameraNode {
|
||||
|
||||
std::unique_ptr<FpsDelayStatus> fps_delay_status_color_{nullptr};
|
||||
std::unique_ptr<FpsDelayStatus> fps_delay_status_depth_{nullptr};
|
||||
rclcpp::Publisher<orbbec_camera_msgs::msg::DeviceStatus>::SharedPtr device_status_pub_;
|
||||
};
|
||||
} // namespace orbbec_camera
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ob_camera_node.h"
|
||||
#include "utils.h"
|
||||
#include "dynamic_params.h"
|
||||
#include <orbbec_camera_msgs/msg/device_status.hpp>
|
||||
|
||||
#include "libobsensor/ObSensor.hpp"
|
||||
#include <pthread.h>
|
||||
@@ -116,6 +117,7 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
int net_device_port_ = 0;
|
||||
int connection_delay_ = 100;
|
||||
bool enable_sync_host_time_ = true;
|
||||
std::chrono::milliseconds time_sync_period_{6000};
|
||||
std::string preset_firmware_path_;
|
||||
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr reboot_device_srv_ = nullptr;
|
||||
std::chrono::time_point<std::chrono::system_clock> start_time_;
|
||||
@@ -125,5 +127,7 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
std::atomic<bool> firmware_update_success_{false};
|
||||
rclcpp::TimerBase::SharedPtr device_status_timer_ = nullptr;
|
||||
int device_status_interval_hz = 2; // 2Hz
|
||||
rclcpp::Publisher<orbbec_camera_msgs::msg::DeviceStatus>::SharedPtr device_status_pub_ = nullptr;
|
||||
std::string node_name_;
|
||||
};
|
||||
} // namespace orbbec_camera
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <iomanip>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
namespace orbbec_camera {
|
||||
inline void LogFatal(const char* file, int line, const std::string& message) {
|
||||
std::cerr << "Check failed at " << file << ":" << line << ": " << message << std::endl;
|
||||
@@ -40,15 +39,25 @@ inline void LogFatal(const char* file, int line, const std::string& message) {
|
||||
}
|
||||
} // namespace orbbec_camera
|
||||
|
||||
#define TRY_EXECUTE_BLOCK(block) \
|
||||
try { \
|
||||
block; \
|
||||
} catch (const ob::Error& e) { \
|
||||
RCLCPP_ERROR(logger_, "Error in %s at line %d: %s", __FUNCTION__, __LINE__, e.getMessage()); \
|
||||
} catch (const std::exception& e) { \
|
||||
RCLCPP_ERROR(logger_, "Exception in %s at line %d: %s", __FUNCTION__, __LINE__, e.what()); \
|
||||
} catch (...) { \
|
||||
RCLCPP_ERROR(logger_, "Unknown exception in %s at line %d", __FUNCTION__, __LINE__); \
|
||||
#define TRY_EXECUTE_BLOCK(block) \
|
||||
try { \
|
||||
block; \
|
||||
} catch (const ob::Error& e) { \
|
||||
std::string error_msg = e.getMessage() ? e.getMessage() : "Unknown OB error"; \
|
||||
if (error_msg.find("Device is deactivated") != std::string::npos || \
|
||||
error_msg.find("disconnected") != std::string::npos || \
|
||||
error_msg.find("Send control transfer failed") != std::string::npos) { \
|
||||
RCLCPP_WARN(logger_, \
|
||||
"Device communication error in %s at line %d: %s - Device may be disconnected", \
|
||||
__FUNCTION__, __LINE__, error_msg.c_str()); \
|
||||
} else { \
|
||||
RCLCPP_ERROR(logger_, "Error in %s at line %d: %s", __FUNCTION__, __LINE__, \
|
||||
error_msg.c_str()); \
|
||||
} \
|
||||
} catch (const std::exception& e) { \
|
||||
RCLCPP_ERROR(logger_, "Exception in %s at line %d: %s", __FUNCTION__, __LINE__, e.what()); \
|
||||
} catch (...) { \
|
||||
RCLCPP_ERROR(logger_, "Unknown exception in %s at line %d", __FUNCTION__, __LINE__); \
|
||||
}
|
||||
|
||||
#define TRY_TO_SET_PROPERTY(func, property, value) \
|
||||
@@ -200,5 +209,5 @@ cv::Mat undistortImage(const cv::Mat& image, const OBCameraIntrinsic& intrinsic,
|
||||
|
||||
std::string getDistortionModels(OBCameraDistortion distortion);
|
||||
|
||||
std::string calcMD5(const std::string &data);
|
||||
std::string calcMD5(const std::string& data);
|
||||
} // namespace orbbec_camera
|
||||
|
||||
Reference in New Issue
Block a user