34 #include <gtest/gtest.h> 42 TEST(BeamModel, LikelihoodFunc)
44 pcl::PointCloud<mcl_3dl::LidarMeasurementModelBase::PointType> pc;
45 for (
float y = -0.2;
y <= 0.2;
y += 0.1)
47 for (
float z = -0.2;
z <= 0.2;
z += 0.1)
56 pcl::PointCloud<mcl_3dl::LidarMeasurementModelBase::PointType> pc_map = pc;
74 for (
int method = 0; method < 2; ++method)
76 for (
int mode = 0; mode < 2; ++mode)
78 for (
double hr = 0.0; hr <= 1.0; hr += 0.2)
81 pnh.
setParam(
"beam/num_points", static_cast<int>(pc.size()));
82 pnh.
setParam(
"beam/beam_likelihood", 0.2);
84 pnh.
setParam(
"beam/use_raycast_using_dda", method == 1);
85 pnh.
setParam(
"beam/add_penalty_short_only_mode", mode == 1);
86 pnh.
setParam(
"beam/dda_grid_size", 0.1);
91 std::cerr <<
"use_raycast_using_dda: " << (method == 1) <<
", ";
92 std::cerr <<
"add_penalty_short_only_mode: " << (mode == 1) <<
", ";
93 std::cerr <<
"hit_range: " << hr << std::endl;
94 for (
int i = -50; i < 50; i++)
103 std::cerr << std::endl;
104 for (
int i = -50; i < 50; i++)
106 const float x = 0.1 * i;
108 const std::vector<mcl_3dl::Vec3> origins = { pos };
110 kdtree, pc.makeShared(), origins,
129 std::cerr << std::endl;
130 for (
int i = -50; i < 50; i++)
132 const float x = 0.1 * i;
153 std::cerr << std::endl;
159 int main(
int argc,
char** argv)
161 testing::InitGoogleTest(&argc, argv);
162 ros::init(argc, argv,
"test_beam_likelihood");
164 return RUN_ALL_TESTS();
std::shared_ptr< ChunkedKdtree > Ptr
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void setInputCloud(const typename pcl::PointCloud< POINT_TYPE >::ConstPtr &cloud)
TFSIMD_FORCE_INLINE const tfScalar & y() const
LidarMeasurementResult measure(ChunkedKdtree< PointType >::Ptr &kdtree, const pcl::PointCloud< PointType >::ConstPtr &pc, const std::vector< Vec3 > &origins, const State6DOF &s) const
TEST(BeamModel, LikelihoodFunc)
BeamStatus getBeamStatus(ChunkedKdtree< PointType >::Ptr &kdtree, const Vec3 &beam_begin, const Vec3 &beam_end, typename mcl_3dl::Raycast< PointType >::CastResult &result) const
int main(int argc, char **argv)
TFSIMD_FORCE_INLINE const tfScalar & x() const
TFSIMD_FORCE_INLINE const tfScalar & z() const
void loadConfig(const ros::NodeHandle &nh, const std::string &name)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const