Skip to content

Commit

Permalink
renames the k4w2 class and the examples to freenect2_ to have a more …
Browse files Browse the repository at this point in the history
…intuitive name
  • Loading branch information
Giacomo Dabisias committed Jan 14, 2016
1 parent 3e652fe commit 34716c7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
12 changes: 6 additions & 6 deletions io/include/pcl/io/freenect2_grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ namespace pcl
CPU, OPENCL, OPENGL
};

class PCL_EXPORTS k4w2Grabber : public Grabber
class PCL_EXPORTS Freenect2Grabber : public Grabber
{
public:
typedef
void (sig_cb_k4w2_point_cloud_rgb)
void (sig_cb_freenect2_point_cloud_rgb)
(const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&);

k4w2Grabber(processor p = CPU, std::string serial = std::string());
Freenect2Grabber(processor p = CPU, std::string serial = std::string());
virtual
~k4w2Grabber() throw();
~Freenect2Grabber() throw();

virtual bool
isRunning() const;
Expand All @@ -85,7 +85,7 @@ class PCL_EXPORTS k4w2Grabber : public Grabber
virtual std::string
getName() const
{
return (std::string("K4W2Grabber"));
return (std::string("Freenect2Grabber"));
}

virtual std::string
Expand All @@ -104,7 +104,7 @@ class PCL_EXPORTS k4w2Grabber : public Grabber
void prepareMake3D(const libfreenect2::Freenect2Device::IrCameraParams & depth_p);

// Signals to indicate whether new clouds are available
boost::signals2::signal<sig_cb_k4w2_point_cloud_rgb>* point_cloud_rgb_signal_;
boost::signals2::signal<sig_cb_freenect2_point_cloud_rgb>* point_cloud_rgb_signal_;

boost::thread thread_;

Expand Down
24 changes: 12 additions & 12 deletions io/src/freenect2_grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <pcl/io/freenect2_grabber.h>
#include <libfreenect2/packet_pipeline.h>

pcl::k4w2Grabber::k4w2Grabber (processor p,
pcl::Freenect2Grabber::Freenect2Grabber (processor p,
std::string serial) :
Grabber (),
is_running_ (false),
Expand Down Expand Up @@ -100,33 +100,33 @@ pcl::k4w2Grabber::k4w2Grabber (processor p,
dev_->setColorFrameListener (listener_);
dev_->setIrAndDepthFrameListener (listener_);

point_cloud_rgb_signal_ = createSignal<sig_cb_k4w2_point_cloud_rgb> ();
point_cloud_rgb_signal_ = createSignal<sig_cb_freenect2_point_cloud_rgb> ();
}

pcl::k4w2Grabber::~k4w2Grabber () throw ()
pcl::Freenect2Grabber::~Freenect2Grabber () throw ()
{
dev_->stop ();
dev_->close ();

disconnect_all_slots<sig_cb_k4w2_point_cloud_rgb> ();
disconnect_all_slots<sig_cb_freenect2_point_cloud_rgb> ();
}

void
pcl::k4w2Grabber::start ()
pcl::Freenect2Grabber::start ()
{
if (!is_running_)
{
need_xyzrgb_ = num_slots<sig_cb_k4w2_point_cloud_rgb> () > 0;
need_xyzrgb_ = num_slots<sig_cb_freenect2_point_cloud_rgb> () > 0;

frequency_.reset ();

is_running_ = true;
thread_ = boost::thread (&k4w2Grabber::run, this);
thread_ = boost::thread (&Freenect2Grabber::run, this);
}
}

void
pcl::k4w2Grabber::stop ()
pcl::Freenect2Grabber::stop ()
{
if (is_running_)
{
Expand All @@ -136,20 +136,20 @@ pcl::k4w2Grabber::stop ()
}

bool
pcl::k4w2Grabber::isRunning () const
pcl::Freenect2Grabber::isRunning () const
{
return (is_running_);
}

float
pcl::k4w2Grabber::getFramesPerSecond () const
pcl::Freenect2Grabber::getFramesPerSecond () const
{
boost::mutex::scoped_lock lock (fps_mutex_);
return (frequency_.getFrequency ());
}

void
pcl::k4w2Grabber::prepareMake3D (const libfreenect2::Freenect2Device::IrCameraParams & depth_p)
pcl::Freenect2Grabber::prepareMake3D (const libfreenect2::Freenect2Device::IrCameraParams & depth_p)
{
const int w = 512;
const int h = 424;
Expand All @@ -166,7 +166,7 @@ pcl::k4w2Grabber::prepareMake3D (const libfreenect2::Freenect2Device::IrCameraPa
}

void
pcl::k4w2Grabber::run ()
pcl::Freenect2Grabber::run ()
{
dev_->start ();

Expand Down
22 changes: 11 additions & 11 deletions visualization/tools/freenect2_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ printHelp (int,
}

template <typename PointT>
class k4w2Viewer
class Freenect2Viewer
{

public:

typedef pcl::PointCloud<PointT> PointCloudT;

k4w2Viewer (pcl::k4w2Grabber& grabber) :
Freenect2Viewer (pcl::Freenect2Grabber& grabber) :
grabber_ (grabber),
viewer_ ("k4w2 Viewer")
viewer_ ("Freenect2 Viewer")
{
viewer_.setCameraFieldOfView (0.785398); // approximately 45 degrees
viewer_.setCameraPosition (0, 0, 0, 0, 0, 1, 0, 1, 0);
viewer_.registerKeyboardCallback (&k4w2Viewer::keyboardCallback, *this);
viewer_.registerPointPickingCallback (&k4w2Viewer::pointPickingCallback, *this);
viewer_.registerKeyboardCallback (&Freenect2Viewer::keyboardCallback, *this);
viewer_.registerPointPickingCallback (&Freenect2Viewer::pointPickingCallback, *this);
}

~k4w2Viewer ()
~Freenect2Viewer ()
{
connection_.disconnect ();
}
Expand All @@ -86,7 +86,7 @@ class k4w2Viewer
run ()
{
boost::function<void
(const typename PointCloudT::ConstPtr&)> f = boost::bind (&k4w2Viewer::cloudCallback, this, _1);
(const typename PointCloudT::ConstPtr&)> f = boost::bind (&Freenect2Viewer::cloudCallback, this, _1);
connection_ = grabber_.registerCallback (f);
grabber_.start ();

Expand Down Expand Up @@ -152,7 +152,7 @@ class k4w2Viewer
pcl::console::print_value ("%.3f\n", z);
}

pcl::k4w2Grabber& grabber_;
pcl::Freenect2Grabber& grabber_;
pcl::visualization::PCLVisualizer viewer_;
boost::signals2::connection connection_;

Expand All @@ -165,7 +165,7 @@ int
main (int argc,
char** argv)
{
print_info ("Viewer for K4W2 devices (run with --help for more information)\n", argv[0]);
print_info ("Viewer for Freenect2 devices (run with --help for more information)\n", argv[0]);

if (find_switch (argc, argv, "--help") || find_switch (argc, argv, "-h"))
{
Expand All @@ -189,9 +189,9 @@ main (int argc,

try
{
pcl::k4w2Grabber grabber (pcl::OPENGL);
pcl::Freenect2Grabber grabber (pcl::OPENGL);

k4w2Viewer<pcl::PointXYZRGB> viewer (grabber);
Freenect2Viewer<pcl::PointXYZRGB> viewer (grabber);
viewer.run ();
}
catch (pcl::io::IOException& e)
Expand Down

0 comments on commit 34716c7

Please sign in to comment.