41 #include <pcl/gpu/kinfu_large_scale/tsdf_volume.h>
42 #include <pcl/gpu/kinfu_large_scale/tsdf_buffer.h>
45 #include <cuda_runtime.h>
46 #include <pcl/gpu/kinfu_large_scale/point_intensity.h>
48 #include <pcl/gpu/kinfu_large_scale/world_model.h>
51 #include <pcl/io/pcd_io.h>
73 CyclicalBuffer (
const double distance_threshold,
const double cube_size = 3.f,
const int nb_voxels_per_axis = 512)
75 distance_threshold_ = distance_threshold;
76 buffer_.volume_size.x = cube_size;
77 buffer_.volume_size.y = cube_size;
78 buffer_.volume_size.z = cube_size;
79 buffer_.voxels_size.x = nb_voxels_per_axis;
80 buffer_.voxels_size.y = nb_voxels_per_axis;
81 buffer_.voxels_size.z = nb_voxels_per_axis;
94 CyclicalBuffer (
const double distance_threshold,
const double volume_size_x,
const double volume_size_y,
const double volume_size_z,
const int nb_voxels_x,
const int nb_voxels_y,
const int nb_voxels_z)
96 distance_threshold_ = distance_threshold;
97 buffer_.volume_size.x = volume_size_x;
98 buffer_.volume_size.y = volume_size_y;
99 buffer_.volume_size.z = volume_size_z;
100 buffer_.voxels_size.x = nb_voxels_x;
101 buffer_.voxels_size.y = nb_voxels_y;
102 buffer_.voxels_size.z = nb_voxels_z;
116 bool checkForShift (
const TsdfVolume::Ptr volume,
const Eigen::Affine3f &cam_pose,
const double distance_camera_target,
const bool perform_shift =
true,
const bool last_shift =
false,
const bool force_shift =
false);
137 distance_threshold_ = threshold;
154 void setVolumeSize (
const double size_x,
const double size_y,
const double size_z)
156 buffer_.volume_size.x = size_x;
157 buffer_.volume_size.y = size_y;
158 buffer_.volume_size.z = size_z;
166 buffer_.volume_size.x = size;
167 buffer_.volume_size.y = size;
168 buffer_.volume_size.z = size;
186 buffer_.tsdf_memory_start = &(localVolume.
ptr (0)[0]);
187 buffer_.tsdf_memory_end = &(localVolume.
ptr (buffer_.voxels_size.y * (buffer_.voxels_size.z - 1) + (buffer_.voxels_size.y - 1) )[buffer_.voxels_size.x - 1]);
188 buffer_.tsdf_rolling_buff_origin = buffer_.tsdf_memory_start;
196 buffer_.origin_GRID.x = 0; buffer_.origin_GRID.y = 0; buffer_.origin_GRID.z = 0;
197 buffer_.origin_GRID_global.x = 0.f; buffer_.origin_GRID_global.y = 0.f; buffer_.origin_GRID_global.z = 0.f;
198 buffer_.origin_metric.x = 0.f; buffer_.origin_metric.y = 0.f; buffer_.origin_metric.z = 0.f;
199 initBuffer (tsdf_volume);
207 return (&world_model_);
220 double distance_threshold_;
234 void shiftOrigin (
TsdfVolume::Ptr tsdf_volume,
const int offset_x,
const int offset_y,
const int offset_z)
CyclicalBuffer implements a cyclical TSDF buffer.
void computeAndSetNewCubeMetricOrigin(const pcl::PointXYZ &target_point, int &shiftX, int &shiftY, int &shiftZ)
Computes and set the origin of the new cube (relative to the world), centered around a the target poi...
void setVolumeSize(const double size)
Set the physical size represented by the default TSDF volume.
void resetBuffer(TsdfVolume::Ptr tsdf_volume)
Reset buffer structure.
tsdf_buffer * getBuffer()
get a pointer to the tsdf_buffer structure.
void setDistanceThreshold(const double threshold)
Sets the distance threshold between cube's center and target point that triggers a shift.
bool checkForShift(const TsdfVolume::Ptr volume, const Eigen::Affine3f &cam_pose, const double distance_camera_target, const bool perform_shift=true, const bool last_shift=false, const bool force_shift=false)
Check if shifting needs to be performed, returns true if so.
CyclicalBuffer(const double distance_threshold, const double volume_size_x, const double volume_size_y, const double volume_size_z, const int nb_voxels_x, const int nb_voxels_y, const int nb_voxels_z)
Constructor for a non-cubic CyclicalBuffer.
float getDistanceThreshold()
Returns the distance threshold between cube's center and target point that triggers a shift.
void initBuffer(TsdfVolume::Ptr tsdf_volume)
Initializes memory pointers of the cyclical buffer (start, end, current origin)
void performShift(const TsdfVolume::Ptr volume, const pcl::PointXYZ &target_point, const bool last_shift=false)
Perform shifting operations: Compute offsets.
void setVolumeSize(const double size_x, const double size_y, const double size_z)
Set the physical size represented by the default TSDF volume.
pcl::kinfuLS::WorldModel< pcl::PointXYZI > * getWorldModel()
Return a pointer to the world model.
CyclicalBuffer(const double distance_threshold, const double cube_size=3.f, const int nb_voxels_per_axis=512)
Constructor for a cubic CyclicalBuffer.
shared_ptr< TsdfVolume > Ptr
Defines all the PCL implemented PointT point type structures.
A point structure representing Euclidean xyz coordinates.
__PCL_GPU_HOST_DEVICE__ T * ptr(int y=0)
Structure to handle buffer addresses.
short2 * tsdf_memory_start
Address of the first element of the TSDF volume in memory.
short2 * tsdf_memory_end
Address of the last element of the TSDF volume in memory.
short2 * tsdf_rolling_buff_origin
Memory address of the origin of the rolling buffer.
int3 voxels_size
Number of voxels in the volume, per axis.
int3 origin_GRID
Internal cube origin for rollign buffer.
float3 origin_GRID_global
Cube origin in world coordinates.