Update Lidar SDK version to v2.4.3

This commit is contained in:
jj
2025-05-27 14:15:49 +08:00
parent fbd0025e37
commit 5b80656a61
14 changed files with 461 additions and 108 deletions
@@ -720,6 +720,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 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.
@@ -1042,6 +1070,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 scanRate The scan rate of the LiDAR (default is OB_LIDAR_SCAN_ANY, which selects the default scan rate).
* @param 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
@@ -88,7 +88,7 @@ public:
/**
* @brief Set the extrinsic parameters from current stream profile to the given target stream profile.
*
*
* @tparam target Target stream profile.
* @tparam extrinsic The extrinsic.
*/
@@ -100,7 +100,7 @@ public:
/**
* @brief Set the extrinsic parameters from current stream profile to the given target stream type.
*
*
* @tparam targetStreamType Target stream type.
* @tparam extrinsic The extrinsic.
*/
@@ -378,6 +378,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:
@@ -392,6 +410,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;
}
@@ -416,6 +436,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);
@@ -511,6 +533,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 scanRate The scan rate of LiDAR. Pass OB_LIDAR_SCAN_ANY if no matching condition is required.
* @param 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 {
@@ -83,6 +83,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.
*
@@ -140,4 +150,3 @@ public:
}
};
} // namespace ob