33 #include <gtest/gtest.h> 45 const int w = 10, h = 5;
48 for (
int i = 0; i < w; i++)
49 for (
int j = 0; j < h; j++)
59 called[p[0]][p[1]] =
true;
64 for (
int i = 0; i < w; i++)
65 for (
int j = 0; j < h; j++)
69 ASSERT_EQ(w * h, cnt_called);
75 const char costmap0[3][3] =
81 const char costmap1[3][3] =
87 const float expected_odds[3][3] =
91 { bbf::MIN_ODDS * odds_hit * odds_miss,
bbf::MIN_ODDS, bbf::MIN_ODDS },
93 const char expected_cost[3][3] =
106 for (
int i = 0; i < 3; ++i)
107 for (
int j = 0; j < 3; ++j)
112 for (
int i = 0; i < 3; ++i)
113 for (
int j = 0; j < 3; ++j)
120 EXPECT_FLOAT_EQ(expected_odds[p[0]][p[1]], b.get()) <<
"at " << p[0] <<
", " << p[1];
124 for (
int i = 0; i < 3; ++i)
125 for (
int j = 0; j < 3; ++j)
131 EXPECT_FLOAT_EQ(
bbf::MIN_ODDS, b.get()) <<
"at " << p[0] <<
", " << p[1];
134 for (
int i = 0; i < 3; ++i)
135 for (
int j = 0; j < 3; ++j)
141 int main(
int argc,
char** argv)
143 testing::InitGoogleTest(&argc, argv);
145 return RUN_ALL_TESTS();
void remember(const BlockMemGridmapBase< char, 3, 2 > *const costmap, const Vec ¢er, const float remember_hit_odds, const float remember_miss_odds, const int range_min, const int range_max)
void reset(const CyclicVecInt< DIM, NONCYCLIC > &size)
TEST(CostmapBBF, ForEach)
void reset(const Vec &size)
char getCost(const Vec &p) const
int main(int argc, char **argv)
TFSIMD_FORCE_INLINE const tfScalar & w() const
constexpr float probabilityToOdds(const float &p)
void forEach(const std::function< void(const Vec &, bbf::BinaryBayesFilter &)> cb)