Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
pcl::DinastGrabber Class Reference

Grabber for DINAST devices (i.e., IPA-1002, IPA-1110, IPA-2001) More...

#include <pcl/io/dinast_grabber.h>

+ Inheritance diagram for pcl::DinastGrabber:
+ Collaboration diagram for pcl::DinastGrabber:

Public Member Functions

 DinastGrabber (const int device_position=1)
 Constructor that sets up the grabber constants. More...
 
 ~DinastGrabber () noexcept override
 Destructor. More...
 
bool isRunning () const override
 Check if the grabber is running. More...
 
std::string getName () const override
 Returns the name of the concrete subclass, DinastGrabber. More...
 
void start () override
 Start the data acquisition process. More...
 
void stop () override
 Stop the data acquisition process. More...
 
float getFramesPerSecond () const override
 Obtain the number of frames per second (FPS). More...
 
std::string getDeviceVersion ()
 Get the version number of the currently opened device. More...
 
- Public Member Functions inherited from pcl::Grabber
 Grabber ()=default
 Default ctor. More...
 
 Grabber (const Grabber &)=delete
 No copy ctor since Grabber can't be copied. More...
 
Grabberoperator= (const Grabber &)=delete
 No copy assign operator since Grabber can't be copied. More...
 
 Grabber (Grabber &&)=default
 Move ctor. More...
 
Grabberoperator= (Grabber &&)=default
 Move assign operator. More...
 
virtual ~Grabber () noexcept=default
 virtual destructor. More...
 
template<typename T >
boost::signals2::connection registerCallback (const std::function< T > &callback)
 registers a callback function/method to a signal with the corresponding signature More...
 
template<typename T >
bool providesCallback () const noexcept
 indicates whether a signal with given parameter-type exists or not More...
 
bool toggle ()
 For devices that are streaming, stopped streams are started and running stream are stopped. More...
 

Protected Types

enum  pixel_size { RAW8 =1 , RGB16 =2 , RGB24 =3 , RGB32 =4 }
 Size of pixel. More...
 
enum  { CMD_READ_START =0xC7 , CMD_READ_STOP =0xC8 , CMD_GET_VERSION =0xDC , CMD_SEND_DATA =0xDE }
 Device command values. More...
 

Protected Member Functions

void onInit (const int device_id)
 On initialization processing. More...
 
void setupDevice (int device_position, const int id_vendor=0x18d1, const int id_product=0x1402)
 Setup a Dinast 3D camera device. More...
 
bool USBRxControlData (const unsigned char req_code, unsigned char *buffer, int length)
 Send a RX data packet request. More...
 
bool USBTxControlData (const unsigned char req_code, unsigned char *buffer, int length)
 Send a TX data packet request. More...
 
int checkHeader ()
 Check if we have a header in the global buffer, and return the position of the next valid image. More...
 
void readImage ()
 Read image data and leaves it on image_. More...
 
pcl::PointCloud< pcl::PointXYZI >::Ptr getXYZIPointCloud ()
 Obtains XYZI Point Cloud from the image of the camera. More...
 
void captureThreadFunction ()
 The function in charge of getting the data from the camera. More...
 
- Protected Member Functions inherited from pcl::Grabber
virtual void signalsChanged ()
 
template<typename T >
boost::signals2::signal< T > * find_signal () const noexcept
 
template<typename T >
int num_slots () const noexcept
 
template<typename T >
void disconnect_all_slots ()
 
template<typename T >
void block_signal ()
 
template<typename T >
void unblock_signal ()
 
void block_signals ()
 
void unblock_signals ()
 
template<typename T >
boost::signals2::signal< T > * createSignal ()
 

Protected Attributes

int image_width_ {320}
 Width of image. More...
 
int image_height_ {240}
 Height of image. More...
 
int image_size_ {image_width_ * image_height_}
 Total size of image. More...
 
int sync_packet_size_ {512}
 Length of a sync packet. More...
 
double dist_max_2d_ {1. / (image_width_ / 2.)}
 
double fov_ {64. * M_PI / 180.}
 diagonal Field of View More...
 
libusb_context * context_ {nullptr}
 The libusb context. More...
 
