38 #include "pcl/pcl_config.h"
40 #ifndef PCL_IO_ROBOT_EYE_GRABBER_H_
41 #define PCL_IO_ROBOT_EYE_GRABBER_H_
43 #include <pcl/io/grabber.h>
44 #include <pcl/io/impl/synchronized_queue.hpp>
45 #include <pcl/point_types.h>
46 #include <pcl/point_cloud.h>
47 #include <boost/asio.hpp>
48 #include <boost/thread/thread.hpp>
64 typedef void (sig_cb_robot_eye_point_cloud_xyzi) (
65 const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZI> >&);
71 RobotEyeGrabber (
const boost::asio::ip::address& ipAddress,
unsigned short port=443);
78 virtual
void start ();
86 virtual
std::
string getName () const;
91 virtual
bool isRunning () const;
95 virtual
float getFramesPerSecond () const;
100 void setSensorAddress (const
boost::asio::ip::address& ipAddress);
101 const
boost::asio::ip::address& getSensorAddress () const;
106 void setDataPort (
unsigned short port);
107 unsigned short getDataPort () const;
112 void setSignalPointCloudSize (
std::
size_t numerOfPoints);
113 std::
size_t getSignalPointCloudSize () const;
123 bool terminate_thread_;
124 size_t signal_point_cloud_size_;
125 unsigned short data_port_;
126 enum { MAX_LENGTH = 65535 };
127 unsigned char receive_buffer_[MAX_LENGTH];
128 unsigned int data_size_;
130 boost::asio::ip::address sensor_address_;
131 boost::asio::ip::udp::endpoint sender_endpoint_;
132 boost::asio::io_service io_service_;
133 boost::shared_ptr<boost::asio::ip::udp::socket> socket_;
134 boost::shared_ptr<boost::thread> socket_thread_;
135 boost::shared_ptr<boost::thread> consumer_thread_;
138 boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> > point_cloud_xyzi_;
139 boost::signals2::signal<sig_cb_robot_eye_point_cloud_xyzi>* point_cloud_signal_;
141 void consumerThreadLoop ();
142 void socketThreadLoop ();
143 void asyncSocketReceive ();
144 void resetPointCloud ();
145 void socketCallback (
const boost::system::error_code& error, std::size_t number_of_bytes);
146 void convertPacketData (
unsigned char *data_packet,
size_t length);
147 void computeXYZI (
pcl::PointXYZI& point_XYZI,
unsigned char* point_data);
148 void computeTimestamp (boost::uint32_t& timestamp,
unsigned char* point_data);
This file defines compatibility wrappers for low level I/O functions.
Grabber interface for PCL 1.x device drivers.
Grabber for the Ocular Robotics RobotEye sensor.
PointCloud represents the base class in PCL for storing collections of 3D points. ...