7#include <gtsam_points/util/gtsam_migration.hpp>
8#include <gtsam_points/types/point_cloud.hpp>
9#include <gtsam_points/types/gaussian_voxelmap_gpu.hpp>
10#include <gtsam_points/factors/nonlinear_factor_gpu.hpp>
18namespace gtsam_points {
20class LinearizedSystem6;
21class IntegratedVGICPDerivatives;
22class TempBufferManager;
31 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32 using shared_ptr = gtsam_points::shared_ptr<IntegratedVGICPFactorGPU>;
44 gtsam::Key target_key,
45 gtsam::Key source_key,
46 const GaussianVoxelMap::ConstPtr& target,
47 const PointCloud::ConstPtr& source,
48 CUstream_st* stream =
nullptr,
49 std::shared_ptr<TempBufferManager> temp_buffer =
nullptr);
61 const gtsam::Pose3& fixed_target_pose,
62 gtsam::Key source_key,
63 const GaussianVoxelMap::ConstPtr& target,
64 const PointCloud::ConstPtr& source,
65 CUstream_st* stream =
nullptr,
66 std::shared_ptr<TempBufferManager> temp_buffer =
nullptr);
71 virtual void print(
const std::string& s =
"",
const gtsam::KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter)
const override;
103 GaussianVoxelMapGPU::ConstPtr
get_target()
const {
return target; }
112 virtual gtsam::NonlinearFactor::shared_ptr clone()
const override;
114 virtual size_t dim()
const override {
return 6; }
115 virtual double error(
const gtsam::Values& values)
const override;
116 virtual gtsam::GaussianFactor::shared_ptr linearize(
const gtsam::Values& values)
const override;
124 virtual void issue_linearize(
const void* lin_input_cpu,
const void* lin_input_gpu,
void* lin_output_gpu)
override;
129 const void* lin_input_cpu,
130 const void* eval_input_cpu,
131 const void* lin_input_gpu,
132 const void* eval_input_gpu,
133 void* eval_output_gpu)
override;
139 Eigen::Isometry3f calc_delta(
const gtsam::Values& values)
const;
143 Eigen::Isometry3f fixed_target_pose;
145 GaussianVoxelMapGPU::ConstPtr target;
146 PointCloud::ConstPtr source;
148 std::unique_ptr<IntegratedVGICPDerivatives> derivatives;
150 mutable bool linearized;
151 mutable Eigen::Isometry3f linearization_point;
153 mutable std::optional<float> evaluation_result;
154 mutable std::unique_ptr<LinearizedSystem6> linearization_result;
GPU-accelerated Voxelized GICP matching cost factor Koide et al., "Voxelized GICP for Fast and Accura...
Definition integrated_vgicp_factor_gpu.hpp:29
virtual void issue_compute_error(const void *lin_input_cpu, const void *eval_input_cpu, const void *lin_input_gpu, const void *eval_input_gpu, void *eval_output_gpu) override
Issue cost evaluation task.
IntegratedVGICPFactorGPU(gtsam::Key target_key, gtsam::Key source_key, const GaussianVoxelMap::ConstPtr &target, const PointCloud::ConstPtr &source, CUstream_st *stream=nullptr, std::shared_ptr< TempBufferManager > temp_buffer=nullptr)
Create a binary VGICP_GPU factor between target and source poses.
virtual void set_linearization_point(const gtsam::Values &values, void *lin_input_cpu) override
Write linearization input data to the upload buffer.
virtual void issue_linearize(const void *lin_input_cpu, const void *lin_input_gpu, void *lin_output_gpu) override
Issue linearization task.
virtual void store_linearized(const void *lin_output_cpu) override
Read linearization output data from the download buffer.
virtual size_t evaluation_input_size() const override
Size of data to be uploaded to the GPU before cost evaluation.
virtual size_t linearization_input_size() const override
Size of data to be uploaded to the GPU before linearization.
Eigen::Isometry3f get_fixed_target_pose() const
Get the pose of the fixed target. This function is only valid for unary factors.
Definition integrated_vgicp_factor_gpu.hpp:106
virtual void store_computed_error(const void *eval_output_cpu) override
Read cost evaluation output data from the download buffer.
IntegratedVGICPFactorGPU(const gtsam::Pose3 &fixed_target_pose, gtsam::Key source_key, const GaussianVoxelMap::ConstPtr &target, const PointCloud::ConstPtr &source, CUstream_st *stream=nullptr, std::shared_ptr< TempBufferManager > temp_buffer=nullptr)
Create a unary VGICP_GPU factor between a fixed target pose and an active source pose.
virtual size_t linearization_output_size() const override
Size of data to be downloaded from the GPU after linearization.
size_t memory_usage() const
Calculate the CPU memory usage of this factor.
virtual size_t evaluation_output_size() const override
Size of data to be downloaded from the GPU after cost evaluation.
size_t memory_usage_gpu() const
Calculate the GPU memory usage of this factor.
virtual void set_evaluation_point(const gtsam::Values &values, void *eval_input_cpu) override
Write cost evaluation input data to the upload buffer.
virtual void sync() override
Perform CPU-GPU synchronization and wait for the task.
GaussianVoxelMapGPU::ConstPtr get_target() const
Get the target voxelmap.
Definition integrated_vgicp_factor_gpu.hpp:103
void set_inlier_update_thresh(double trans, double angle)
Set the threshold values to trigger inlier points update. Setting larger values reduces GPU sync but ...
void set_enable_offloading(bool enable)
Enable or disable GPU memory offloading.
int num_inliers() const
Get the number of inlier points.
double inlier_fraction() const
Get the fraction of inlier points.
void set_enable_surface_validation(bool enable)
Enable or disable surface orientation validation for correspondence search.
virtual void print(const std::string &s="", const gtsam::KeyFormatter &keyFormatter=gtsam::DefaultKeyFormatter) const override
Print the factor information.
Base class for GPU-based nonlinear factors.
Definition nonlinear_factor_gpu.hpp:37