use pid adapter color format

This commit is contained in:
Joe Dong
2022-06-13 17:35:44 +08:00
parent 81c1d17536
commit b0563611ba
3 changed files with 13 additions and 4 deletions
@@ -88,6 +88,10 @@ const std::string DEFAULT_ALIGNED_DEPTH_TO_FISHEYE_FRAME_ID =
const std::string DEFAULT_UNITE_IMU_METHOD = ""; const std::string DEFAULT_UNITE_IMU_METHOD = "";
const std::string DEFAULT_FILTERS = ""; const std::string DEFAULT_FILTERS = "";
const std::string DEFAULT_TOPIC_ODOM_IN = ""; const std::string DEFAULT_TOPIC_ODOM_IN = "";
const std::string DEFAULT_D2C_MODE = "sw"; // sw = software mode, hw=hardware mode, none, const std::string DEFAULT_D2C_MODE = "sw"; // sw = software mode, hw=hardware mode, none,
const float ROS_DEPTH_SCALE = 0.001; const float ROS_DEPTH_SCALE = 0.001;
const int32_t FEMTO_PID = 0x0635;
const int32_t ASTRA_PLUS_PID = 0x0636;
} // namespace orbbec_camera } // namespace orbbec_camera
+1 -1
View File
@@ -14,7 +14,7 @@
enable_ir: false enable_ir: false
depth_width: 640 depth_width: 640
depth_height: 480 depth_height: 480
depth_fps: 25 depth_fps: 30
depth_frame_id: "depth_frame" depth_frame_id: "depth_frame"
depth_optical_frame_id: "depth_optical_frame" depth_optical_frame_id: "depth_optical_frame"
enable_depth: true enable_depth: true
+7 -2
View File
@@ -36,8 +36,11 @@ OBCameraNode::OBCameraNode(rclcpp::Node* node, std::shared_ptr<ob::Device> devic
encoding_[INFRA0] = sensor_msgs::image_encodings::MONO16; encoding_[INFRA0] = sensor_msgs::image_encodings::MONO16;
stream_name_[OB_STREAM_IR] = "ir"; stream_name_[OB_STREAM_IR] = "ir";
unit_step_size_[INFRA0] = sizeof(uint8_t); unit_step_size_[INFRA0] = sizeof(uint8_t);
if (device_->getDeviceInfo()->pid() == FEMTO_PID) {
format_[COLOR] = OB_FORMAT_YUYV; format_[COLOR] = OB_FORMAT_I420;
} else if (device_->getDeviceInfo()->pid() == ASTRA_PLUS_PID) {
format_[COLOR] = OB_FORMAT_YUYV;
}
image_format_[OB_STREAM_COLOR] = CV_8UC3; image_format_[OB_STREAM_COLOR] = CV_8UC3;
encoding_[COLOR] = sensor_msgs::image_encodings::BGR8; encoding_[COLOR] = sensor_msgs::image_encodings::BGR8;
stream_name_[OB_STREAM_COLOR] = "color"; stream_name_[OB_STREAM_COLOR] = "color";
@@ -523,6 +526,8 @@ void OBCameraNode::publishDynamicTransforms() {
bool OBCameraNode::rbgFormatConvertRGB888(std::shared_ptr<ob::ColorFrame> frame) { bool OBCameraNode::rbgFormatConvertRGB888(std::shared_ptr<ob::ColorFrame> frame) {
switch (frame->format()) { switch (frame->format()) {
case OB_FORMAT_RGB888:
return true;
case OB_FORMAT_I420: case OB_FORMAT_I420:
format_convert_filter_.setFormatConvertType(FORMAT_I420_TO_RGB888); format_convert_filter_.setFormatConvertType(FORMAT_I420_TO_RGB888);
break; break;