struct libusb_device_handle * device_handle_ {nullptr}
 the actual device_handle for the camera More...
 
unsigned char * raw_buffer_ {nullptr}
 Temporary USB read buffer, since we read two RGB16 images at a time size is the double of two images plus a sync packet. More...
 
boost::circular_buffer< unsigned char > g_buffer_
 Global circular buffer. More...
 
unsigned char bulk_ep_ {std::numeric_limits<unsigned char>::max ()}
 Bulk endpoint address value. More...
 
unsigned char * image_ {nullptr}
 
bool second_image_ {false}
 Since there is no header after the first image, we need to save the state. More...
 
bool running_ {false}
 
std::thread capture_thread_
 
std::mutex capture_mutex_
 
boost::signals2::signal< sig_cb_dinast_point_cloud > * point_cloud_signal_
 
- Protected Attributes inherited from pcl::Grabber
std::map< std::string, std::unique_ptr< boost::signals2::signal_base > > signals_
 
std::map< std::string, std::vector< boost::signals2::connection > > connections_
 
std::map< std::string, std::vector< boost::signals2::shared_connection_block > > shared_connections_
 

Detailed Description

Grabber for DINAST devices (i.e., IPA-1002, IPA-1110, IPA-2001)

Author
Marco A. Gutierrez marco.nosp@m.g@un.nosp@m.ex.es

Definition at line 59 of file dinast_grabber.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Device command values.

Enumerator
CMD_READ_START 
CMD_READ_STOP 
CMD_GET_VERSION 
CMD_SEND_DATA 

Definition at line 203 of file dinast_grabber.h.

◆ pixel_size

Size of pixel.

Enumerator
RAW8 
RGB16 
RGB24 
RGB32 

Definition at line 183 of file dinast_grabber.h.

Constructor & Destructor Documentation

◆ DinastGrabber()

pcl::DinastGrabber::DinastGrabber ( const int  device_position = 1)

Constructor that sets up the grabber constants.

Parameters
[in]device_positionNumber corresponding the device to grab

◆ ~DinastGrabber()

pcl::DinastGrabber::~DinastGrabber ( )
overridenoexcept

Destructor.

It never throws.

Member Function Documentation

◆ captureThreadFunction()

void pcl::DinastGrabber::captureThreadFunction ( )
protected

The function in charge of getting the data from the camera.

◆ checkHeader()

int pcl::DinastGrabber::checkHeader ( )
protected

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.
Returns
the position of the next valid image (i.e., right after a valid header) or -1 in case the buffer either doesn't have an image or has a partial image

◆ getDeviceVersion()

std::string pcl::DinastGrabber::getDeviceVersion ( )

Get the version number of the currently opened device.

◆ getFramesPerSecond()

float pcl::DinastGrabber::getFramesPerSecond ( ) const
overridevirtual

Obtain the number of frames per second (FPS).

Implements pcl::Grabber.

◆ getName()

std::string pcl::DinastGrabber::getName ( ) const
inlineoverridevirtual

Returns the name of the concrete subclass, DinastGrabber.

Returns
DinastGrabber.

Implements pcl::Grabber.

Definition at line 83 of file dinast_grabber.h.

◆ getXYZIPointCloud()

pcl::PointCloud<pcl::PointXYZI>::Ptr pcl::DinastGrabber::getXYZIPointCloud ( )
protected

Obtains XYZI Point Cloud from the image of the camera.

Returns
the point cloud from the image data

◆ isRunning()

bool pcl::DinastGrabber::isRunning ( ) const
overridevirtual

Check if the grabber is running.

Returns
true if grabber is running / streaming. False otherwise.

Implements pcl::Grabber.

◆ onInit()

void pcl::DinastGrabber::onInit ( const int  device_id)
protected

On initialization processing.

◆ readImage()

void pcl::DinastGrabber::readImage ( )
protected

Read image data and leaves it on image_.

◆ setupDevice()

void pcl::DinastGrabber::setupDevice ( int  device_position,
const int  id_vendor = 0x18d1,
const int  id_product = 0x1402 
)
protected

Setup a Dinast 3D camera device.

Parameters
[in]device_positionNumber corresponding the device to grab
[in]id_vendorThe ID of the camera vendor (should be 0x18d1)
[in]id_productThe ID of the product (should be 0x1402)

