43 #include <pcl/point_cloud.h>
44 #include <pcl/io/grabber.h>
46 #include <pcl/console/print.h>
47 #include <libusb-1.0/libusb.h>
48 #include <boost/circular_buffer.hpp>
77 isRunning () const override;
83 getName ()
const override
84 {
return {
"DinastGrabber"}; }
118 const int id_vendor = 0x18d1,
119 const int id_product = 0x1402);
128 unsigned char *buffer,
138 unsigned char *buffer,
166 int image_width_{320};
169 int image_height_{240};
172 int image_size_{image_width_ * image_height_};
175 int sync_packet_size_{512};
177 double dist_max_2d_{1. / (image_width_ / 2.)};
180 double fov_{64. *
M_PI / 180.};
186 libusb_context *context_{
nullptr};
189 struct libusb_device_handle *device_handle_{
nullptr};
194 unsigned char *raw_buffer_{
nullptr} ;
200 unsigned char bulk_ep_{std::numeric_limits<unsigned char>::max ()};
203 enum { CMD_READ_START=0xC7, CMD_READ_STOP=0xC8, CMD_GET_VERSION=0xDC, CMD_SEND_DATA=0xDE };
205 unsigned char *image_{
nullptr};
208 bool second_image_{
false};
210 bool running_{
false};
Grabber for DINAST devices (i.e., IPA-1002, IPA-1110, IPA-2001)
DinastGrabber(const int device_position=1)
Constructor that sets up the grabber constants.
float getFramesPerSecond() const override
Obtain the number of frames per second (FPS).
std::mutex capture_mutex_
void captureThreadFunction()
The function in charge of getting the data from the camera.
pcl::PointCloud< pcl::PointXYZI >::Ptr getXYZIPointCloud()
Obtains XYZI Point Cloud from the image of the camera.
bool USBRxControlData(const unsigned char req_code, unsigned char *buffer, int length)
Send a RX data packet request.
void stop() override
Stop the data acquisition process.
void start() override
Start the data acquisition process.
int checkHeader()
Check if we have a header in the global buffer, and return the position of the next valid image.
void readImage()
Read image data and leaves it on image_.
std::thread capture_thread_
void setupDevice(int device_position, const int id_vendor=0x18d1, const int id_product=0x1402)
Setup a Dinast 3D camera device.
std::string getDeviceVersion()
Get the version number of the currently opened device.
~DinastGrabber() noexcept override
Destructor.
bool USBTxControlData(const unsigned char req_code, unsigned char *buffer, int length)
Send a TX data packet request.
boost::circular_buffer< unsigned char > g_buffer_
Global circular buffer.
boost::signals2::signal< sig_cb_dinast_point_cloud > * point_cloud_signal_
void onInit(const int device_id)
On initialization processing.
Grabber interface for PCL 1.x device drivers.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Defines all the PCL implemented PointT point type structures.
Define methods for measuring time spent in code blocks.