mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-10 14:39:49 +08:00
refactor: rename Gemini 301 series PID helper
This commit is contained in:
@@ -160,7 +160,7 @@ inline bool isGemini330SeriesPID(uint32_t pid) {
|
|||||||
pid == GEMINI_331L_PID;
|
pid == GEMINI_331L_PID;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isGemini305SeriesPID(uint32_t pid) {
|
inline bool isGemini301SeriesPID(uint32_t pid) {
|
||||||
return pid == GEMINI_305_PID || pid == GEMINI_305_PID2 || pid == GEMINI_305G_PID ||
|
return pid == GEMINI_305_PID || pid == GEMINI_305_PID2 || pid == GEMINI_305G_PID ||
|
||||||
pid == GEMINI_301G_PID || pid == GEMINI_309G_PID;
|
pid == GEMINI_301G_PID || pid == GEMINI_309G_PID;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3249,7 +3249,7 @@ void OBCameraNode::setupLeftIrPostProcessFilter() {
|
|||||||
}
|
}
|
||||||
auto device_info = device_->getDeviceInfo();
|
auto device_info = device_->getDeviceInfo();
|
||||||
CHECK_NOTNULL(device_info);
|
CHECK_NOTNULL(device_info);
|
||||||
if (isGemini330SeriesPID(pid_) || isGemini305SeriesPID(pid_)) {
|
if (isGemini330SeriesPID(pid_) || isGemini301SeriesPID(pid_)) {
|
||||||
auto left_ir_sensor = device_->getSensor(OB_SENSOR_IR_LEFT);
|
auto left_ir_sensor = device_->getSensor(OB_SENSOR_IR_LEFT);
|
||||||
left_ir_filter_list_ = left_ir_sensor->createRecommendedFilters();
|
left_ir_filter_list_ = left_ir_sensor->createRecommendedFilters();
|
||||||
if (left_ir_filter_list_.empty()) {
|
if (left_ir_filter_list_.empty()) {
|
||||||
@@ -3290,7 +3290,7 @@ void OBCameraNode::setupRightIrPostProcessFilter() {
|
|||||||
}
|
}
|
||||||
auto device_info = device_->getDeviceInfo();
|
auto device_info = device_->getDeviceInfo();
|
||||||
CHECK_NOTNULL(device_info);
|
CHECK_NOTNULL(device_info);
|
||||||
if (isGemini330SeriesPID(pid_) || isGemini305SeriesPID(pid_)) {
|
if (isGemini330SeriesPID(pid_) || isGemini301SeriesPID(pid_)) {
|
||||||
auto right_ir_sensor = device_->getSensor(OB_SENSOR_IR_RIGHT);
|
auto right_ir_sensor = device_->getSensor(OB_SENSOR_IR_RIGHT);
|
||||||
right_ir_filter_list_ = right_ir_sensor->createRecommendedFilters();
|
right_ir_filter_list_ = right_ir_sensor->createRecommendedFilters();
|
||||||
if (right_ir_filter_list_.empty()) {
|
if (right_ir_filter_list_.empty()) {
|
||||||
@@ -3620,19 +3620,19 @@ void OBCameraNode::setupProfiles() {
|
|||||||
format_[elem] == OB_FORMAT_UNKNOWN) {
|
format_[elem] == OB_FORMAT_UNKNOWN) {
|
||||||
selected_profile = profiles->getProfile(0)->as<ob::VideoStreamProfile>();
|
selected_profile = profiles->getProfile(0)->as<ob::VideoStreamProfile>();
|
||||||
} else {
|
} else {
|
||||||
if (isGemini305SeriesPID(pid_) && elem == DEPTH) {
|
if (isGemini301SeriesPID(pid_) && elem == DEPTH) {
|
||||||
OBHardwareDecimationConfig conf;
|
OBHardwareDecimationConfig conf;
|
||||||
conf.originWidth = width_[elem];
|
conf.originWidth = width_[elem];
|
||||||
conf.originHeight = height_[elem];
|
conf.originHeight = height_[elem];
|
||||||
conf.factor = depth_decimation_factor_;
|
conf.factor = depth_decimation_factor_;
|
||||||
selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]);
|
selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]);
|
||||||
} else if (isGemini305SeriesPID(pid_) && elem == INFRA1) {
|
} else if (isGemini301SeriesPID(pid_) && elem == INFRA1) {
|
||||||
OBHardwareDecimationConfig conf;
|
OBHardwareDecimationConfig conf;
|
||||||
conf.originWidth = width_[elem];
|
conf.originWidth = width_[elem];
|
||||||
conf.originHeight = height_[elem];
|
conf.originHeight = height_[elem];
|
||||||
conf.factor = left_ir_decimation_factor_;
|
conf.factor = left_ir_decimation_factor_;
|
||||||
selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]);
|
selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]);
|
||||||
} else if (isGemini305SeriesPID(pid_) && elem == INFRA2) {
|
} else if (isGemini301SeriesPID(pid_) && elem == INFRA2) {
|
||||||
OBHardwareDecimationConfig conf;
|
OBHardwareDecimationConfig conf;
|
||||||
conf.originWidth = width_[elem];
|
conf.originWidth = width_[elem];
|
||||||
conf.originHeight = height_[elem];
|
conf.originHeight = height_[elem];
|
||||||
@@ -3761,7 +3761,7 @@ void OBCameraNode::setupProfiles() {
|
|||||||
|
|
||||||
bool OBCameraNode::validate301SeriesStreamFrameRates(const std::map<stream_index_pair, int> &fps,
|
bool OBCameraNode::validate301SeriesStreamFrameRates(const std::map<stream_index_pair, int> &fps,
|
||||||
std::string &message) const {
|
std::string &message) const {
|
||||||
if (!isGemini305SeriesPID(pid_)) {
|
if (!isGemini301SeriesPID(pid_)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3823,19 +3823,19 @@ std::shared_ptr<ob::VideoStreamProfile> OBCameraNode::selectVideoStreamProfile(
|
|||||||
std::shared_ptr<ob::VideoStreamProfile> selected_profile;
|
std::shared_ptr<ob::VideoStreamProfile> selected_profile;
|
||||||
if (width == 0 && height == 0 && fps == 0) {
|
if (width == 0 && height == 0 && fps == 0) {
|
||||||
selected_profile = profiles->getProfile(0)->as<ob::VideoStreamProfile>();
|
selected_profile = profiles->getProfile(0)->as<ob::VideoStreamProfile>();
|
||||||
} else if (!is_playback_device_ && isGemini305SeriesPID(pid_) && stream_index == DEPTH) {
|
} else if (!is_playback_device_ && isGemini301SeriesPID(pid_) && stream_index == DEPTH) {
|
||||||
OBHardwareDecimationConfig conf;
|
OBHardwareDecimationConfig conf;
|
||||||
conf.originWidth = width;
|
conf.originWidth = width;
|
||||||
conf.originHeight = height;
|
conf.originHeight = height;
|
||||||
conf.factor = depth_decimation_factor_;
|
conf.factor = depth_decimation_factor_;
|
||||||
selected_profile = profiles->getVideoStreamProfile(conf, format, fps);
|
selected_profile = profiles->getVideoStreamProfile(conf, format, fps);
|
||||||
} else if (!is_playback_device_ && isGemini305SeriesPID(pid_) && stream_index == INFRA1) {
|
} else if (!is_playback_device_ && isGemini301SeriesPID(pid_) && stream_index == INFRA1) {
|
||||||
OBHardwareDecimationConfig conf;
|
OBHardwareDecimationConfig conf;
|
||||||
conf.originWidth = width;
|
conf.originWidth = width;
|
||||||
conf.originHeight = height;
|
conf.originHeight = height;
|
||||||
conf.factor = left_ir_decimation_factor_;
|
conf.factor = left_ir_decimation_factor_;
|
||||||
selected_profile = profiles->getVideoStreamProfile(conf, format, fps);
|
selected_profile = profiles->getVideoStreamProfile(conf, format, fps);
|
||||||
} else if (!is_playback_device_ && isGemini305SeriesPID(pid_) && stream_index == INFRA2) {
|
} else if (!is_playback_device_ && isGemini301SeriesPID(pid_) && stream_index == INFRA2) {
|
||||||
OBHardwareDecimationConfig conf;
|
OBHardwareDecimationConfig conf;
|
||||||
conf.originWidth = width;
|
conf.originWidth = width;
|
||||||
conf.originHeight = height;
|
conf.originHeight = height;
|
||||||
@@ -6025,7 +6025,7 @@ cv::Mat OBCameraNode::colorizeDepthImage(const cv::Mat &depth_image,
|
|||||||
cv::Mat depth_16u;
|
cv::Mat depth_16u;
|
||||||
depth_image.convertTo(depth_16u, CV_16UC1);
|
depth_image.convertTo(depth_16u, CV_16UC1);
|
||||||
|
|
||||||
const uint16_t min_depth = isGemini305SeriesPID(pid_) ? kViewerColorizerG305MinDistanceMm
|
const uint16_t min_depth = isGemini301SeriesPID(pid_) ? kViewerColorizerG305MinDistanceMm
|
||||||
: kViewerColorizerDefaultMinDistanceMm;
|
: kViewerColorizerDefaultMinDistanceMm;
|
||||||
const uint16_t max_depth = kViewerColorizerMaxDistanceMm;
|
const uint16_t max_depth = kViewerColorizerMaxDistanceMm;
|
||||||
const uint32_t value_range = static_cast<uint32_t>(max_depth) - min_depth + 1;
|
const uint32_t value_range = static_cast<uint32_t>(max_depth) - min_depth + 1;
|
||||||
@@ -6488,7 +6488,7 @@ void OBCameraNode::setDepthAutoExposureROI() {
|
|||||||
if (depth_roi_has_run) {
|
if (depth_roi_has_run) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isGemini305SeriesPID(pid_) && ae_reference_stream_ == "color") {
|
if (isGemini301SeriesPID(pid_) && ae_reference_stream_ == "color") {
|
||||||
RCLCPP_WARN_STREAM(logger_, "Skip setting depth AE ROI because AE Reference Stream is color");
|
RCLCPP_WARN_STREAM(logger_, "Skip setting depth AE ROI because AE Reference Stream is color");
|
||||||
depth_roi_has_run = true;
|
depth_roi_has_run = true;
|
||||||
return;
|
return;
|
||||||
@@ -6533,7 +6533,7 @@ void OBCameraNode::setColorAutoExposureROI() {
|
|||||||
if (color_roi_has_run) {
|
if (color_roi_has_run) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isGemini305SeriesPID(pid_) && ae_reference_stream_ == "depth") {
|
if (isGemini301SeriesPID(pid_) && ae_reference_stream_ == "depth") {
|
||||||
RCLCPP_WARN_STREAM(logger_, "Skip setting color AE ROI because AE Reference Stream is depth");
|
RCLCPP_WARN_STREAM(logger_, "Skip setting color AE ROI because AE Reference Stream is depth");
|
||||||
color_roi_has_run = true;
|
color_roi_has_run = true;
|
||||||
return;
|
return;
|
||||||
@@ -8091,7 +8091,7 @@ bool OBCameraNode::setupFormatConvertType(OBFormat format, ob::FormatConvertFilt
|
|||||||
|
|
||||||
bool OBCameraNode::isGemini435LePID(uint32_t pid) { return pid == GEMINI_435Le_PID; }
|
bool OBCameraNode::isGemini435LePID(uint32_t pid) { return pid == GEMINI_435Le_PID; }
|
||||||
bool OBCameraNode::isPublishMetaData(uint32_t pid) {
|
bool OBCameraNode::isPublishMetaData(uint32_t pid) {
|
||||||
return isGemini330SeriesPID(pid) || isGemini435LePID(pid) || isGemini305SeriesPID(pid);
|
return isGemini330SeriesPID(pid) || isGemini435LePID(pid) || isGemini301SeriesPID(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OBCameraNode::isDabaiASeriesForHwD2C(uint32_t pid) {
|
bool OBCameraNode::isDabaiASeriesForHwD2C(uint32_t pid) {
|
||||||
@@ -8101,7 +8101,7 @@ bool OBCameraNode::isDabaiASeriesForHwD2C(uint32_t pid) {
|
|||||||
|
|
||||||
bool OBCameraNode::isDepthWorkModeDevices(uint32_t pid) { return pid == GEMINI_435Le_PID; }
|
bool OBCameraNode::isDepthWorkModeDevices(uint32_t pid) { return pid == GEMINI_435Le_PID; }
|
||||||
|
|
||||||
bool OBCameraNode::isnotLaserDevices(uint32_t pid) { return isGemini305SeriesPID(pid); }
|
bool OBCameraNode::isnotLaserDevices(uint32_t pid) { return isGemini301SeriesPID(pid); }
|
||||||
|
|
||||||
orbbec_camera_msgs::msg::IMUInfo OBCameraNode::createIMUInfo(
|
orbbec_camera_msgs::msg::IMUInfo OBCameraNode::createIMUInfo(
|
||||||
const stream_index_pair &stream_index) {
|
const stream_index_pair &stream_index) {
|
||||||
|
|||||||
@@ -1372,7 +1372,7 @@ void OBCameraNodeDriver::initializeDevice(const std::shared_ptr<ob::Device> &dev
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool should_delay_stream_start = delay_stream_start_after_reconnect_.exchange(false) &&
|
const bool should_delay_stream_start = delay_stream_start_after_reconnect_.exchange(false) &&
|
||||||
isGemini305SeriesPID(device_info_->getPid());
|
isGemini301SeriesPID(device_info_->getPid());
|
||||||
if (should_delay_stream_start) {
|
if (should_delay_stream_start) {
|
||||||
std::this_thread::sleep_for(kStreamStartDelayAfterReconnect);
|
std::this_thread::sleep_for(kStreamStartDelayAfterReconnect);
|
||||||
}
|
}
|
||||||
@@ -1604,8 +1604,8 @@ void OBCameraNodeDriver::startDevice(const std::shared_ptr<ob::DeviceList> &list
|
|||||||
if (isGmslCameraPID(pid)) {
|
if (isGmslCameraPID(pid)) {
|
||||||
ob_camera_node_->startGmslTrigger();
|
ob_camera_node_->startGmslTrigger();
|
||||||
}
|
}
|
||||||
// if (isGemini305SeriesPID(pid)) {
|
// if (isGemini301SeriesPID(pid)) {
|
||||||
// // Fixing 305 series hot-swap not outputting power
|
// // Fixing 301 series hot-swap not outputting power
|
||||||
// ob_camera_node_->startStreams();
|
// ob_camera_node_->startStreams();
|
||||||
// }
|
// }
|
||||||
} catch (ob::Error &e) {
|
} catch (ob::Error &e) {
|
||||||
|
|||||||
@@ -1128,13 +1128,13 @@ void OBCameraNode::setAeRoiCallback(const std::shared_ptr<SetArrays ::Request>&
|
|||||||
std::shared_ptr<SetArrays::Response>& response,
|
std::shared_ptr<SetArrays::Response>& response,
|
||||||
const stream_index_pair& stream_index) {
|
const stream_index_pair& stream_index) {
|
||||||
auto stream = stream_index.first;
|
auto stream = stream_index.first;
|
||||||
if (isGemini305SeriesPID(device_->getDeviceInfo()->getPid()) &&
|
if (isGemini301SeriesPID(device_->getDeviceInfo()->getPid()) &&
|
||||||
(stream != OB_STREAM_COLOR && ae_reference_stream_ == "color")) {
|
(stream != OB_STREAM_COLOR && ae_reference_stream_ == "color")) {
|
||||||
response->success = false;
|
response->success = false;
|
||||||
response->message = "AE Reference Stream is color, other sensors setting is not supported";
|
response->message = "AE Reference Stream is color, other sensors setting is not supported";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isGemini305SeriesPID(device_->getDeviceInfo()->getPid()) &&
|
if (isGemini301SeriesPID(device_->getDeviceInfo()->getPid()) &&
|
||||||
(stream != OB_STREAM_DEPTH && ae_reference_stream_ == "depth")) {
|
(stream != OB_STREAM_DEPTH && ae_reference_stream_ == "depth")) {
|
||||||
response->success = false;
|
response->success = false;
|
||||||
response->message =
|
response->message =
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ void listSensorProfiles(const std::shared_ptr<ob::Device>& device) {
|
|||||||
auto origin_profile = profile_list->getProfile(j);
|
auto origin_profile = profile_list->getProfile(j);
|
||||||
if ((sensor->getType() == OB_SENSOR_DEPTH || sensor->getType() == OB_SENSOR_IR_LEFT ||
|
if ((sensor->getType() == OB_SENSOR_DEPTH || sensor->getType() == OB_SENSOR_IR_LEFT ||
|
||||||
sensor->getType() == OB_SENSOR_IR_RIGHT) &&
|
sensor->getType() == OB_SENSOR_IR_RIGHT) &&
|
||||||
isGemini305SeriesPID(pid)) {
|
isGemini301SeriesPID(pid)) {
|
||||||
// Gemini 305 series
|
// Gemini 301 series
|
||||||
auto profile = origin_profile->as<ob::VideoStreamProfile>();
|
auto profile = origin_profile->as<ob::VideoStreamProfile>();
|
||||||
std::cout << magic_enum::enum_name(sensor->getType()) << " profile: " << profile->getWidth()
|
std::cout << magic_enum::enum_name(sensor->getType()) << " profile: " << profile->getWidth()
|
||||||
<< "x" << profile->getHeight() << " " << profile->getFps() << "fps "
|
<< "x" << profile->getHeight() << " " << profile->getFps() << "fps "
|
||||||
|
|||||||
Reference in New Issue
Block a user