3dtof / voxelsdk

VoxelSDK - an SDK supporting TI's 3D Time of Flight cameras
BSD 3-Clause "New" or "Revised" License
107 stars 71 forks source link

OPT8241-CDK-EVM interfacing issue #71

Closed nyanmn closed 8 years ago

nyanmn commented 8 years ago

Hi All,

I am working with TI’s TOF device. I have problem with interfacing to the OPT841 device from Visual Studio program. The “SimpleVoxelViewer” application inside C:\Program Files\Voxel SDK 0.6.0\bin has no problem to connect to the device. Just the own program using Visual Studio has interfacing issue. The command echo %VOXEL_SDK_PATH% gives me C:\Program Files\Voxel SDK 0.6.0 So the path setting is correct.

I used prebuilt library also has that issue. So I compiled the whole SDK using Visual Studio and Cmake and using those compiled library still have that issue.

My code is

#include "stdafx.h"
#include <CameraSystem.h>
#include <Common.h>

#include <thread>

#include "PCLViewer.h"

using namespace Voxel;

int _tmain(int argc, _TCHAR* argv[])
{
       Voxel::logger.setDefaultLogLevel(Voxel::LOG_INFO);

       Voxel::CameraSystem sys;
       Voxel::DepthCameraPtr depthCamera;

       const Voxel::Vector<Voxel::DevicePtr> &devices = sys.scan();

       if (devices.size() > 0)
              depthCamera = sys.connect(devices[0]); // Connect to first available device
       else
       {
              std::cerr << "SimplePCLViewer: Could not find a compatible device." << std::endl;
              return -1;
       }

       if (!depthCamera)
       {
              std::cerr << "SimplePCLViewer: Could not open a depth camera." << std::endl;
              return -1;
       }

       Voxel::PCLViewer v;

       v.setDepthCamera(depthCamera);

       v.start();

       while (v.isRunning())
              std::this_thread::sleep_for(std::chrono::milliseconds(1000));

       return 0;
}

This line const Voxel::Vector<Voxel::DevicePtr> &devices = sys.scan(); has always devices are zero. What could be the problem?

nyanmn commented 8 years ago

Now I found that the application in release works fine.