Skip to content

Commit

Permalink
remove unnecessary conversion function
Browse files Browse the repository at this point in the history
  • Loading branch information
borongyuan committed Jul 17, 2023
1 parent 7d2272b commit 0b4f5d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
2 changes: 0 additions & 2 deletions corelib/include/rtabmap/core/camera/CameraDepthAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ class RTABMAP_CORE_EXPORT CameraDepthAI :
std::map<double, cv::Vec3f> accBuffer_;
std::map<double, cv::Vec3f> gyroBuffer_;
UMutex imuMutex_;

static std::string ProtocolToStr(XLinkProtocol_t val);
#endif
};

Expand Down
30 changes: 2 additions & 28 deletions corelib/src/camera/CameraDepthAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ bool CameraDepthAI::init(const std::string & calibrationFolder, const std::strin
monoRight->out.link(stereo->right);

// Using VideoEncoder on PoE devices, Subpixel is not supported
if(ProtocolToStr(deviceToUse.protocol) == "X_LINK_TCP_IP")
if(deviceToUse.protocol == X_LINK_TCP_IP)
{
auto leftEnc = p.create<dai::node::VideoEncoder>();
auto depthOrRightEnc = p.create<dai::node::VideoEncoder>();
Expand Down Expand Up @@ -560,7 +560,7 @@ SensorData CameraDepthAI::captureImage(CameraInfo * info)
rectifRightOrDepth = rightOrDepthQueue_->get<dai::ImgFrame>();

double stamp = std::chrono::duration<double>(rectifL->getTimestampDevice(dai::CameraExposureOffset::MIDDLE).time_since_epoch()).count();
if(ProtocolToStr(device_->getDeviceInfo().protocol) == "X_LINK_TCP_IP")
if(device_->getDeviceInfo().protocol == X_LINK_TCP_IP)
{
left = cv::imdecode(rectifL->getData(), cv::IMREAD_GRAYSCALE);
depthOrRight = cv::imdecode(rectifRightOrDepth->getData(), cv::IMREAD_GRAYSCALE);
Expand Down Expand Up @@ -703,30 +703,4 @@ SensorData CameraDepthAI::captureImage(CameraInfo * info)
return data;
}

#ifdef RTABMAP_DEPTHAI
std::string CameraDepthAI::ProtocolToStr(XLinkProtocol_t val)
{
switch (val)
{
case X_LINK_USB_VSC:
return "X_LINK_USB_VSC";
case X_LINK_USB_CDC:
return "X_LINK_USB_CDC";
case X_LINK_PCIE:
return "X_LINK_PCIE";
case X_LINK_IPC:
return "X_LINK_IPC";
case X_LINK_TCP_IP:
return "X_LINK_TCP_IP";
case X_LINK_NMB_OF_PROTOCOLS:
return "X_LINK_NMB_OF_PROTOCOLS";
case X_LINK_ANY_PROTOCOL:
return "X_LINK_ANY_PROTOCOL";
default:
return "INVALID_ENUM_VALUE";
break;
}
}
#endif

} // namespace rtabmap

0 comments on commit 0b4f5d2

Please sign in to comment.