update 2.0.3

This commit is contained in:
jj
2024-09-28 19:03:42 +08:00
parent 71ece588b3
commit 9cb729c935
16 changed files with 914 additions and 855 deletions
+745 -745
View File
File diff suppressed because it is too large Load Diff
@@ -396,6 +396,16 @@ OB_EXPORT const char *ob_device_info_get_ip_address(const ob_device_info *info,
*/
OB_EXPORT const char *ob_device_info_get_hardware_version(const ob_device_info *info, ob_error **error);
/**
* @brief Check if the device extension information exists.
*
* @param device The device object.
* @param info_key The key of the device extension information.
* @param error Pointer to an error object that will be set if an error occurs.
* @return bool Whether the device extension information exists.
*/
OB_EXPORT bool ob_device_is_extension_info_exist(const ob_device *device, const char *info_key, ob_error **error);
/**
* @brief Get the device extension information.
* @brief Extension information is a set of key-value pair of string, user cat get the information by the key.
@@ -626,27 +626,10 @@ OB_EXPORT void ob_frameset_push_frame(ob_frame *frameset, const ob_frame *frame,
#define ob_gyro_frame_temperature ob_gyro_frame_get_temperature
#define ob_frameset_get_frame_count ob_frameset_get_count
#define ob_frame_time_stamp(frame, err) \
do { \
uint64_t timestamp_us = ob_frame_get_timestamp_us(frame, err); \
return timestamp_us / 1000; \
} while(0);
#define ob_frame_system_time_stamp(frame, err) \
do { \
uint64_t system_timestamp_us = ob_frame_get_system_timestamp_us(frame, err); \
return system_timestamp_us / 1000; \
} while(0);
#define ob_frame_set_system_time_stamp(frame, system_timestamp, err) \
do { \
ob_frame_set_system_timestamp_us(frame, system_timestamp * 1000, err); \
} while(0);
#define ob_frame_set_device_time_stamp(frame, device_timestamp, err) \
do { \
ob_frame_set_timestamp_us(frame, device_timestamp * 1000, err); \
} while(0);
#define ob_frame_time_stamp(frame, err) (ob_frame_get_timestamp_us(frame, err))
#define ob_frame_system_time_stamp(frame, err) (ob_frame_get_system_timestamp_us(frame, err))
#define ob_frame_set_system_time_stamp(frame, system_timestamp, err) (ob_frame_set_system_timestamp_us(frame, system_timestamp * 1000, err))
#define ob_frame_set_device_time_stamp(frame, device_timestamp, err) (ob_frame_set_timestamp_us(frame, device_timestamp * 1000, err))
#ifdef __cplusplus
}
@@ -685,7 +685,7 @@ typedef enum {
OB_PRECISION_UNKNOWN,
OB_PRECISION_COUNT,
} OBDepthPrecisionLevel,
ob_depth_precision_level, OB_DEPTH_PRECISION_LEVEL;
ob_depth_precision_level, OB_DEPTH_PRECISION_LEVEL, OBDepthUnit, ob_depth_unit;
/**
* @brief disparity parameters for disparity based camera
@@ -1389,6 +1389,13 @@ typedef struct {
const char *desc; ///< Description of the configuration item
} OBFilterConfigSchemaItem, ob_filter_config_schema_item;
/**
* @brief struct of serial number
*/
typedef struct {
char numberStr[16];
} OBDeviceSerialNumber, ob_device_serial_number, OBSerialNumber, ob_serial_number;
/**
* @brief Frame metadata types
* @brief The frame metadata is a set of meta info generated by the device for current individual frame.
@@ -691,6 +691,12 @@ typedef enum {
*/
OB_PROP_COLOR_FOCUS_INT = 2038,
/**
* @brief Depth camera priority
*
*/
OB_PROP_DEPTH_AUTO_EXPOSURE_PRIORITY_INT = 2052,
/**
* @brief Software disparity to depth
*/
@@ -739,6 +745,7 @@ typedef enum {
#define OB_PROP_LASER_ENERGY_LEVEL_INT OB_PROP_LASER_POWER_LEVEL_CONTROL_INT
#define OB_PROP_LASER_HW_ENERGY_LEVEL_INT OB_PROP_LASER_POWER_ACTUAL_LEVEL_INT
#define OB_PROP_DEVICE_USB3_REPEAT_IDENTIFY_BOOL OB_PROP_DEVICE_USB2_REPEAT_IDENTIFY_BOOL
#define OB_PROP_DEPTH_NOISE_REMOVAL_FILTER_BOOL OB_PROP_DEPTH_SOFT_FILTER_BOOL
/**
* @brief The data type used to describe all property settings
@@ -97,14 +97,28 @@ public:
return std::make_shared<DeviceInfo>(info);
}
/**
* @brief Check if the extension information is exist
*
* @param infoKey The key of the extension information
* @return bool Whether the extension information exists
*/
bool isExtensionInfoExist(const std::string &infoKey) const {
ob_error *error = nullptr;
auto exist = ob_device_is_extension_info_exist(impl_, infoKey.c_str(), &error);
Error::handle(&error);
return exist;
}
/**
* @brief Get information about extensions obtained from SDK supported by the device
*
* @param infoKey The key of the extension information
* @return const char* Returns extended information about the device
*/
const char *getExtensionInfo(const char *info_key) const {
const char *getExtensionInfo(const std::string &infoKey) const {
ob_error *error = nullptr;
const char *info = ob_device_get_extension_info(impl_, info_key, &error);
const char *info = ob_device_get_extension_info(impl_, infoKey.c_str(), &error);
Error::handle(&error);
return info;
}
@@ -713,6 +727,24 @@ public:
return state;
}
/**
* @brief Send data to the device and receive data from the device.
* @brief This is a factory and debug function, which can be used to send and receive data from the device. The data format is secret and belongs to the
* device vendor.
*
* @attention The send and receive data buffer are managed by the caller, the receive data buffer should be allocated at 1024 bytes or larger.
*
* @param[in] sendData The data to be sent to the device.
* @param[in] sendDataSize The size of the data to be sent to the device.
* @param[out] receiveData The data received from the device.
* @param[in out] receiveDataSize The requeseted size of the data received from the device, and the actual size of the data received from the device.
*/
void sendAndReceiveData(const uint8_t *sendData, uint32_t sendDataSize, uint8_t *receiveData, uint32_t *receiveDataSize) const {
ob_error *error = nullptr;
ob_device_send_and_receive_data(impl_, sendData, sendDataSize, receiveData, receiveDataSize, &error);
Error::handle(&error);
}
private:
static void firmwareUpdateCallback(ob_fw_update_state state, const char *message, uint8_t percent, void *userData) {
auto device = static_cast<Device *>(userData);
@@ -834,8 +866,8 @@ public:
/**
* @brief Get the connection type of the device
*
* @return const char* the connection type of the devicecurrently supports"USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1", "USB3.2",
* "Ethernet"
* @return const char* the connection type of the devicecurrently supports"USB", "USB1.0", "USB1.1", "USB2.0", "USB2.1", "USB3.0", "USB3.1",
* "USB3.2", "Ethernet"
*/
const char *getConnectionType() const {
ob_error *error = nullptr;
@@ -796,7 +796,7 @@ public:
init(impl);
}
~NoiseRemovalFilter() noexcept = default;
~NoiseRemovalFilter() noexcept = default;
/**
* @brief Set the noise removal filter params.
@@ -922,16 +922,76 @@ public:
}
};
/**
* @brief Depth to disparity or disparity to depth
*/
class DisparityTransform : public Filter {
public:
DisparityTransform(const std::string &activationKey = "") {
ob_error *error = nullptr;
auto impl = ob_create_private_filter("DisparityTransform", activationKey.c_str(), &error);
Error::handle(&error);
init(impl);
}
~DisparityTransform() noexcept = default;
};
class OBFilterList {
private:
ob_filter_list_t* impl_;
public:
explicit OBFilterList(ob_filter_list_t *impl) : impl_(impl) {}
~OBFilterList() noexcept {
ob_error *error = nullptr;
ob_delete_filter_list(impl_, &error);
Error::handle(&error, false);
}
/**
* @brief Get the number of filters
*
* @return uint32_t The number of filters
*/
uint32_t getCount() const {
ob_error *error = nullptr;
auto count = ob_filter_list_get_count(impl_, &error);
Error::handle(&error);
return count;
}
/**
* @brief Get the Filter object at the specified index
*
* @param index The filter index. The range is [0, count-1]. If the index exceeds the range, an exception will be thrown.
* @return std::shared_ptr<Filter> The filter object.
*/
std::shared_ptr<Filter> getFilter(uint32_t index) {
ob_error *error = nullptr;
auto filter = ob_filter_list_get_filter(impl_, index, &error);
Error::handle(&error);
return std::make_shared<Filter>(filter);
}
public:
// The following interfaces are deprecated and are retained here for compatibility purposes.
uint32_t count() const {
return getCount();
}
};
/**
* @brief Define the Filter type map
*/
static const std::unordered_map<std::string, std::type_index> typeMap = {
static const std::unordered_map<std::string, std::type_index> obFilterTypeMap = {
{ "PointCloudFilter", typeid(PointCloudFilter) }, { "Align", typeid(Align) },
{ "FormatConverter", typeid(FormatConvertFilter) }, { "HDRMerge", typeid(HdrMerge) },
{ "SequenceIdFilter", typeid(SequenceIdFilter) }, { "DecimationFilter", typeid(DecimationFilter) },
{ "ThresholdFilter", typeid(ThresholdFilter) }, { "SpatialAdvancedFilter", typeid(SpatialAdvancedFilter) },
{ "HoleFillingFilter", typeid(HoleFillingFilter) }, { "NoiseRemovalFilter", typeid(NoiseRemovalFilter) },
{ "TemporalFilter", typeid(TemporalFilter) }
{ "TemporalFilter", typeid(TemporalFilter) }, { "DisparityTransform", typeid(DisparityTransform) }
};
/**
@@ -939,8 +999,8 @@ static const std::unordered_map<std::string, std::type_index> typeMap = {
*/
template <typename T> bool Filter::is() {
std::string name = type();
auto it = typeMap.find(name);
if(it != typeMap.end()) {
auto it = obFilterTypeMap.find(name);
if(it != obFilterTypeMap.end()) {
return std::type_index(typeid(T)) == it->second;
}
return false;
@@ -94,77 +94,6 @@ public:
return result;
}
/**
* @brief Transforms the depth frame into the geometry of the color camera.
*
* @param device Device handle
* @param depthFrame Input depth frame
* @param targetColorCameraWidth Target color camera width
* @param targetColorCameraHeight Target color camera height
*
* @return std::shared_ptr<ob::Frame> Transformed depth frame
*/
static std::shared_ptr<ob::Frame> transformationDepthFrameToColorCamera(std::shared_ptr<ob::Device> device, std::shared_ptr<ob::Frame> depthFrame,
uint32_t targetColorCameraWidth, uint32_t targetColorCameraHeight) {
ob_error *error = NULL;
// unsafe operation, need to cast const to non-const
auto unConstImpl = const_cast<ob_frame *>(depthFrame->getImpl());
auto result = transformation_depth_frame_to_color_camera(device->getImpl() , unConstImpl, targetColorCameraWidth, targetColorCameraHeight, &error);
Error::handle(&error);
return std::make_shared<ob::Frame>(result);
}
/**
* @brief Init transformation tables
*
* @param calibrationParam Device calibration param,see pipeline::getCalibrationParam
* @param sensorType sensor type
* @param data input data,needs to be allocated externally.During initialization, the external allocation size is 'dataSize', for example, dataSize = 1920 *
* 1080 * 2*sizeof(float) (1920 * 1080 represents the image resolution, and 2 represents two LUTs, one for x-coordinate and one for y-coordinate).
* @param dataSize input data size
* @param xyTables output xy tables
*
* @return bool Transform result
*/
static bool transformationInitXYTables(const OBCalibrationParam calibrationParam, const OBSensorType sensorType, float *data, uint32_t *dataSize,
OBXYTables *xyTables) {
ob_error *error = NULL;
bool result = transformation_init_xy_tables(calibrationParam, sensorType, data, dataSize, xyTables, &error);
Error::handle(&error);
return result;
}
/**
* @brief Transform depth image to point cloud data
*
* @param xyTables input xy tables,see CoordinateTransformHelper::transformationInitXYTables
* @param depthImageData input depth image data
* @param pointCloudData output point cloud data
*
*/
static void transformationDepthToPointCloud(OBXYTables *xyTables, const void *depthImageData, void *pointCloudData) {
ob_error *error = NULL;
transformation_depth_to_pointcloud(xyTables, depthImageData, pointCloudData, &error);
Error::handle(&error, false);
}
/**
* @brief Transform depth image to RGBD point cloud data
*
* @param xyTables input xy tables,see CoordinateTransformHelper::transformationInitXYTables
* @param depthImageData input depth image data
* @param colorImageData input color image data (only RGB888 support)
* @param pointCloudData output RGBD point cloud data
*
*/
static void transformationDepthToRGBDPointCloud(OBXYTables *xyTables, const void *depthImageData, const void *colorImageData, void *pointCloudData){
ob_error *error = NULL;
transformation_depth_to_rgbd_pointcloud(xyTables, depthImageData, colorImageData, pointCloudData, &error);
Error::handle(&error, false);
}
public:
// The following interfaces are deprecated and are retained here for compatibility purposes.
static bool calibration3dTo3d(const OBCalibrationParam calibrationParam, const OBPoint3f sourcePoint3f, const OBSensorType sourceSensorType,
@@ -198,5 +127,37 @@ public:
Error::handle(&error);
return result;
}
static std::shared_ptr<ob::Frame> transformationDepthFrameToColorCamera(std::shared_ptr<ob::Device> device, std::shared_ptr<ob::Frame> depthFrame,
uint32_t targetColorCameraWidth, uint32_t targetColorCameraHeight) {
ob_error *error = NULL;
// unsafe operation, need to cast const to non-const
auto unConstImpl = const_cast<ob_frame *>(depthFrame->getImpl());
auto result = transformation_depth_frame_to_color_camera(device->getImpl() , unConstImpl, targetColorCameraWidth, targetColorCameraHeight, &error);
Error::handle(&error);
return std::make_shared<ob::Frame>(result);
}
static bool transformationInitXYTables(const OBCalibrationParam calibrationParam, const OBSensorType sensorType, float *data, uint32_t *dataSize,
OBXYTables *xyTables) {
ob_error *error = NULL;
bool result = transformation_init_xy_tables(calibrationParam, sensorType, data, dataSize, xyTables, &error);
Error::handle(&error);
return result;
}
static void transformationDepthToPointCloud(OBXYTables *xyTables, const void *depthImageData, void *pointCloudData) {
ob_error *error = NULL;
transformation_depth_to_pointcloud(xyTables, depthImageData, pointCloudData, &error);
Error::handle(&error, false);
}
static void transformationDepthToRGBDPointCloud(OBXYTables *xyTables, const void *depthImageData, const void *colorImageData, void *pointCloudData){
ob_error *error = NULL;
transformation_depth_to_rgbd_pointcloud(xyTables, depthImageData, colorImageData, pointCloudData, &error);
Error::handle(&error, false);
}
};
} // namespace ob
Binary file not shown.
+1 -1
View File
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>orbbec_camera</name>
<version>2.0.2</version>
<version>2.0.3</version>
<description>Orbbec Camera package</description>
<maintainer email="mocun@orbbec.com">Joe Dong</maintainer>
<license>Apache-2.0</license>
+6 -3
View File
@@ -76,7 +76,6 @@ OBCameraNodeDriver::OBCameraNodeDriver(const rclcpp::NodeOptions &node_options)
node_options_(node_options),
config_path_(ament_index_cpp::get_package_share_directory("orbbec_camera") +
"/config/OrbbecSDKConfig_v1.0.xml"),
ctx_(std::make_unique<ob::Context>(config_path_.c_str())),
logger_(this->get_logger()),
extension_path_(ament_index_cpp::get_package_prefix("orbbec_camera") + "/lib/extensions") {
init();
@@ -88,7 +87,6 @@ OBCameraNodeDriver::OBCameraNodeDriver(const std::string &node_name, const std::
node_options_(node_options),
config_path_(ament_index_cpp::get_package_share_directory("orbbec_camera") +
"/config/OrbbecSDKConfig_v1.0.xml"),
ctx_(std::make_unique<ob::Context>()),
logger_(this->get_logger()),
extension_path_(ament_index_cpp::get_package_prefix("orbbec_camera") + "/lib/extensions") {
init();
@@ -114,7 +112,12 @@ void OBCameraNodeDriver::init() {
signal(SIGFPE, signalHandler); // float point exception
signal(SIGILL, signalHandler); // illegal instruction
ob::Context::setExtensionsDirectory(extension_path_.c_str());
ctx_ = std::make_unique<ob::Context>(config_path_.c_str());
if (config_path_.empty()) {
ctx_ = std::make_unique<ob::Context>();
} else {
ctx_ = std::make_unique<ob::Context>(config_path_.c_str());
}
auto log_level_str = declare_parameter<std::string>("log_level", "none");
auto log_level = obLogSeverityFromString(log_level_str);
connection_delay_ = static_cast<int>(declare_parameter<int>("connection_delay", 100));
@@ -62,11 +62,7 @@ class MetadataExportFiles : public rclcpp::Node {
}
void load_parameters() {
<<<<<<< HEAD
std::ifstream file("src/OrbbecSDK_ROS2/orbbec_camera/config/metadataexport/metadata_export_params.json");
=======
std::ifstream file("src/OrbbecSDK_ROS2/orbbec_camera/config/metadata_export_params.json");
>>>>>>> e2a2e1a47ad1fe03adce9baec868053e3fe5e4ff
if (!file.is_open()) {
RCLCPP_ERROR(this->get_logger(), "Failed to open JSON file.");
return;