mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-09-16 04:50:20 +08:00
fixed gemini2 get stuck
This commit is contained in:
@@ -48,4 +48,6 @@ std::string ObDeviceTypeToString(const OBDeviceType& type);
|
||||
|
||||
rmw_qos_profile_t getRMWQosProfileFromString(const std::string& str_qos);
|
||||
|
||||
bool isOpenNIDevice(int pid);
|
||||
|
||||
} // namespace orbbec_camera
|
||||
|
||||
@@ -252,8 +252,7 @@ std::shared_ptr<ob::Device> OBCameraNodeDriver::selectDeviceBySerialNumber(
|
||||
for (size_t i = 0; i < list->deviceCount(); i++) {
|
||||
try {
|
||||
auto pid = list->pid(i);
|
||||
if ((pid >= OPENNI_START_PID && pid <= OPENNI_END_PID) || pid == ASTRA_MINI_PID ||
|
||||
pid == ASTRA_MINI_S_PID) {
|
||||
if (isOpenNIDevice(pid)) {
|
||||
// openNI device
|
||||
auto device = list->getDevice(i);
|
||||
auto device_info = device->getDeviceInfo();
|
||||
@@ -266,7 +265,7 @@ std::shared_ptr<ob::Device> OBCameraNodeDriver::selectDeviceBySerialNumber(
|
||||
std::string sn = list->serialNumber(i);
|
||||
RCLCPP_INFO_STREAM_THROTTLE(logger_, *get_clock(), 1000, "Device serial number: " << sn);
|
||||
if (sn == serial_number) {
|
||||
RCLCPP_INFO_STREAM(logger_, "Device serial number <<" << sn << " matched");
|
||||
RCLCPP_INFO_STREAM(logger_, "Device serial number " << sn << " matched");
|
||||
return list->getDevice(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,5 +248,20 @@ rmw_qos_profile_t getRMWQosProfileFromString(const std::string &str_qos) {
|
||||
return rmw_qos_profile_default;
|
||||
}
|
||||
}
|
||||
bool isOpenNIDevice(int pid) {
|
||||
static const std::vector<int> OPENNI_DEVICE_PIDS = {
|
||||
0x0300, 0x0301, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0407, 0x0601, 0x060b,
|
||||
0x060e, 0x060f, 0x0610, 0x0613, 0x0614, 0x0616, 0x0617, 0x0618, 0x061b, 0x062b,
|
||||
0x062c, 0x062d, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639,
|
||||
0x063a, 0x0650, 0x0651, 0x0654, 0x0655, 0x0656, 0x0657, 0x0658, 0x0659, 0x065a,
|
||||
0x065b, 0x065c, 0x065d, 0x0698, 0x0699, 0x069a};
|
||||
|
||||
for (const auto &pid_openni : OPENNI_DEVICE_PIDS) {
|
||||
if (pid == pid_openni) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace orbbec_camera
|
||||
|
||||
Reference in New Issue
Block a user