1 #include <gtest/gtest.h> 7 #define GTEST_COUT std::cerr << "[ INFO ] " 9 TEST(Inflation, active)
18 TEST(Inflation, layers_dont_exist)
28 if(!filterChain.
configure(
"mitre_fast_layered_map_filters", nh))
30 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
33 EXPECT_FALSE(filterChain.
update(gridMap, gridMap));
36 gridMap.add(
"nonground", 0);
37 EXPECT_TRUE(filterChain.
update(gridMap, gridMap));
65 gridMap.
add(
"nonground", 0);
69 if(!filterChain.
configure(
"mitre_fast_layered_map_filters", nh))
71 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
74 if(!filterChain.
update(gridMap, gridMap))
76 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
83 EXPECT_EQ(0, gridMap.
at(
"nonground", index));
113 gridMap.
add(
"nonground", 0);
118 if(!filterChain.
configure(
"mitre_fast_layered_map_filters", nh))
120 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
123 if(!filterChain.
update(gridMap, gridMap))
125 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
132 if (index(0) == 1 && index(1) == 1)
134 EXPECT_EQ(100, gridMap.
at(
"nonground", index));
138 EXPECT_EQ(30, gridMap.
at(
"nonground", index)) <<
139 "Index: " << index(0) <<
" " << index(1);
163 TEST(Inflation, center_filled_small_radius)
172 gridMap.
add(
"nonground", 0);
176 Eigen::MatrixXi answerMat(5,5);
186 if(!filterChain.
configure(
"mitre_fast_layered_map_filters_low_inflation", nh))
188 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
191 if(!filterChain.
update(gridMap, gridMap))
193 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
200 EXPECT_EQ(answerMat(index(0), index(1)), gridMap.
at(
"nonground", index)) <<
201 "Index: " << index(0) <<
" " << index(1);
236 gridMap.add(
"nonground", 0);
245 Eigen::MatrixXi answerMat(5, 5);
249 100, 30, 30, 30, 100,
256 if(!filterChain.
configure(
"mitre_fast_layered_map_filters", nh))
258 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
261 if(!filterChain.
update(gridMap, gridMap))
263 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
270 EXPECT_EQ(answerMat(index(0), index(1)), gridMap.at(
"nonground", index)) <<
271 "Index: " << index(0) <<
" " << index(1);
284 gridMap.add(
"nonground", 0);
288 gridMap[
"nonground"] = (gridMap[
"nonground"].array().isNaN()).select(0, gridMap[
"nonground"]);
291 Eigen::MatrixXi answerMat(5, 5);
301 if(!filterChain.
configure(
"mitre_fast_layered_map_filters_low_inflation", nh))
303 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
306 if(!filterChain.
update(gridMap, gridMap))
308 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
315 EXPECT_EQ(answerMat(index(0), index(1)), gridMap.at(
"nonground", index)) <<
316 "Index: " << index(0) <<
" " << index(1);
328 gridMap.add(
"nonground", 0);
332 gridMap[
"nonground"] = (gridMap[
"nonground"].array().isNaN()).select(0, gridMap[
"nonground"]);
335 Eigen::MatrixXi answerMat(5, 5);
345 if(!filterChain.
configure(
"mitre_fast_layered_map_filters_low_inflation", nh))
347 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
350 if(!filterChain.
update(gridMap, gridMap))
352 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
359 EXPECT_EQ(answerMat(index(0), index(1)), gridMap.at(
"nonground", index)) <<
360 "Index: " << index(0) <<
" " << index(1);
372 gridMap.add(
"nonground", 0);
376 gridMap[
"nonground"] = (gridMap[
"nonground"].array().isNaN()).select(0, gridMap[
"nonground"]);
379 Eigen::MatrixXi answerMat(5, 5);
389 if(!filterChain.
configure(
"mitre_fast_layered_map_filters_low_inflation", nh))
391 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
394 if(!filterChain.
update(gridMap, gridMap))
396 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
403 EXPECT_EQ(answerMat(index(0), index(1)), gridMap.at(
"nonground", index)) <<
404 "Index: " << index(0) <<
" " << index(1);
416 gridMap.add(
"nonground", 0);
420 gridMap[
"nonground"] = (gridMap[
"nonground"].array().isNaN()).select(0, gridMap[
"nonground"]);
423 Eigen::MatrixXi answerMat(5, 5);
433 if(!filterChain.
configure(
"mitre_fast_layered_map_filters_low_inflation", nh))
435 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
438 if(!filterChain.
update(gridMap, gridMap))
440 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
447 EXPECT_EQ(answerMat(index(0), index(1)), gridMap.at(
"nonground", index)) <<
448 "Index: " << index(0) <<
" " << index(1);
460 gridMap.add(
"nonground", 0);
464 gridMap[
"nonground"] = (gridMap[
"nonground"].array().isNaN()).select(0, gridMap[
"nonground"]);
467 Eigen::MatrixXi answerMat(5, 5);
477 if(!filterChain.
configure(
"mitre_fast_layered_map_filters_low_inflation", nh))
479 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
482 if(!filterChain.
update(gridMap, gridMap))
484 GTEST_FATAL_FAILURE_(
"Unable to update grid map.");
491 EXPECT_EQ(answerMat(index(0), index(1)), gridMap.at(
"nonground", index)) <<
492 "Index: " << index(0) <<
" " << index(1);
510 gridMap.add(
"nonground", 0);
514 if(!filterChain.
configure(
"mitre_fast_layered_map_filters", nh))
516 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
526 EXPECT_NO_FATAL_FAILURE(filterChain.
update(gridMap, gridMap));
537 gridMap.add(
"nonground", 0);
541 if(!filterChain.
configure(
"mitre_fast_layered_map_filters", nh))
543 GTEST_FATAL_FAILURE_(
"Unable to configure filter chain.");
546 for (
int i = 0; i < 100; i++)
549 int t = i > 50 ? i: -i;
562 EXPECT_NO_FATAL_FAILURE(filterChain.
update(gridMap, gridMap));
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
geometry_msgs::TransformStamped t
float & at(const std::string &layer, const Index &index)
void add(const std::string &layer, const double value=NAN)
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)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)