Skip to content

Commit

Permalink
Cache whether an update performs a shift, and expose a method to dete…
Browse files Browse the repository at this point in the history
…rmine after an update if a shift occurred.
  • Loading branch information
mbarriault committed Oct 8, 2014
1 parent 693898b commit 32a834b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 10 additions & 0 deletions gpu/kinfu_large_scale/include/pcl/gpu/kinfu_large_scale/kinfu.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ namespace pcl
PCL_WARN("ICP is %s\n", !disable_icp_?"ENABLED":"DISABLED");
}

/** \brief Return whether the last update resulted in a shift */
inline bool
hasShifted () const
{
return (has_shifted_);
}

private:

/** \brief Allocates all GPU internal buffers.
Expand Down Expand Up @@ -440,6 +447,9 @@ namespace pcl


bool disable_icp_;

/** \brief True or false depending on if there was a shift in the last pose update */
bool has_shifted_;

public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Expand Down
7 changes: 4 additions & 3 deletions gpu/kinfu_large_scale/src/kinfu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ pcl::gpu::kinfuLS::KinfuTracker::reset ()


lost_=false;
has_shifted_=false;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -653,8 +654,8 @@ pcl::gpu::kinfuLS::KinfuTracker::operator() (const DepthMap& depth_raw)

///////////////////////////////////////////////////////////////////////////////////////////
// check if we need to shift
bool has_shifted = cyclical_.checkForShift(tsdf_volume_, getCameraPose (), 0.6 * volume_size_, true, perform_last_scan_); // TODO make target distance from camera a param
if(has_shifted)
has_shifted_ = cyclical_.checkForShift(tsdf_volume_, getCameraPose (), 0.6 * volume_size_, true, perform_last_scan_); // TODO make target distance from camera a param
if(has_shifted_)
PCL_WARN ("SHIFTING\n");

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -702,7 +703,7 @@ pcl::gpu::kinfuLS::KinfuTracker::operator() (const DepthMap& depth_raw)
pcl::device::kinfuLS::sync ();
}

if(has_shifted && perform_last_scan_)
if(has_shifted_ && perform_last_scan_)
extractAndSaveWorld ();


Expand Down

0 comments on commit 32a834b

Please sign in to comment.