提交 c6237349 编写于 作者: R Radu B. Rusu

bugfixes for Marco


git-svn-id: svn+ssh://svn.pointclouds.org/pcl/trunk@6540 a9d63959-f2ad-4865-b262-bf0e56cfafb6
上级 8c3e0a82
......@@ -57,12 +57,13 @@ if(build)
src/oni_grabber.cpp
)
endif(OPENNI_FOUND)
set(DINAST_GRABBER_INCLUDES
include/pcl/io/dinast_grabber.h
)
include/pcl/io/dinast_grabber.h)
set(DINAST_GRABBER_SOURCES
src/dinast_grabber.cpp
)
src/dinast_grabber.cpp)
if (VTK_FOUND AND NOT ANDROID_NDK)
set(VTK_USE_FILE ${VTK_USE_FILE} CACHE INTERNAL "VTK_USE_FILE")
include (${VTK_USE_FILE})
......
......@@ -96,7 +96,7 @@ namespace pcl
/** \brief Sets the device. */
void
setDevice (struct libusb_device_handle* device_handle);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Find a Dinast 3D camera device
* \param[out] ctx the libusb context
* \param[in] id_vendor the ID of the camera vendor (should be 0x18d1)
......@@ -108,7 +108,6 @@ namespace pcl
const int id_vendor = 0x18d1,
const int id_product = 0x1402);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Open a given USB device
* \param[in] ctx the libusb context
* \param[in] idx the USB device index to open
......@@ -117,7 +116,6 @@ namespace pcl
struct libusb_device_handle*
openDevice (struct libusb_context *ctx, int idx);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Close the given USB device
* \param[in] device_handle the USB device handle to close
* \param[in] index the index of the device to close
......@@ -125,7 +123,6 @@ namespace pcl
void
closeDevice (struct libusb_device_handle* device_handle, int index = 0);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Send a RX data packet request
* \param[in] device_handle the USB device handle to close
* \param[in] req_code the request to send (the request field for the setup packet)
......@@ -137,7 +134,6 @@ namespace pcl
unsigned char *buffer,
int length);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Send a TX data packet request
* \param[in] device_handle the USB device handle to close
* \param[in] req_code the request to send (the request field for the setup packet)
......@@ -149,28 +145,24 @@ namespace pcl
unsigned char *buffer,
int length);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Get the version number of the currently opened device
* \param[in] device_handle the device to get the version number from
*/
std::string
getDeviceVersion (struct libusb_device_handle* device_handle);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Start the data acquisition process.
* \param[in] device_handle the USB device to start acquisiton from
*/
void
start ();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Stop the data acquisition process.
* \param[in] device_handle the USB device to stop acquisiton from
*/
void
stop ();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Check if we have a header in the global buffer, and return the position of the next valid image.
* \note If the image in the buffer is partial, return -1, as we have to wait until we add more data to it.
* \return the position of the next valid image (i.e., right after a valid header) or -1 in case the buffer
......@@ -179,7 +171,6 @@ namespace pcl
int
checkHeader ();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Read image data
* \param[in] device_handle the USB device handle to close
* \param[out] the image data in unsigned short format
......@@ -188,7 +179,6 @@ namespace pcl
readImage (struct libusb_device_handle* device_handle,
unsigned char *image);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief Read image data
* \param[in] device_handle the USB device handle to close
* \param[out] the image data in unsigned short format
......
......@@ -36,11 +36,9 @@
*/
#include <pcl/pcl_config.h>
#ifdef HAVE_DINAST
//#ifdef HAVE_DINAST
#include <pcl/io/dinast_grabber.h>
#include "dinast_grabber.h"
#include <iostream>
// From http://libusb.sourceforge.net/api-1.0/structlibusb__control__setup.html#a39b148c231d675492ccd2383196926bf
......@@ -57,13 +55,16 @@
#define SYNC_PACKET 512
#define RGB16_LENGTH IMAGE_WIDTH*2*IMAGE_HEIGHT
///////////////////////////////////////////////////////////////////////////////////////////
pcl::DinastGrabber::DinastGrabber ()
:second_image(false)
,running_(false)
: second_image (false)
, running_ (false)
{
bulk_ep = -1;
}
pcl::DinastGrabber::~DinastGrabber () throw ();
///////////////////////////////////////////////////////////////////////////////////////////
pcl::DinastGrabber::~DinastGrabber () throw ()
{
try
{
......@@ -83,31 +84,36 @@ pcl::DinastGrabber::~DinastGrabber () throw ();
}
}
///////////////////////////////////////////////////////////////////////////////////////////
std::string
pcl::DinastGrabber::getName () const
{
return std::string ("DinastGrabber");
return (std::string ("DinastGrabber"));
}
///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::DinastGrabber::isRunning () const
{
return running_;
return (running_);
}
int
///////////////////////////////////////////////////////////////////////////////////////////
float
pcl::DinastGrabber::getFramesPerSecond () const
{
//figure this out!!
return 0;
return (0);
}
///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::DinastGrabber::setDevice (struct libusb_device_handle* device_handle)
{
this->device_handle=device_handle;
this->device_handle = device_handle;
}
///////////////////////////////////////////////////////////////////////////////////////////
struct libusb_device_handle*
pcl::DinastGrabber::findDevice (libusb_context *ctx, const int id_vendor, const int id_product)
{
......@@ -180,6 +186,7 @@ pcl::DinastGrabber::findDevice (libusb_context *ctx, const int id_vendor, const
return (device);
}
///////////////////////////////////////////////////////////////////////////////////////////
struct libusb_device_handle*
pcl::DinastGrabber::openDevice (struct libusb_context *ctx, int idx)
{
......@@ -201,6 +208,7 @@ pcl::DinastGrabber::openDevice (struct libusb_context *ctx, int idx)
return (device_handle);
}
///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::DinastGrabber::closeDevice (struct libusb_device_handle* device_handle, int index)
{
......@@ -210,6 +218,7 @@ pcl::DinastGrabber::closeDevice (struct libusb_device_handle* device_handle, int
libusb_close (device_handle);
}
///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::DinastGrabber::USBRxControlData (struct libusb_device_handle* device_handle,
const unsigned char req_code,
......@@ -237,6 +246,7 @@ pcl::DinastGrabber::USBRxControlData (struct libusb_device_handle* device_handle
return (true);
}
///////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::DinastGrabber::USBTxControlData (struct libusb_device_handle* device_handle,
const unsigned char req_code,
......@@ -264,6 +274,7 @@ pcl::DinastGrabber::USBTxControlData (struct libusb_device_handle* device_handle
return (true);
}
///////////////////////////////////////////////////////////////////////////////////////////
std::string
pcl::DinastGrabber::getDeviceVersion (struct libusb_device_handle* device_handle)
{
......@@ -279,24 +290,28 @@ pcl::DinastGrabber::getDeviceVersion (struct libusb_device_handle* device_handle
return (std::string ((const char*)data));
}
///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::DinastGrabber::start ()
{
unsigned char ctrl_buf[3];
if (!USBTxControlData (device_handle, CMD_READ_START, ctrl_buf, 1))
return;
running_=true;
running_ = true;
}
///////////////////////////////////////////////////////////////////////////////////////////
void
pcl::DinastGrabber::stop (struct libusb_device_handle* device_handle)
//pcl::DinastGrabber::stop (struct libusb_device_handle* device_handle)
pcl::DinastGrabber::stop ()
{
unsigned char ctrl_buf[3];
if (!USBTxControlData (device_handle, CMD_READ_STOP, ctrl_buf, 1))
return;
// if (!USBTxControlData (device_handle, CMD_READ_STOP, ctrl_buf, 1))
// return;
running_=false;
}
///////////////////////////////////////////////////////////////////////////////////////////
int
pcl::DinastGrabber::checkHeader ()
{
......@@ -322,6 +337,7 @@ pcl::DinastGrabber::checkHeader ()
return (data_ptr);
}
///////////////////////////////////////////////////////////////////////////////////////////
int
pcl::DinastGrabber::readImage (struct libusb_device_handle* device_handle,
unsigned char *image)
......@@ -410,8 +426,10 @@ pcl::DinastGrabber::readImage (struct libusb_device_handle* device_handle,
return (IMAGE_SIZE);
}
///////////////////////////////////////////////////////////////////////////////////////////
int
pcl::DinastGrabber::readImage (struct libusb_device_handle* device_handle,
pcl::DinastGrabber::readImage (
struct libusb_device_handle* device_handle,
unsigned char *image1, unsigned char *image2)
{
// Read data in two image blocks until we get a header
......@@ -448,4 +466,4 @@ pcl::DinastGrabber::readImage (struct libusb_device_handle* device_handle,
return (IMAGE_SIZE);
}
#endif
\ No newline at end of file
//#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册