Go to the documentation of this file.00001
00004
00005
00006
00007
00008 #include <gtest/gtest.h>
00009 #include <grid_map_core/GridMap.hpp>
00010 #include "../../../include/cost_map_ros/converter.hpp"
00011
00012
00013
00014
00015
00016 TEST(ToGridMap, creation)
00017 {
00018 cost_map::CostMap cost_map;
00019 cost_map.setGeometry(cost_map::Length(3.0, 4.0), 1.0, cost_map::Position(0.0, 0.0));
00020 cost_map.add("free_space", cost_map::FREE_SPACE);
00021 cost_map.add("no_information", cost_map::NO_INFORMATION);
00022 grid_map::GridMap grid_map;
00023 cost_map::toGridMap(cost_map, grid_map);
00024 EXPECT_EQ(grid_map.getSize().x(), cost_map.getSize().x());
00025 EXPECT_EQ(grid_map.getSize().y(), cost_map.getSize().y());
00026 EXPECT_EQ(2, grid_map.getLayers().size());
00027 EXPECT_EQ(grid_map.at("free_space", grid_map::Index(0,0)), 0.0);
00028 EXPECT_EQ(grid_map.at("no_information", grid_map::Index(0,0)), 100.0);
00029 }
00030
00031
00032
00033
00034
00035
00036
00037 int main(int argc, char **argv)
00038 {
00039 testing::InitGoogleTest(&argc, argv);
00040 srand((int)time(0));
00041 return RUN_ALL_TESTS();
00042 }