◆ start()

void pcl::DinastGrabber::start ( )
overridevirtual

Start the data acquisition process.

Implements pcl::Grabber.

◆ stop()

void pcl::DinastGrabber::stop ( )
overridevirtual

Stop the data acquisition process.

Implements pcl::Grabber.

◆ USBRxControlData()

bool pcl::DinastGrabber::USBRxControlData ( const unsigned char  req_code,
unsigned char *  buffer,
int  length 
)
protected

Send a RX data packet request.

Parameters
[in]req_codethe request to send (the request field for the setup packet)
buffer
[in]lengththe length field for the setup packet. The data buffer should be at least this size.

◆ USBTxControlData()

bool pcl::DinastGrabber::USBTxControlData ( const unsigned char  req_code,
unsigned char *  buffer,
int  length 
)
protected

Send a TX data packet request.

Parameters
[in]req_codethe request to send (the request field for the setup packet)
buffer
[in]lengththe length field for the setup packet. The data buffer should be at least this size.

Member Data Documentation

◆ bulk_ep_

unsigned char pcl::DinastGrabber::bulk_ep_ {std::numeric_limits<unsigned char>::max ()}
protected

Bulk endpoint address value.

Definition at line 200 of file dinast_grabber.h.

◆ capture_mutex_

std::mutex pcl::DinastGrabber::capture_mutex_
mutableprotected

Definition at line 214 of file dinast_grabber.h.

◆ capture_thread_

std::thread pcl::DinastGrabber::capture_thread_
protected

Definition at line 212 of file dinast_grabber.h.

◆ context_

libusb_context* pcl::DinastGrabber::context_ {nullptr}
protected

The libusb context.

Definition at line 186 of file dinast_grabber.h.

◆ device_handle_

struct libusb_device_handle* pcl::DinastGrabber::device_handle_ {nullptr}
protected

the actual device_handle for the camera

Definition at line 189 of file dinast_grabber.h.

◆ dist_max_2d_

double pcl::DinastGrabber::dist_max_2d_ {1. / (image_width_ / 2.)}
protected

Definition at line 177 of file dinast_grabber.h.

◆ fov_

double pcl::DinastGrabber::fov_ {64. * M_PI / 180.}
protected

diagonal Field of View

Definition at line 180 of file dinast_grabber.h.

◆ g_buffer_

boost::circular_buffer<unsigned char> pcl::DinastGrabber::g_buffer_
protected

Global circular buffer.

Definition at line 197 of file dinast_grabber.h.

◆ image_

unsigned char* pcl::DinastGrabber::image_ {nullptr}
protected

Definition at line 205 of file dinast_grabber.h.

◆ image_height_

int pcl::DinastGrabber::image_height_ {240}
protected

Height of image.

Definition at line 169 of file dinast_grabber.h.

◆ image_size_

int pcl::DinastGrabber::image_size_ {image_width_ * image_height_}
protected

Total size of image.

Definition at line 172 of file dinast_grabber.h.

◆ image_width_

int pcl::DinastGrabber::image_width_ {320}
protected

Width of image.

Definition at line 166 of file dinast_grabber.h.

◆ point_cloud_signal_

boost::signals2::signal<sig_cb_dinast_point_cloud>* pcl::DinastGrabber::point_cloud_signal_
protected

Definition at line 215 of file dinast_grabber.h.

◆ raw_buffer_

unsigned char* pcl::DinastGrabber::raw_buffer_ {nullptr}
protected

Temporary USB read buffer, since we read two RGB16 images at a time size is the double of two images plus a sync packet.

Definition at line 194 of file dinast_grabber.h.

◆ running_

bool pcl::DinastGrabber::running_ {false}
protected

Definition at line 210 of file dinast_grabber.h.

◆ second_image_

bool pcl::DinastGrabber::second_image_ {false}
protected

Since there is no header after the first image, we need to save the state.

Definition at line 208 of file dinast_grabber.h.

◆ sync_packet_size_

int pcl::DinastGrabber::sync_packet_size_ {512}
protected

Length of a sync packet.

Definition at line 175 of file dinast_grabber.h.


The documentation for this class was generated from the following file: