2023-09-08 08:55:16 +08:00
|
|
|
/*******************************************************************************
|
2024-04-07 15:30:59 +08:00
|
|
|
* Copyright (c) 2023 Orbbec 3D Technology, Inc
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*******************************************************************************/
|
2022-06-06 19:00:12 +08:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include <ostream>
|
|
|
|
|
#include <glog/logging.h>
|
|
|
|
|
#include <Eigen/Dense>
|
|
|
|
|
#include <tf2/LinearMath/Quaternion.h>
|
2022-06-08 10:21:57 +08:00
|
|
|
#include <rclcpp/rclcpp.hpp>
|
2022-06-06 19:00:12 +08:00
|
|
|
|
2022-06-08 14:51:00 +08:00
|
|
|
#include "libobsensor/ObSensor.hpp"
|
2022-06-06 19:00:12 +08:00
|
|
|
#include "sensor_msgs/distortion_models.hpp"
|
|
|
|
|
#include "sensor_msgs/msg/camera_info.hpp"
|
2022-06-08 14:51:00 +08:00
|
|
|
#include "orbbec_camera_msgs/msg/extrinsics.hpp"
|
2023-02-06 17:26:10 +08:00
|
|
|
#include "magic_enum/magic_enum.hpp"
|
2023-09-07 16:09:35 +08:00
|
|
|
#include <sensor_msgs/msg/point_cloud2.hpp>
|
2022-06-06 19:00:12 +08:00
|
|
|
|
|
|
|
|
namespace orbbec_camera {
|
|
|
|
|
sensor_msgs::msg::CameraInfo convertToCameraInfo(OBCameraIntrinsic intrinsic,
|
2022-12-28 16:39:11 +08:00
|
|
|
OBCameraDistortion distortion, int width);
|
2022-06-06 19:00:12 +08:00
|
|
|
|
2023-02-20 13:58:37 +08:00
|
|
|
void saveRGBPointsToPly(const std::shared_ptr<ob::Frame>& frame, const std::string& fileName);
|
2022-06-06 19:00:12 +08:00
|
|
|
|
2024-04-07 15:30:59 +08:00
|
|
|
void saveRGBPointCloudMsgToPly(const sensor_msgs::msg::PointCloud2& msg,
|
|
|
|
|
const std::string& fileName);
|
2023-09-15 16:54:30 +08:00
|
|
|
|
|
|
|
|
void saveDepthPointsToPly(const sensor_msgs::msg::PointCloud2& msg, const std::string& fileName);
|
2023-09-07 16:09:35 +08:00
|
|
|
|
2023-02-20 13:58:37 +08:00
|
|
|
void savePointsToPly(const std::shared_ptr<ob::Frame>& frame, const std::string& fileName);
|
2022-06-06 19:00:12 +08:00
|
|
|
|
|
|
|
|
tf2::Quaternion rotationMatrixToQuaternion(const float rotation[9]);
|
|
|
|
|
|
|
|
|
|
std::ostream& operator<<(std::ostream& os, const OBCameraParam& rhs);
|
|
|
|
|
|
|
|
|
|
orbbec_camera_msgs::msg::Extrinsics obExtrinsicsToMsg(const OBD2CTransform& extrinsics,
|
|
|
|
|
const std::string& frame_id);
|
|
|
|
|
|
2024-03-15 10:24:38 +08:00
|
|
|
rclcpp::Time fromMsToROSTime(uint64_t ms);
|
|
|
|
|
|
|
|
|
|
rclcpp::Time fromUsToROSTime(uint64_t us);
|
2022-06-08 10:21:57 +08:00
|
|
|
|
2022-06-09 15:47:02 +08:00
|
|
|
std::string getObSDKVersion();
|
|
|
|
|
|
2022-06-24 14:08:31 +08:00
|
|
|
OBFormat OBFormatFromString(const std::string& format);
|
|
|
|
|
|
2022-12-28 13:55:26 +08:00
|
|
|
std::string ObDeviceTypeToString(const OBDeviceType& type);
|
|
|
|
|
|
2023-02-06 17:26:10 +08:00
|
|
|
rmw_qos_profile_t getRMWQosProfileFromString(const std::string& str_qos);
|
|
|
|
|
|
2023-03-02 20:15:01 +08:00
|
|
|
bool isOpenNIDevice(int pid);
|
|
|
|
|
|
2023-03-20 11:18:59 +08:00
|
|
|
OB_DEPTH_PRECISION_LEVEL depthPrecisionLevelFromString(
|
|
|
|
|
const std::string& depth_precision_level_str);
|
|
|
|
|
|
2024-05-06 10:34:19 +08:00
|
|
|
float depthPrecisionFromString(const std::string& depth_precision_level_str);
|
2024-04-15 09:59:56 +08:00
|
|
|
|
2023-09-05 17:59:19 +08:00
|
|
|
OBMultiDeviceSyncMode OBSyncModeFromString(const std::string& mode);
|
2023-03-20 11:18:59 +08:00
|
|
|
|
2023-04-28 09:44:16 +08:00
|
|
|
OB_SAMPLE_RATE sampleRateFromString(std::string& sample_rate);
|
|
|
|
|
|
2023-09-07 16:09:35 +08:00
|
|
|
std::string sampleRateToString(const OB_SAMPLE_RATE& sample_rate);
|
2023-08-23 17:14:08 +08:00
|
|
|
|
2023-04-28 09:44:16 +08:00
|
|
|
OB_GYRO_FULL_SCALE_RANGE fullGyroScaleRangeFromString(std::string& full_scale_range);
|
|
|
|
|
|
2023-09-07 16:09:35 +08:00
|
|
|
std::string fullGyroScaleRangeToString(const OB_GYRO_FULL_SCALE_RANGE& full_scale_range);
|
2023-08-23 17:14:08 +08:00
|
|
|
|
2023-04-28 09:44:16 +08:00
|
|
|
OBAccelFullScaleRange fullAccelScaleRangeFromString(std::string& full_scale_range);
|
|
|
|
|
|
2023-09-07 16:09:35 +08:00
|
|
|
std::string fullAccelScaleRangeToString(const OBAccelFullScaleRange& full_scale_range);
|
2023-08-23 17:14:08 +08:00
|
|
|
|
2023-07-05 15:00:34 +08:00
|
|
|
std::string parseUsbPort(const std::string& line);
|
|
|
|
|
|
2023-09-07 20:55:25 +08:00
|
|
|
bool isValidJPEG(const std::shared_ptr<ob::ColorFrame>& frame);
|
|
|
|
|
|
2024-04-07 15:30:59 +08:00
|
|
|
std::string metaDataTypeToString(const OBFrameMetadataType& meta_data_type);
|
|
|
|
|
|
|
|
|
|
OBHoleFillingMode holeFillingModeFromString(const std::string& hole_filling_mode);
|
2024-03-15 10:24:38 +08:00
|
|
|
|
2024-04-15 09:59:56 +08:00
|
|
|
bool isGemini2R(int pid);
|
|
|
|
|
|
2024-05-06 10:34:19 +08:00
|
|
|
OBStreamType obStreamTypeFromString(const std::string& stream_type);
|
|
|
|
|
|
2022-06-06 19:00:12 +08:00
|
|
|
} // namespace orbbec_camera
|