1 #include <gtest/gtest.h> 7 #define GTEST_COUT std::cerr << "[ INFO ] " 9 TEST(BayesUpdate, active)
18 TEST(BayesUpdate, layers_dont_exist)
28 if (!filterChain.
configure(
"mitre_fast_layered_map_filters_bayes_update", nh))
30 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
33 EXPECT_FALSE(filterChain.
update(gridMap, gridMap));
36 gridMap.add(
"current_probability", 0);
37 EXPECT_FALSE(filterChain.
update(gridMap, gridMap));
40 gridMap.add(
"history_0", 0);
41 gridMap.add(
"history_1", 0);
42 EXPECT_FALSE(filterChain.
update(gridMap, gridMap));
45 gridMap.add(
"history_2", 0);
46 gridMap.add(
"history_3", 0);
47 EXPECT_TRUE(filterChain.
update(gridMap, gridMap));
73 if (!filterChain.
configure(
"mitre_fast_layered_map_filters_bayes_update", nh))
75 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
79 gridMap.add(
"history_0", -1);
80 gridMap.add(
"history_1", -1);
81 gridMap.add(
"history_2", -1);
82 gridMap.add(
"history_3", -1);
89 gridMap[
"history_0"] <<
95 Eigen::MatrixXf answerMat(3, 3);
96 answerMat << (2.0 / 3), (2.0 / 3), (1.0 / 3),
97 (1.0 / 3), (1.0 / 3), (1.0 / 3),
98 (1.0 / 3), (1.0 / 3), (1.0 / 3);
100 if (!filterChain.
update(gridMap, gridMap))
102 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
109 EXPECT_FLOAT_EQ(answerMat(index(0), index(1)), gridMap.at(
"current_probability", index)) <<
"Index: " << index(0) <<
" " << index(1);
117 gridMap[
"history_1"] <<
123 answerMat << 0.8, 0.5, 0.2,
127 if (!filterChain.
update(gridMap, gridMap))
129 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
136 EXPECT_FLOAT_EQ(answerMat(index(0), index(1)), gridMap.at(
"current_probability", index)) <<
"Index: " << index(0) <<
" " << index(1);
154 if (!filterChain.
configure(
"mitre_fast_layered_map_filters_bayes_update", nh))
156 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
164 gridMap.add(
"history_0", -1);
165 gridMap.add(
"history_1", -1);
166 gridMap.add(
"history_2", -1);
167 gridMap.add(
"history_3", -1);
169 gridMap[
"history_0"] <<
176 Eigen::MatrixXf answerMat(3, 3);
177 answerMat << (1.0 / 3), (2.0 / 3), 0.8333333,
178 0.9836, 0.9859, 0.9876,
181 if (!filterChain.
update(gridMap, gridMap))
183 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
190 EXPECT_NEAR(answerMat(index(0), index(1)), gridMap.at(
"current_probability", index), 0.001) <<
"Index: " << index(0) <<
" " << index(1);
197 gridMap[
"history_1"] <<
203 answerMat << 0.9722, 0.9917, 0.714285,
204 0.9997, 0.9971, 0.9937,
205 0.9998, 0.9998, 0.9998;
207 if (!filterChain.
update(gridMap, gridMap))
209 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
216 EXPECT_NEAR(answerMat(index(0), index(1)), gridMap.at(
"current_probability", index), 0.001) <<
"Index: " << index(0) <<
" " << index(1);
TEST(BayesUpdate, active)
bool update(const T &data_in, T &data_out)
bool configure(std::string param_name, ros::NodeHandle node=ros::NodeHandle())
Filters that operate on a grid map instance.
void setFrameId(const std::string &frameId)