diff --git a/orbbec_camera/SDK/include/libobsensor/h/Export.h b/orbbec_camera/SDK/include/libobsensor/h/Export.h index a8fb41f0..39f16341 100644 --- a/orbbec_camera/SDK/include/libobsensor/h/Export.h +++ b/orbbec_camera/SDK/include/libobsensor/h/Export.h @@ -33,7 +33,6 @@ # define OB_DEPRECATED_NO_EXPORT OB_NO_EXPORT OB_DEPRECATED #endif -/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef OB_NO_DEPRECATED # define OB_NO_DEPRECATED diff --git a/orbbec_camera/SDK/include/libobsensor/h/ObTypes.h b/orbbec_camera/SDK/include/libobsensor/h/ObTypes.h index ab6ae321..b98df92a 100644 --- a/orbbec_camera/SDK/include/libobsensor/h/ObTypes.h +++ b/orbbec_camera/SDK/include/libobsensor/h/ObTypes.h @@ -50,6 +50,7 @@ typedef struct ob_device_frame_interleave_list_t ob_device_frame_interleave_list #define OB_ACCEL_SAMPLE_RATE_ANY OB_SAMPLE_RATE_UNKNOWN #define OB_GYRO_FULL_SCALE_RANGE_ANY OB_GYRO_FS_UNKNOWN #define OB_GYRO_SAMPLE_RATE_ANY OB_SAMPLE_RATE_UNKNOWN +#define OB_LIDAR_SCAN_ANY OB_LIDAR_SCAN_UNKNOWN /** * @brief maximum path length @@ -134,6 +135,7 @@ typedef enum { OB_SENSOR_IR_LEFT = 6, /**< left IR for stereo camera*/ OB_SENSOR_IR_RIGHT = 7, /**< Right IR for stereo camera*/ OB_SENSOR_RAW_PHASE = 8, /**< Raw Phase */ + OB_SENSOR_LIDAR = 9, /**< LiDAR */ OB_SENSOR_TYPE_COUNT, /**The total number of sensor types, is not a valid sensor type */ } OBSensorType, ob_sensor_type; @@ -152,6 +154,7 @@ typedef enum { OB_STREAM_IR_LEFT = 6, /**< Left IR stream for stereo camera */ OB_STREAM_IR_RIGHT = 7, /**< Right IR stream for stereo camera */ OB_STREAM_RAW_PHASE = 8, /**< RawPhase Stream */ + OB_STREAM_LIDAR = 9, /**< LiDAR Stream for LiDAR device*/ OB_STREAM_TYPE_COUNT, /**< The total number of stream type,is not a valid stream type */ } OBStreamType, ob_stream_type; @@ -160,19 +163,20 @@ typedef enum { * @brief Enumeration value describing the type of frame */ typedef enum { - OB_FRAME_UNKNOWN = -1, /**< Unknown frame type */ - OB_FRAME_VIDEO = 0, /**< Video frame */ - OB_FRAME_IR = 1, /**< IR frame */ - OB_FRAME_COLOR = 2, /**< Color frame */ - OB_FRAME_DEPTH = 3, /**< Depth frame */ - OB_FRAME_ACCEL = 4, /**< Accelerometer data frame */ - OB_FRAME_SET = 5, /**< Frame collection (internally contains a variety of data frames) */ - OB_FRAME_POINTS = 6, /**< Point cloud frame */ - OB_FRAME_GYRO = 7, /**< Gyroscope data frame */ - OB_FRAME_IR_LEFT = 8, /**< Left IR frame for stereo camera */ - OB_FRAME_IR_RIGHT = 9, /**< Right IR frame for stereo camera */ - OB_FRAME_RAW_PHASE = 10, /**< Raw Phase frame*/ - OB_FRAME_TYPE_COUNT, /**< The total number of frame types, is not a valid frame type */ + OB_FRAME_UNKNOWN = -1, /**< Unknown frame type */ + OB_FRAME_VIDEO = 0, /**< Video frame */ + OB_FRAME_IR = 1, /**< IR frame */ + OB_FRAME_COLOR = 2, /**< Color frame */ + OB_FRAME_DEPTH = 3, /**< Depth frame */ + OB_FRAME_ACCEL = 4, /**< Accelerometer data frame */ + OB_FRAME_SET = 5, /**< Frame collection (internally contains a variety of data frames) */ + OB_FRAME_POINTS = 6, /**< Point cloud frame */ + OB_FRAME_GYRO = 7, /**< Gyroscope data frame */ + OB_FRAME_IR_LEFT = 8, /**< Left IR frame for stereo camera */ + OB_FRAME_IR_RIGHT = 9, /**< Right IR frame for stereo camera */ + OB_FRAME_RAW_PHASE = 10, /**< Raw Phase frame*/ + OB_FRAME_LIDAR_POINTS = 11, /**< LiDAR point3d cloud frame*/ + OB_FRAME_TYPE_COUNT, /**< The total number of frame types, is not a valid frame type */ } OBFrameType, ob_frame_type; @@ -193,40 +197,44 @@ typedef enum { * @brief Enumeration value describing the pixel format */ typedef enum { - OB_FORMAT_UNKNOWN = -1, /**< unknown format */ - OB_FORMAT_YUYV = 0, /**< YUYV format */ - OB_FORMAT_YUY2 = 1, /**< YUY2 format (the actual format is the same as YUYV) */ - OB_FORMAT_UYVY = 2, /**< UYVY format */ - OB_FORMAT_NV12 = 3, /**< NV12 format */ - OB_FORMAT_NV21 = 4, /**< NV21 format */ - OB_FORMAT_MJPG = 5, /**< MJPEG encoding format */ - OB_FORMAT_H264 = 6, /**< H.264 encoding format */ - OB_FORMAT_H265 = 7, /**< H.265 encoding format */ - OB_FORMAT_Y16 = 8, /**< Y16 format, 16-bit per pixel, single-channel*/ - OB_FORMAT_Y8 = 9, /**< Y8 format, 8-bit per pixel, single-channel */ - OB_FORMAT_Y10 = 10, /**< Y10 format, 10-bit per pixel, single-channel(SDK will unpack into Y16 by default) */ - OB_FORMAT_Y11 = 11, /**< Y11 format, 11-bit per pixel, single-channel (SDK will unpack into Y16 by default) */ - OB_FORMAT_Y12 = 12, /**< Y12 format, 12-bit per pixel, single-channel(SDK will unpack into Y16 by default) */ - OB_FORMAT_GRAY = 13, /**< GRAY (the actual format is the same as YUYV) */ - OB_FORMAT_HEVC = 14, /**< HEVC encoding format (the actual format is the same as H265) */ - OB_FORMAT_I420 = 15, /**< I420 format */ - OB_FORMAT_ACCEL = 16, /**< Acceleration data format */ - OB_FORMAT_GYRO = 17, /**< Gyroscope data format */ - OB_FORMAT_POINT = 19, /**< XYZ 3D coordinate point format, @ref OBPoint */ - OB_FORMAT_RGB_POINT = 20, /**< XYZ 3D coordinate point format with RGB information, @ref OBColorPoint */ - OB_FORMAT_RLE = 21, /**< RLE pressure test format (SDK will be unpacked into Y16 by default) */ - OB_FORMAT_RGB = 22, /**< RGB format (actual RGB888) */ - OB_FORMAT_BGR = 23, /**< BGR format (actual BGR888) */ - OB_FORMAT_Y14 = 24, /**< Y14 format, 14-bit per pixel, single-channel (SDK will unpack into Y16 by default) */ - OB_FORMAT_BGRA = 25, /**< BGRA format */ - OB_FORMAT_COMPRESSED = 26, /**< Compression format */ - OB_FORMAT_RVL = 27, /**< RVL pressure test format (SDK will be unpacked into Y16 by default) */ - OB_FORMAT_Z16 = 28, /**< Is same as Y16*/ - OB_FORMAT_YV12 = 29, /**< Is same as Y12, using for right ir stream*/ - OB_FORMAT_BA81 = 30, /**< Is same as Y8, using for right ir stream*/ - OB_FORMAT_RGBA = 31, /**< RGBA format */ - OB_FORMAT_BYR2 = 32, /**< byr2 format */ - OB_FORMAT_RW16 = 33, /**< RAW16 format */ + OB_FORMAT_UNKNOWN = -1, /**< unknown format */ + OB_FORMAT_YUYV = 0, /**< YUYV format */ + OB_FORMAT_YUY2 = 1, /**< YUY2 format (the actual format is the same as YUYV) */ + OB_FORMAT_UYVY = 2, /**< UYVY format */ + OB_FORMAT_NV12 = 3, /**< NV12 format */ + OB_FORMAT_NV21 = 4, /**< NV21 format */ + OB_FORMAT_MJPG = 5, /**< MJPEG encoding format */ + OB_FORMAT_H264 = 6, /**< H.264 encoding format */ + OB_FORMAT_H265 = 7, /**< H.265 encoding format */ + OB_FORMAT_Y16 = 8, /**< Y16 format, 16-bit per pixel, single-channel*/ + OB_FORMAT_Y8 = 9, /**< Y8 format, 8-bit per pixel, single-channel */ + OB_FORMAT_Y10 = 10, /**< Y10 format, 10-bit per pixel, single-channel(SDK will unpack into Y16 by default) */ + OB_FORMAT_Y11 = 11, /**< Y11 format, 11-bit per pixel, single-channel (SDK will unpack into Y16 by default) */ + OB_FORMAT_Y12 = 12, /**< Y12 format, 12-bit per pixel, single-channel(SDK will unpack into Y16 by default) */ + OB_FORMAT_GRAY = 13, /**< GRAY (the actual format is the same as YUYV) */ + OB_FORMAT_HEVC = 14, /**< HEVC encoding format (the actual format is the same as H265) */ + OB_FORMAT_I420 = 15, /**< I420 format */ + OB_FORMAT_ACCEL = 16, /**< Acceleration data format */ + OB_FORMAT_GYRO = 17, /**< Gyroscope data format */ + OB_FORMAT_POINT = 19, /**< XYZ 3D coordinate point format, @ref OBPoint */ + OB_FORMAT_RGB_POINT = 20, /**< XYZ 3D coordinate point format with RGB information, @ref OBColorPoint */ + OB_FORMAT_RLE = 21, /**< RLE pressure test format (SDK will be unpacked into Y16 by default) */ + OB_FORMAT_RGB = 22, /**< RGB format (actual RGB888) */ + OB_FORMAT_BGR = 23, /**< BGR format (actual BGR888) */ + OB_FORMAT_Y14 = 24, /**< Y14 format, 14-bit per pixel, single-channel (SDK will unpack into Y16 by default) */ + OB_FORMAT_BGRA = 25, /**< BGRA format */ + OB_FORMAT_COMPRESSED = 26, /**< Compression format */ + OB_FORMAT_RVL = 27, /**< RVL pressure test format (SDK will be unpacked into Y16 by default) */ + OB_FORMAT_Z16 = 28, /**< Is same as Y16*/ + OB_FORMAT_YV12 = 29, /**< Is same as Y12, using for right ir stream*/ + OB_FORMAT_BA81 = 30, /**< Is same as Y8, using for right ir stream*/ + OB_FORMAT_RGBA = 31, /**< RGBA format */ + OB_FORMAT_BYR2 = 32, /**< byr2 format */ + OB_FORMAT_RW16 = 33, /**< RAW16 format */ + OB_FORMAT_LIDAR_POINT = 34, /**< XYZ 3D coordinate point format with LiDAR information, @ref OBLiDARPoint */ + OB_FORMAT_LIDAR_SPHERE_POINT = 35, /**< XYZ 3D coordinate point format with LiDAR information, @ref OBLiDARSpherePoint */ + OB_FORMAT_LIDAR_SCAN = 36, /**< LiDAR single-line scan mode data format, @ref OBLiDARScanPoint */ + OB_FORMAT_LIDAR_CALIBRATION = 37, /**< LiDAR calibration mode point format */ } OBFormat, ob_format; @@ -629,6 +637,20 @@ typedef struct { float z; ///< Z-direction component } OBAccelValue, OBGyroValue, OBFloat3D, ob_accel_value, ob_gyro_value, ob_float_3d; +/** + * @brief Data structures for LiDAR scan rate + */ +typedef enum { + OB_LIDAR_SCAN_UNKNOWN = 0, + OB_LIDAR_SCAN_5HZ = 1, + OB_LIDAR_SCAN_10HZ = 2, + OB_LIDAR_SCAN_15HZ = 3, + OB_LIDAR_SCAN_20HZ = 4, + OB_LIDAR_SCAN_25HZ = 5, + OB_LIDAR_SCAN_30HZ = 6, +} OBLiDARScanRate, + ob_lidar_scan_rate, OB_LIDAR_SCAN_RATE; + /** * @brief Device state */ @@ -786,6 +808,37 @@ typedef struct { float b; ///< Blue channel component } OBColorPoint, ob_color_point; +/** + * @brief 3D point structure with LiDAR information + */ +typedef struct { + float angle; ///< angle, unit: degrees + float distance; ///< distance, unit: mm + uint16_t intensity; ///< intensity, 0~2000 +} OBLiDARScanPoint, ob_lidar_scan_point; + +/** + * @brief 3D point structure with LiDAR information + */ +typedef struct { + float x; ///< X coordinate, unit mm + float y; ///< Y coordinate, unit mm + float z; ///< Z coordinate, unit mm + uint8_t reflectivity; ///< reflectivity + uint8_t tag; ///< point state +} OBLiDARPoint, ob_lidar_point; + +/** + * @brief 3D point structure with LiDAR information + */ +typedef struct { + float distance; ///< distance, unit: mm + float theta; ///< azimuth angle, unit: degrees + float phi; ///< zenith angle, unit: degrees + uint8_t reflectivity; ///< reflectivity + uint8_t tag; ///< tag +} OBLiDARSpherePoint, ob_lidar_sphere_point; + /** * @brief Compression mode */ diff --git a/orbbec_camera/SDK/include/libobsensor/h/Pipeline.h b/orbbec_camera/SDK/include/libobsensor/h/Pipeline.h index c670748f..8913ef7e 100644 --- a/orbbec_camera/SDK/include/libobsensor/h/Pipeline.h +++ b/orbbec_camera/SDK/include/libobsensor/h/Pipeline.h @@ -236,6 +236,16 @@ OB_EXPORT void ob_config_enable_accel_stream(ob_config *config, ob_accel_full_sc */ OB_EXPORT void ob_config_enable_gyro_stream(ob_config *config, ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error); +/** + * @brief Enable LiDAR stream with specified parameters + * + * @param config[in] The pipeline configuration object + * @param scan_rate[in] The scan rate of LiDAR + * @param format[in] The format of the LiDAR stream + * @param error[out] Pointer to an error object that will be set if an error occurs. + */ +OB_EXPORT void ob_config_enable_lidar_stream(ob_config *config, ob_lidar_scan_rate scan_rate, ob_format format, ob_error **error); + /** * @brief Get the enabled stream profile list in the pipeline configuration * @@ -332,4 +342,3 @@ OB_EXPORT ob_calibration_param ob_pipeline_get_calibration_param(ob_pipeline *pi #ifdef __cplusplus } #endif - diff --git a/orbbec_camera/SDK/include/libobsensor/h/Property.h b/orbbec_camera/SDK/include/libobsensor/h/Property.h index bc0a671b..6f57d94e 100644 --- a/orbbec_camera/SDK/include/libobsensor/h/Property.h +++ b/orbbec_camera/SDK/include/libobsensor/h/Property.h @@ -828,6 +828,176 @@ typedef enum { * @brief Confidence degree */ OB_PROP_DEBUG_ESGM_CONFIDENCE_FLOAT = 5013, + + /** + * @brief LiDAR: set/get IP address + */ + OB_RAW_DATA_LIDAR_IP_ADDRESS = 8000, + + /** + * @brief LiDAR: set/get port + */ + OB_PROP_LIDAR_PORT_INT = 8001, + + /** + * @brief LiDAR: set/get MAC address + */ + OB_RAW_DATA_LIDAR_MAC_ADDRESS = 8002, + + /** + * @brief LiDAR: set/get subnet mask + */ + OB_RAW_DATA_LIDAR_SUBNET_MASK = 8003, + + /** + * @brief LiDAR: set/get scan speed + */ + OB_PROP_LIDAR_SCAN_SPEED_INT = 8004, + + /** + * @brief LiDAR: set/get scan direction + */ + OB_PROP_LIDAR_SCAN_DIRECTION_INT = 8005, + + /** + * @brief LiDAR: set/get transfer protocol + */ + OB_PROP_LIDAR_TRANSFER_PROTOCOL_INT = 8006, + + /** + * @brief LiDAR: set/get transfer protocol + */ + OB_PROP_LIDAR_WORK_MODE_INT = 8007, + + /** + * @brief LiDAR: initiate device connection + */ + OB_PROP_LIDAR_INITIATE_DEVICE_CONNECTION_INT = 8008, + + /** + * @brief LiDAR: set/get serial number + */ + OB_RAW_DATA_LIDAR_SERIAL_NUMBER = 8009, + + /** + * @brief LiDAR: set/get echo mode + */ + OB_PROP_LIDAR_ECHO_MODE_INT = 8010, + + /** + * @brief LiDAR: apply configs + */ + OB_PROP_LIDAR_APPLY_CONFIGS_INT = 8011, + + /** + * @brief LiDAR: set/get tail filter level + */ + OB_PROP_LIDAR_TAIL_FILTER_LEVEL_INT = 8012, + + /** + * @brief LiDAR: set/get mems fov size + */ + OB_PROP_LIDAR_MEMS_FOV_SIZE_FLOAT = 8013, + + /** + * @brief LiDAR: set/get mems frequency + */ + OB_PROP_LIDAR_MEMS_FRENQUENCY_FLOAT = 8014, + + /** + * @brief LiDAR: set / get mems fov factor + */ + OB_PROP_LIDAR_MEMS_FOV_FACTOR_FLOAT = 8015, + + /** + * @brief LiDAR: mems on/off + */ + OB_PROP_LIDAR_MEMS_ON_OFF_INT = 8016, + + /** + * @brief LiDAR: restart mems + */ + OB_PROP_LIDAR_RESTART_MEMS_INT = 8017, + + /** + * @brief LiDAR: save mems param + */ + OB_PROP_LIDAR_SAVE_MEMS_PARAM_INT = 8018, + + /** + * @brief LiDAR: get product model + */ + OB_RAW_DATA_LIDAR_PRODUCT_MODEL = 8019, + + /** + * @brief LiDAR: get firmware version + */ + OB_RAW_DATA_LIDAR_FIRMWARE_VERSION = 8020, + + /** + * @brief LiDAR: get fpga version + */ + OB_RAW_DATA_LIDAR_FPGA_VERSION = 8021, + + /** + * @brief LiDAR: get status info + */ + OB_STRUCT_LIDAR_STATUS_INFO = 8022, + + /** + * @brief LiDAR: get warning info + */ + OB_PROP_LIDAR_WARNING_INFO_INT = 8023, + + /** + * @brief LiDAR: get realtime motor spin speed + */ + OB_PROP_LIDAR_MOTOR_SPIN_SPEED_INT = 8024, + + /** + * @brief LiDAR: get mcu temperature + */ + OB_PROP_LIDAR_MCU_TEMPERATURE_FLOAT = 8025, + + /** + * @brief LiDAR: get fpga temperature + */ + OB_PROP_LIDAR_FPGA_TEMPERATURE_FLOAT = 8026, + + /** + * @brief LiDAR: get motor version + */ + OB_RAW_DATA_LIDAR_MOTOR_VERSION = 8027, + + /** + * @brief LiDAR: get apd high voltage + */ + OB_PROP_LIDAR_APD_HIGH_VOLTAGE_FLOAT = 8028, + + /** + * @brief LiDAR: get apd temperature + */ + OB_PROP_LIDAR_APD_TEMPERATURE_FLOAT = 8029, + + /** + * @brief LiDAR: get tx high power voltage + */ + OB_PROP_LIDAR_TX_HIGH_POWER_VOLTAGE_FLOAT = 8030, + + /** + * @brief LiDAR: get tx lower power voltage + */ + OB_PROP_LIDAR_TX_LOWER_POWER_VOLTAGE_FLOAT = 8031, + + /** + * @brief LiDAR: get mems version + */ + OB_RAW_DATA_LIDAR_MEMS_VERSION = 8032, + + /** + * @brief LiDAR: get/set specific mode + */ + OB_PROP_LIDAR_SPECIFIC_MODE = 8033, } OBPropertyID, ob_property_id; diff --git a/orbbec_camera/SDK/include/libobsensor/h/StreamProfile.h b/orbbec_camera/SDK/include/libobsensor/h/StreamProfile.h index 98e5ad19..397c47cc 100644 --- a/orbbec_camera/SDK/include/libobsensor/h/StreamProfile.h +++ b/orbbec_camera/SDK/include/libobsensor/h/StreamProfile.h @@ -56,6 +56,16 @@ OB_EXPORT ob_stream_profile *ob_create_accel_stream_profile(ob_accel_full_scale_ */ OB_EXPORT ob_stream_profile *ob_create_gyro_stream_profile(ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error); +/** + * @brief Create a LiDAR stream profile object + * + * @param[in] scan_rate The scan rate of LiDAR + * @param[in] format The format of the LiDAR stream + * @param[out] error Pointer to an error object that will be set if an error occurs. + * @return ob_stream_profile* return the accel stream profile object + */ +OB_EXPORT ob_stream_profile *ob_create_lidar_stream_profile(ob_lidar_scan_rate scan_rate, ob_format format, ob_error **error); + /** * @brief Copy the stream profile object from an other stream profile object * @@ -322,6 +332,15 @@ OB_EXPORT ob_gyro_intrinsic ob_gyro_stream_get_intrinsic(const ob_stream_profile */ OB_EXPORT void ob_gyro_stream_set_intrinsic(ob_stream_profile *profile, ob_gyro_intrinsic intrinsic, ob_error **error); +/** + * @brief Get the scan rate of the LiDAR stream. + * + * @param[in] profile Stream profile object. If the profile is not for the LiDAR stream, an error will be returned. + * @param[out] error Pointer to an error object that will be set if an error occurs. + * @return The scan rate of the LiDAR stream. + */ +OB_EXPORT ob_lidar_scan_rate ob_lidar_stream_profile_get_scan_rate(const ob_stream_profile *profile, ob_error **error); + /** * @brief Get the number of StreamProfile lists. * @@ -392,6 +411,21 @@ OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_gyro_stream_profile(cons ob_gyro_full_scale_range full_scale_range, ob_gyro_sample_rate sample_rate, ob_error **error); +/** + * @brief Match the corresponding ob_stream_profile through the passed parameters. If there are multiple matches, + * the first one in the list will be returned by default. If no matched profile is found, an error will be returned. + * + * @attention The stream profile returned by this function should be deleted by calling @ref ob_delete_stream_profile() when it is no longer needed. + * + * @param[in] profile_list Resolution list. + * @param scan_rate[in] The scan rate of LiDAR. If you don't need to add matching conditions, you can pass OB_LIDAR_SCAN_ANY. + * @param format[in] The format of the LiDAR stream. If you don't need to add matching conditions, you can pass OB_FORMAT_ANY. + * @param[out] error Pointer to an error object that will be set if an error occurs. + * @return The matching profile. + */ +OB_EXPORT ob_stream_profile *ob_stream_profile_list_get_lidar_stream_profile(const ob_stream_profile_list *profile_list, ob_lidar_scan_rate scan_rate, + ob_format format, ob_error **error); + /** * @brief Delete the stream profile list. * diff --git a/orbbec_camera/SDK/include/libobsensor/h/TypeHelper.h b/orbbec_camera/SDK/include/libobsensor/h/TypeHelper.h index c71328f1..4b371b73 100644 --- a/orbbec_camera/SDK/include/libobsensor/h/TypeHelper.h +++ b/orbbec_camera/SDK/include/libobsensor/h/TypeHelper.h @@ -65,6 +65,14 @@ OB_EXPORT const char* ob_gyro_range_type_to_string(OBGyroFullScaleRange type); */ OB_EXPORT const char* ob_accel_range_type_to_string(OBAccelFullScaleRange type); +/** + * @brief Convert OBLiDARScanRate to " char* " type and then return. + * + * @param[in] type OBLiDARScanRate type. + * @return OBLiDARScanRate of "char*" type. + */ +OB_EXPORT const char *ob_lidar_scan_rate_type_to_string(OBLiDARScanRate type); + /** * @brief Convert OBFrameMetadataType to " char* " type and then return. * diff --git a/orbbec_camera/SDK/include/libobsensor/hpp/Frame.hpp b/orbbec_camera/SDK/include/libobsensor/hpp/Frame.hpp index ea5a8763..cabdebec 100644 --- a/orbbec_camera/SDK/include/libobsensor/hpp/Frame.hpp +++ b/orbbec_camera/SDK/include/libobsensor/hpp/Frame.hpp @@ -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 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: diff --git a/orbbec_camera/SDK/include/libobsensor/hpp/Pipeline.hpp b/orbbec_camera/SDK/include/libobsensor/hpp/Pipeline.hpp index 61009f1f..b72ee0e4 100644 --- a/orbbec_camera/SDK/include/libobsensor/hpp/Pipeline.hpp +++ b/orbbec_camera/SDK/include/libobsensor/hpp/Pipeline.hpp @@ -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) instead * @brief Enable all streams to be used in the pipeline diff --git a/orbbec_camera/SDK/include/libobsensor/hpp/StreamProfile.hpp b/orbbec_camera/SDK/include/libobsensor/hpp/StreamProfile.hpp index 84528507..711c2b69 100644 --- a/orbbec_camera/SDK/include/libobsensor/hpp/StreamProfile.hpp +++ b/orbbec_camera/SDK/include/libobsensor/hpp/StreamProfile.hpp @@ -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 bool StreamProfile::is() const { switch(this->getType()) { case OB_STREAM_VIDEO: @@ -392,6 +410,8 @@ template 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(impl); case OB_STREAM_GYRO: return std::make_shared(impl); + case OB_STREAM_LIDAR: + return std::make_shared(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(); } + /** + * @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 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(); + } + public: // The following interfaces are deprecated and are retained here for compatibility purposes. uint32_t count() const { diff --git a/orbbec_camera/SDK/include/libobsensor/hpp/TypeHelper.hpp b/orbbec_camera/SDK/include/libobsensor/hpp/TypeHelper.hpp index b35efece..e9e6581d 100644 --- a/orbbec_camera/SDK/include/libobsensor/hpp/TypeHelper.hpp +++ b/orbbec_camera/SDK/include/libobsensor/hpp/TypeHelper.hpp @@ -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 - diff --git a/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig-release.cmake b/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig-release.cmake index 5d7a67f8..456ac71a 100644 --- a/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig-release.cmake +++ b/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig-release.cmake @@ -12,8 +12,8 @@ set_target_properties(ob::OrbbecSDK PROPERTIES IMPORTED_SONAME_RELEASE "libOrbbecSDK.so.2" ) -list(APPEND _cmake_import_check_targets ob::OrbbecSDK ) -list(APPEND _cmake_import_check_files_for_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.3" ) +list(APPEND _IMPORT_CHECK_TARGETS ob::OrbbecSDK ) +list(APPEND _IMPORT_CHECK_FILES_FOR_ob::OrbbecSDK "${_IMPORT_PREFIX}/lib/libOrbbecSDK.so.2.4.3" ) # Commands beyond this point should not need to know the version. set(CMAKE_IMPORT_FILE_VERSION) diff --git a/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig.cmake b/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig.cmake index 6a35f679..163ea8af 100644 --- a/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig.cmake +++ b/orbbec_camera/SDK/lib/x64/OrbbecSDKConfig.cmake @@ -1,13 +1,10 @@ # Generated by CMake -if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8) - message(FATAL_ERROR "CMake >= 2.8.0 required") -endif() -if(CMAKE_VERSION VERSION_LESS "2.8.3") - message(FATAL_ERROR "CMake >= 2.8.3 required") +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.6) + message(FATAL_ERROR "CMake >= 2.6.0 required") endif() cmake_policy(PUSH) -cmake_policy(VERSION 2.8.3...3.28) +cmake_policy(VERSION 2.6...3.20) #---------------------------------------------------------------- # Generated CMake target import file. #---------------------------------------------------------------- @@ -16,34 +13,32 @@ cmake_policy(VERSION 2.8.3...3.28) set(CMAKE_IMPORT_FILE_VERSION 1) # Protect against multiple inclusion, which would fail when already imported targets are added once more. -set(_cmake_targets_defined "") -set(_cmake_targets_not_defined "") -set(_cmake_expected_targets "") -foreach(_cmake_expected_target IN ITEMS ob::OrbbecSDK) - list(APPEND _cmake_expected_targets "${_cmake_expected_target}") - if(TARGET "${_cmake_expected_target}") - list(APPEND _cmake_targets_defined "${_cmake_expected_target}") - else() - list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}") +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget ob::OrbbecSDK) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) endif() endforeach() -unset(_cmake_expected_target) -if(_cmake_targets_defined STREQUAL _cmake_expected_targets) - unset(_cmake_targets_defined) - unset(_cmake_targets_not_defined) - unset(_cmake_expected_targets) - unset(CMAKE_IMPORT_FILE_VERSION) +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) cmake_policy(POP) return() endif() -if(NOT _cmake_targets_defined STREQUAL "") - string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}") - string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}") - message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n") +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") endif() -unset(_cmake_targets_defined) -unset(_cmake_targets_not_defined) -unset(_cmake_expected_targets) +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) # Compute the installation prefix relative to this file. @@ -61,25 +56,21 @@ set_target_properties(ob::OrbbecSDK PROPERTIES ) # Load information for each installed configuration. -file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/OrbbecSDKConfig-*.cmake") -foreach(_cmake_config_file IN LISTS _cmake_config_files) - include("${_cmake_config_file}") +get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +file(GLOB CONFIG_FILES "${_DIR}/OrbbecSDKConfig-*.cmake") +foreach(f ${CONFIG_FILES}) + include(${f}) endforeach() -unset(_cmake_config_file) -unset(_cmake_config_files) # Cleanup temporary variables. set(_IMPORT_PREFIX) # Loop over all imported files and verify that they actually exist -foreach(_cmake_target IN LISTS _cmake_import_check_targets) - if(CMAKE_VERSION VERSION_LESS "3.28" - OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target} - OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}") - foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}") - if(NOT EXISTS "${_cmake_file}") - message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file - \"${_cmake_file}\" +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. @@ -87,14 +78,11 @@ but this file does not exist. Possible reasons include: \"${CMAKE_CURRENT_LIST_FILE}\" but not all the files it references. ") - endif() - endforeach() - endif() - unset(_cmake_file) - unset("_cmake_import_check_files_for_${_cmake_target}") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) endforeach() -unset(_cmake_target) -unset(_cmake_import_check_targets) +unset(_IMPORT_CHECK_TARGETS) # This file does not depend on other imported targets which have # been exported from the same project but in a separate export set. diff --git a/orbbec_camera/SDK/lib/x64/libOrbbecSDK.so.2.4.3 b/orbbec_camera/SDK/lib/x64/libOrbbecSDK.so.2.4.3 index 19b24d31..67a1106b 100644 Binary files a/orbbec_camera/SDK/lib/x64/libOrbbecSDK.so.2.4.3 and b/orbbec_camera/SDK/lib/x64/libOrbbecSDK.so.2.4.3 differ diff --git a/orbbec_camera/config/OrbbecSDKConfig_v2.0.xml b/orbbec_camera/config/OrbbecSDKConfig_v2.0.xml index 3ccab8e5..c78fed26 100644 --- a/orbbec_camera/config/OrbbecSDKConfig_v2.0.xml +++ b/orbbec_camera/config/OrbbecSDKConfig_v2.0.xml @@ -129,7 +129,7 @@ 100 - + 640 @@ -1200,7 +1200,7 @@ Y8 - + @@ -1217,12 +1217,12 @@ 100 - + false true - + 0