mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-10 14:39:49 +08:00
update OrbbecSDK version to 2.6.1
This commit is contained in:
@@ -121,11 +121,15 @@ public:
|
||||
*
|
||||
* @param[in] address The IP address, ipv4 only. such as "192.168.1.10"
|
||||
* @param[in] port The port number, currently only support 8090
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
*
|
||||
* @return std::shared_ptr<Device> The created device object.
|
||||
*/
|
||||
std::shared_ptr<Device> createNetDevice(const char *address, uint16_t port) const {
|
||||
std::shared_ptr<Device> createNetDevice(const char *address, uint16_t port, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_create_net_device(impl_, address, port, &error);
|
||||
auto device = ob_create_net_device_ex(impl_, address, port, accessMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ public:
|
||||
*
|
||||
* @return const char* the gateway address of the device, such as "192.168.1.1"
|
||||
*/
|
||||
const char *getDevicegateway() const {
|
||||
const char *getDeviceGateway() const {
|
||||
ob_error *error = nullptr;
|
||||
const char *subnetMask = ob_device_info_get_gateway(impl_, &error);
|
||||
Error::handle(&error);
|
||||
@@ -1071,6 +1071,10 @@ public:
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
const char *getDevicegateway() {
|
||||
return getDeviceGateway();
|
||||
}
|
||||
|
||||
const char *name() const {
|
||||
return getName();
|
||||
}
|
||||
@@ -1353,12 +1357,15 @@ public:
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
*
|
||||
* @param[in] index the index of the device to create
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
*
|
||||
* @return std::shared_ptr<Device> the device object
|
||||
*/
|
||||
std::shared_ptr<Device> getDevice(uint32_t index) const {
|
||||
std::shared_ptr<Device> getDevice(uint32_t index, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_device_list_get_device(impl_, index, &error);
|
||||
auto device = ob_device_list_get_device_ex(impl_, index, accessMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
@@ -1369,12 +1376,15 @@ public:
|
||||
* @attention If the device has already been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
*
|
||||
* @param[in] serialNumber the serial number of the device to create
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
*
|
||||
* @return std::shared_ptr<Device> the device object
|
||||
*/
|
||||
std::shared_ptr<Device> getDeviceBySN(const char *serialNumber) const {
|
||||
std::shared_ptr<Device> getDeviceBySN(const char *serialNumber, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_device_list_get_device_by_serial_number(impl_, serialNumber, &error);
|
||||
auto device = ob_device_list_get_device_by_serial_number_ex(impl_, serialNumber, accessMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
@@ -1389,12 +1399,15 @@ public:
|
||||
* @attention If the device has been acquired and created elsewhere, repeated acquisition will throw an exception
|
||||
*
|
||||
* @param[in] uid The uid of the device to be created
|
||||
* @param[in] accessMode Device access mode. @ref ob_device_access_mode.
|
||||
* If the device does not support setting the Access Mode, the default OB_DEVICE_DEFAULT_ACCESS is used.
|
||||
* Applies only on first device creation or after release and re-creation; subsequent calls ignore it.
|
||||
*
|
||||
* @return std::shared_ptr<Device> returns the device object
|
||||
*/
|
||||
std::shared_ptr<Device> getDeviceByUid(const char *uid) const {
|
||||
std::shared_ptr<Device> getDeviceByUid(const char *uid, OBDeviceAccessMode accessMode = OB_DEVICE_DEFAULT_ACCESS) const {
|
||||
ob_error *error = nullptr;
|
||||
auto device = ob_device_list_get_device_by_uid(impl_, uid, &error);
|
||||
auto device = ob_device_list_get_device_by_uid_ex(impl_, uid, accessMode, &error);
|
||||
Error::handle(&error);
|
||||
return std::make_shared<Device>(device);
|
||||
}
|
||||
|
||||
@@ -398,10 +398,9 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Set the point cloud decimation factor.
|
||||
* Calling this function to decimation factor will output thedownsampled data of the the cloud frame
|
||||
*
|
||||
* @brief Calling this function to decimation factor will output thedownsampled data of the the cloud frame
|
||||
*
|
||||
* @param factor The decimation factor.
|
||||
* @param value The decimation factor.
|
||||
*/
|
||||
void setDecimationFactor(int value) {
|
||||
setConfigValue("decimate", value);
|
||||
|
||||
@@ -870,6 +870,34 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Define the LiDARPointsFrame class, which inherits from the Frame class
|
||||
* @brief The LiDARPointsFrame class is used to obtain LiDAR point cloud data.
|
||||
*
|
||||
* @note The pointcloud data format can be obtained from the @ref Frame::getFormat() function. Witch can be one of the following formats:
|
||||
* - @ref OB_FORMAT_LIDAR_POINT: @ref OBLiDARPoint
|
||||
* - @ref OB_FORMAT_LIDAR_SPHERE_POINT: @ref OBLiDARSpherePoint
|
||||
* - @ref OB_FORMAT_LIDAR_SCAN: @ref OBLiDARScanPoint
|
||||
* - @ref OB_FORMAT_LIDAR_CALIBRATION: LiDAR calibration mode point cloud, raw data
|
||||
* - The pointcloud data holds a set of points. To find the number of points, divide the dataSize by the structure
|
||||
* size of the corresponding point type.
|
||||
*/
|
||||
class LiDARPointsFrame : public Frame {
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new LiDARPointsFrame object with a given pointer to the internal frame object.
|
||||
*
|
||||
* @attention After calling this constructor, the frame object will own the internal frame object, and the internal frame object will be deleted when the
|
||||
* frame object is destroyed.
|
||||
* @attention The internal frame object should not be deleted by the caller.
|
||||
* @attention Please use the FrameFactory to create a Frame object.
|
||||
*
|
||||
* @param[in] impl The pointer to the internal frame object.
|
||||
*/
|
||||
explicit LiDARPointsFrame(const ob_frame *impl) : Frame(impl){};
|
||||
~LiDARPointsFrame() noexcept override = default;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Define the FrameSet class, which inherits from the Frame class
|
||||
* @brief A FrameSet is a container for multiple frames of different types.
|
||||
@@ -1274,6 +1302,8 @@ template <typename T> bool Frame::is() const {
|
||||
return (typeid(T) == typeid(AccelFrame));
|
||||
case OB_FRAME_POINTS:
|
||||
return (typeid(T) == typeid(PointsFrame));
|
||||
case OB_FRAME_LIDAR_POINTS:
|
||||
return (typeid(T) == typeid(LiDARPointsFrame));
|
||||
case OB_FRAME_SET:
|
||||
return (typeid(T) == typeid(FrameSet));
|
||||
default:
|
||||
|
||||
@@ -157,6 +157,22 @@ public:
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a LiDAR stream to be used in the pipeline.
|
||||
*
|
||||
* This function allows users to enable a LiDAR stream with customizable parameters.
|
||||
* If no parameters are specified, the stream will be enabled with default settings.
|
||||
* Users who wish to set custom full-scale ranges or sample rates should refer to the product manual, as available settings vary by device model.
|
||||
*
|
||||
* @param[in] scanRate The scan rate of the LiDAR (default is OB_LIDAR_SCAN_ANY, which selects the default scan rate).
|
||||
* @param[in] format The stream format (default is OB_FORMAT_ANY, which selects the default format).
|
||||
*/
|
||||
void enableLiDARStream(OBLiDARScanRate scanRate = OB_LIDAR_SCAN_ANY, OBFormat format = OB_FORMAT_ANY) const {
|
||||
ob_error *error = nullptr;
|
||||
ob_config_enable_lidar_stream(impl_, scanRate, format, &error);
|
||||
Error::handle(&error);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use enableStream(std::shared_ptr<StreamProfile> streamProfile) instead
|
||||
* @brief Enable all streams to be used in the pipeline
|
||||
|
||||
@@ -381,6 +381,24 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Class representing a LiDAR stream profile.
|
||||
*/
|
||||
|
||||
class LiDARStreamProfile : public StreamProfile {
|
||||
public:
|
||||
explicit LiDARStreamProfile(const ob_stream_profile_t *impl) : StreamProfile(impl) {}
|
||||
|
||||
~LiDARStreamProfile() noexcept override = default;
|
||||
|
||||
OBLiDARScanRate getScanRate() const {
|
||||
ob_error *error = nullptr;
|
||||
auto rate = ob_lidar_stream_profile_get_scan_rate(impl_, &error);
|
||||
Error::handle(&error);
|
||||
return rate;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T> bool StreamProfile::is() const {
|
||||
switch(this->getType()) {
|
||||
case OB_STREAM_VIDEO:
|
||||
@@ -396,6 +414,8 @@ template <typename T> bool StreamProfile::is() const {
|
||||
return typeid(T) == typeid(AccelStreamProfile);
|
||||
case OB_STREAM_GYRO:
|
||||
return typeid(T) == typeid(GyroStreamProfile);
|
||||
case OB_STREAM_LIDAR:
|
||||
return typeid(T) == typeid(LiDARStreamProfile);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -421,6 +441,8 @@ public:
|
||||
return std::make_shared<AccelStreamProfile>(impl);
|
||||
case OB_STREAM_GYRO:
|
||||
return std::make_shared<GyroStreamProfile>(impl);
|
||||
case OB_STREAM_LIDAR:
|
||||
return std::make_shared<LiDARStreamProfile>(impl);
|
||||
default: {
|
||||
ob_error *err = ob_create_error(OB_STATUS_ERROR, "Unsupported stream type.", "StreamProfileFactory::create", "", OB_EXCEPTION_TYPE_INVALID_VALUE);
|
||||
Error::handle(&err);
|
||||
@@ -519,6 +541,21 @@ public:
|
||||
return gsp->as<GyroStreamProfile>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Match the corresponding LiDAR stream profile based on the passed-in parameters. If multiple Match are found, the first one in the list is
|
||||
* returned by default. Throws an exception if no matching profile is found.
|
||||
*
|
||||
* @param[in] scanRate The scan rate of LiDAR. Pass OB_LIDAR_SCAN_ANY if no matching condition is required.
|
||||
* @param[in] format The type of the stream. Pass OB_FORMAT_ANY if no matching condition is required.
|
||||
*/
|
||||
std::shared_ptr<LiDARStreamProfile> getLiDARStreamProfile(OBLiDARScanRate scanRate, OBFormat format) const {
|
||||
ob_error *error = nullptr;
|
||||
auto profile = ob_stream_profile_list_get_lidar_stream_profile(impl_, scanRate, format, &error);
|
||||
Error::handle(&error);
|
||||
auto lsp = StreamProfileFactory::create(profile);
|
||||
return lsp->as<LiDARStreamProfile>();
|
||||
}
|
||||
|
||||
public:
|
||||
// The following interfaces are deprecated and are retained here for compatibility purposes.
|
||||
uint32_t count() const {
|
||||
|
||||
@@ -90,6 +90,16 @@ public:
|
||||
return ob_accel_range_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBLiDARScanRate to " string " type and then return.
|
||||
*
|
||||
* @param[in] type OBLiDARScanRate type.
|
||||
* @return OBLiDARScanRate of "string" type.
|
||||
*/
|
||||
static std::string convertOBLiDARScanRateTypeToString(const OBLiDARScanRate &type) {
|
||||
return ob_lidar_scan_rate_type_to_string(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert OBFrameMetadataType to " string " type and then return.
|
||||
*
|
||||
@@ -152,4 +162,3 @@ public:
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
|
||||
@@ -186,5 +186,21 @@ public:
|
||||
Error::handle(&error, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Save LiDAR point cloud to PLY file.
|
||||
*
|
||||
* @param[in] fileName Point cloud save path
|
||||
* @param[in] frame LiDAR point cloud frame
|
||||
* @param[in] saveBinary Binary or textual,true: binary, false: textual
|
||||
* @return bool save LiDAR point cloud result
|
||||
*/
|
||||
static bool saveLiDARPointcloudToPly(const char *fileName, std::shared_ptr<ob::LiDARPointsFrame> frame, bool saveBinary) {
|
||||
ob_error *error = NULL;
|
||||
auto unConstImpl = const_cast<ob_frame *>(frame->getImpl());
|
||||
bool result = ob_save_lidar_pointcloud_to_ply(fileName, unConstImpl, saveBinary, &error);
|
||||
Error::handle(&error, false);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
} // namespace ob
|
||||
|
||||
Reference in New Issue
Block a user