43 #include <pcl/io/grabber.h>
44 #include <pcl/point_cloud.h>
47 #include <librealsense2/rs.hpp>
66 RealSense2Grabber (
const std::string& file_name_or_serial_number =
"",
const bool repeat_playback =
true );
79 device_width_ = width;
80 device_height_ = height;
105 return {
"RealSense2Grabber"}; }
166 template <
typename Po
intT,
typename Functor>
204 bool running_{
false};
208 std::uint32_t device_width_{424};
210 std::uint32_t device_height_{240};
212 std::uint32_t target_fps_{30};
Grabber interface for PCL 1.x device drivers.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Grabber for Intel Realsense 2 SDK devices (D400 series)
std::thread thread_
handle to the thread
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr convertRGBADepthToPointXYZRGBA(const rs2::points &points, const rs2::video_frame &rgb)
Convert an rgb Depth image to a pcl::PointCloud<pcl::PointXYZRGBA>
boost::signals2::signal< signal_librealsense_PointXYZ > * signal_PointXYZ
float getFramesPerSecond() const override
Obtain the number of frames per second (FPS).
void threadFunction()
the thread function
static std::uint8_t getTextureIntensity(const rs2::video_frame &texture, float u, float v)
Retrieve color intensity from texture video frame.
RealSense2Grabber(const std::string &file_name_or_serial_number="", const bool repeat_playback=true)
Constructor.
void(const pcl::PointCloud< pcl::PointXYZI >::ConstPtr &) signal_librealsense_PointXYZI
~RealSense2Grabber() override
virtual Destructor inherited from the Grabber interface.
boost::signals2::signal< signal_librealsense_PointXYZRGBA > * signal_PointXYZRGBA
void(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &) signal_librealsense_PointXYZ
void stop() override
Stop the data acquisition.
pcl::PointCloud< pcl::PointXYZRGB >::Ptr convertRGBDepthToPointXYZRGB(const rs2::points &points, const rs2::video_frame &rgb)
Convert an rgb Depth image to a pcl::PointCloud<pcl::PointXYZRGB>
pcl::PointCloud< PointT >::Ptr convertRealsensePointsToPointCloud(const rs2::points &points, Functor mapColorFunc)
template function to convert realsense point cloud to PCL point cloud
boost::signals2::signal< signal_librealsense_PointXYZI > * signal_PointXYZI
pcl::PointCloud< pcl::PointXYZI >::Ptr convertIntensityDepthToPointXYZRGBI(const rs2::points &points, const rs2::video_frame &ir)
Convert an Infrared Depth image to a pcl::PointCloud<pcl::PointXYZI>
void(const pcl::PointCloud< pcl::PointXYZRGBA >::ConstPtr &) signal_librealsense_PointXYZRGBA
std::string file_name_or_serial_number_
Defines either a file path to a bag file or a realsense device serial number.
void(const pcl::PointCloud< pcl::PointXYZRGB >::ConstPtr &) signal_librealsense_PointXYZRGB
rs2::pointcloud pc_
Declare pointcloud object, for calculating pointclouds and texture mappings.
void reInitialize()
Dynamic reinitialization.
void setDeviceOptions(std::uint32_t width, std::uint32_t height, std::uint32_t fps=30)
Set the device options.
void signalsChanged() override
Handle when a signal callback has been changed.
static size_t getTextureIdx(const rs2::video_frame &texture, float u, float v)
Retrieve pixel index for UV texture coordinate.
pcl::PointCloud< pcl::PointXYZ >::Ptr convertDepthToPointXYZ(const rs2::points &points)
Convert a Depth image to a pcl::PointCloud<pcl::PointXYZ>
bool repeat_playback_
Repeat playback when reading from file.
static pcl::RGB getTextureColor(const rs2::video_frame &texture, float u, float v)
Retrieve RGB color from texture video frame.
bool isRunning() const override
Check if the data acquisition is still running.
rs2::pipeline pipe_
Declare RealSense pipeline, encapsulating the actual device and sensors.
void start() override
Start the data acquisition.
boost::signals2::signal< signal_librealsense_PointXYZRGB > * signal_PointXYZRGB
std::string getName() const override
defined grabber name
Defines all the PCL implemented PointT point type structures.
Base functor all the models that need non linear optimization must define their own one and implement...
A structure representing RGB color information.