mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
MacOS and Windows binaries update (0.23.8) (#1726)
* Windows CI: more sensor drivers + Windows/macOS bundle scripts * added opengv to mac build * windows bundle fixes * zed extra neural ddl in separate package * OpenGV macos eigen version error * opengv macos build issues
This commit is contained in:
@@ -392,7 +392,6 @@ IF(depthai_FOUND)
|
||||
SET(PUBLIC_LIBRARIES
|
||||
${PUBLIC_LIBRARIES}
|
||||
depthai::core
|
||||
depthai::opencv
|
||||
)
|
||||
ENDIF(depthai_FOUND)
|
||||
|
||||
|
||||
@@ -729,6 +729,21 @@ std::string CameraDepthAI::getSerial() const
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef RTABMAP_DEPTHAI
|
||||
namespace {
|
||||
// Convert the depthai depth ImgFrame to cv::Mat (similar to dai::ImgFrame::getCvFrame())
|
||||
cv::Mat depthImgFrameToCvMat(const std::shared_ptr<dai::ImgFrame> & frame)
|
||||
{
|
||||
if(frame->getType() != dai::ImgFrame::Type::RAW16)
|
||||
{
|
||||
UERROR("Expected RAW16 depth ImgFrame but got type %d", (int)frame->getType());
|
||||
return cv::Mat();
|
||||
}
|
||||
return cv::Mat((int)frame->getHeight(), (int)frame->getWidth(), CV_16UC1, frame->getData().data()).clone();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SensorData CameraDepthAI::captureImage(SensorCaptureInfo * info)
|
||||
{
|
||||
SensorData data;
|
||||
@@ -740,7 +755,7 @@ SensorData CameraDepthAI::captureImage(SensorCaptureInfo * info)
|
||||
|
||||
double stamp = std::chrono::duration<double>(depthOrRight->getTimestampDevice(dai::CameraExposureOffset::MIDDLE).time_since_epoch()).count();
|
||||
if(outputMode_)
|
||||
data = SensorData(cv::imdecode(rgbOrLeft->getData(), cv::IMREAD_ANYCOLOR), depthOrRight->getCvFrame(), stereoModel_.left(), this->getNextSeqID(), stamp);
|
||||
data = SensorData(cv::imdecode(rgbOrLeft->getData(), cv::IMREAD_ANYCOLOR), depthImgFrameToCvMat(depthOrRight), stereoModel_.left(), this->getNextSeqID(), stamp);
|
||||
else
|
||||
data = SensorData(cv::imdecode(rgbOrLeft->getData(), cv::IMREAD_GRAYSCALE), cv::imdecode(depthOrRight->getData(), cv::IMREAD_GRAYSCALE), stereoModel_, this->getNextSeqID(), stamp);
|
||||
|
||||
|
||||
@@ -220,6 +220,12 @@ bool CameraOrbbecSDK::init(const std::string & calibrationFolder, const std::str
|
||||
#ifdef RTABMAP_ORBBEC_SDK
|
||||
this->close();
|
||||
|
||||
// The Orbbec SDK reports failures by throwing ob::Error (e.g. uvc_open
|
||||
// access denied on macOS without camera permission, or unsupported config).
|
||||
// Catch them here so init() logs the error and returns false instead of
|
||||
// letting the exception propagate and abort the whole process.
|
||||
try {
|
||||
|
||||
std::shared_ptr<ob::Device> device;
|
||||
|
||||
ob::Context context;
|
||||
@@ -276,16 +282,20 @@ bool CameraOrbbecSDK::init(const std::string & calibrationFolder, const std::str
|
||||
}
|
||||
|
||||
if(device.get() == nullptr) {
|
||||
#ifdef __APPLE__
|
||||
const std::string connectHint = "camera is correctly connected. On macOS the Orbbec "
|
||||
"camera can only be accessed with root privileges, so run the application with sudo.";
|
||||
#else
|
||||
const std::string connectHint = "camera is correctly connected and the udev rules are installed.";
|
||||
#endif
|
||||
if(deviceId_.empty()) {
|
||||
UERROR( "Could not find any orbbec compatible devices! Verify that the "
|
||||
"camera is correctly connected and the udev rules are installed.");
|
||||
UERROR("Could not find any orbbec compatible devices! Verify that the %s", connectHint.c_str());
|
||||
}
|
||||
else {
|
||||
UERROR("Could not find an orbbec device with ID \"%s\"! Verify that the "
|
||||
"camera is correctly connected and the udev rules are installed. "
|
||||
"Unset the ID to choose the first camera found.");
|
||||
UERROR("Could not find an orbbec device with ID \"%s\"! Verify that the %s "
|
||||
"Unset the ID to choose the first camera found.", deviceId_.c_str(), connectHint.c_str());
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -546,6 +556,22 @@ bool CameraOrbbecSDK::init(const std::string & calibrationFolder, const std::str
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
catch(const ob::Error & e)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
UERROR("Failed to initialize Orbbec camera: %s. On macOS the Orbbec SDK accesses "
|
||||
"the camera through libusb, which must take the USB interface from the system "
|
||||
"UVC driver; this requires root privileges. If this is a USB access error "
|
||||
"(e.g. \"uvc_open failed ... Return Code: -3\"), run the application with sudo.",
|
||||
e.what());
|
||||
#else
|
||||
UERROR("Failed to initialize Orbbec camera: %s", e.what());
|
||||
#endif
|
||||
this->close();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
UERROR("CameraOrbbecSDK: RTAB-Map is not built with Orbbec SDK support!");
|
||||
@@ -598,13 +624,19 @@ SensorData CameraOrbbecSDK::captureImage(SensorCaptureInfo * info)
|
||||
UERROR("Camera is not initialized!");
|
||||
return data;
|
||||
}
|
||||
|
||||
// The streaming calls below can throw ob::Error (transient frame/USB
|
||||
// errors, filter or profile failures). Catch them so a bad frame is logged
|
||||
// and skipped (empty SensorData) instead of aborting the whole process.
|
||||
try {
|
||||
|
||||
auto frameset = pipeline_->waitForFrameset();
|
||||
if(frameset == nullptr || frameset->getCount() == 0) {
|
||||
UWARN("No frame received!");
|
||||
return data;
|
||||
}
|
||||
if(frameset->getCount() != 2) {
|
||||
UWARN("Received %s frames, expecting 2!", frameset->getCount());
|
||||
UWARN("Received %u frames, expecting 2!", frameset->getCount());
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -733,6 +765,13 @@ SensorData CameraOrbbecSDK::captureImage(SensorCaptureInfo * info)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch(const ob::Error & e)
|
||||
{
|
||||
UERROR("Error capturing Orbbec camera frame: %s", e.what());
|
||||
return data;
|
||||
}
|
||||
|
||||
#else
|
||||
UERROR("CameraOrbbecSDK: RTAB-Map is not built with Orbbec SDK support!");
|
||||
#endif
|
||||
|
||||
@@ -508,7 +508,14 @@ bool CameraRealSense2::init(const std::string & calibrationFolder, const std::st
|
||||
rs2::device_list list = ctx_.query_devices();
|
||||
if (0 == list.size())
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
UERROR("No RealSense2 devices were found! On macOS the RealSense SDK accesses "
|
||||
"the camera through libusb, which must take the USB interface from the "
|
||||
"system driver; this requires root privileges. If a device is connected "
|
||||
"but not detected, run the application with sudo.");
|
||||
#else
|
||||
UERROR("No RealSense2 devices were found!");
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -546,7 +553,12 @@ bool CameraRealSense2::init(const std::string & calibrationFolder, const std::st
|
||||
}
|
||||
catch(const rs2::error & error)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
UWARN("%s. Is the camera already used with another app? On macOS, accessing a "
|
||||
"RealSense camera requires root privileges, so try running with sudo.", error.what());
|
||||
#else
|
||||
UWARN("%s. Is the camera already used with another app?", error.what());
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!found)
|
||||
|
||||
Reference in New Issue
Block a user