40 #include "pcl/pcl_config.h"
42 #include <pcl/io/grabber.h>
43 #include <pcl/io/impl/synchronized_queue.hpp>
45 #include <pcl/point_cloud.h>
47 #include <boost/asio.hpp>
48 #include <boost/shared_array.hpp>
73 RobotEyeGrabber (
const boost::asio::ip::address& ipAddress,
unsigned short port=443);
80 void start () override;
83 void stop () override;
88 std::
string getName () const override;
93 bool isRunning () const override;
97 float getFramesPerSecond () const override;
102 void setSensorAddress (const
boost::asio::ip::address& ipAddress);
103 const
boost::asio::ip::address& getSensorAddress () const;
108 void setDataPort (
unsigned short port);
109 unsigned short getDataPort () const;
114 void setSignalPointCloudSize (std::
size_t numerOfPoints);
115 std::
size_t getSignalPointCloudSize () const;
125 bool terminate_thread_;
126 std::
size_t signal_point_cloud_size_;
127 unsigned short data_port_;
128 enum { MAX_LENGTH = 65535 };
129 unsigned char receive_buffer_[MAX_LENGTH];
130 unsigned int data_size_;
132 boost::asio::ip::address sensor_address_;
133 boost::asio::ip::udp::endpoint sender_endpoint_;
134 boost::asio::io_service io_service_;
135 std::shared_ptr<boost::asio::ip::udp::socket> socket_;
136 std::shared_ptr<std::thread> socket_thread_;
137 std::shared_ptr<std::thread> consumer_thread_;
141 boost::signals2::signal<sig_cb_robot_eye_point_cloud_xyzi>* point_cloud_signal_;
143 void consumerThreadLoop ();
144 void socketThreadLoop ();
145 void asyncSocketReceive ();
146 void resetPointCloud ();
147 void socketCallback (
const boost::system::error_code& error, std::size_t number_of_bytes);
148 void convertPacketData (
unsigned char *data_packet, std::size_t length);
149 void computeXYZI (
pcl::PointXYZI& point_XYZI,
unsigned char* point_data);
150 void computeTimestamp (std::uint32_t& timestamp,
unsigned char* point_data);
Grabber interface for PCL 1.x device drivers.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Grabber for the Ocular Robotics RobotEye sensor.
RobotEyeGrabber(const boost::asio::ip::address &ipAddress, unsigned short port=443)
RobotEyeGrabber constructor taking a specified IP address and data port.
~RobotEyeGrabber() noexcept
virtual Destructor inherited from the Grabber interface.
void(const pcl::PointCloud< pcl::PointXYZI >::ConstPtr &) sig_cb_robot_eye_point_cloud_xyzi
Signal used for the point cloud callback.
RobotEyeGrabber()
RobotEyeGrabber default constructor.
Defines all the PCL implemented PointT point type structures.
Defines functions, macros and traits for allocating and using memory.