to_grid_map.cpp
Go to the documentation of this file.
1 
4 /*****************************************************************************
5 ** Includes
6 *****************************************************************************/
7 
8 #include <gtest/gtest.h>
10 #include "../../../include/cost_map_ros/converter.hpp"
11 
12 /*****************************************************************************
13 ** Tests
14 *****************************************************************************/
15 
16 TEST(ToGridMap, creation)
17 {
19  cost_map.setGeometry(cost_map::Length(3.0, 4.0), 1.0, cost_map::Position(0.0, 0.0));
20  cost_map.add("free_space", cost_map::FREE_SPACE);
21  cost_map.add("no_information", cost_map::NO_INFORMATION);
23  cost_map::toGridMap(cost_map, grid_map);
24  EXPECT_EQ(grid_map.getSize().x(), cost_map.getSize().x());
25  EXPECT_EQ(grid_map.getSize().y(), cost_map.getSize().y());
26  EXPECT_EQ(2, grid_map.getLayers().size());
27  EXPECT_EQ(grid_map.at("free_space", grid_map::Index(0,0)), 0.0);
28  EXPECT_EQ(grid_map.at("no_information", grid_map::Index(0,0)), 100.0);
29 }
30 
31 
32 /*****************************************************************************
33 ** Main
34 *****************************************************************************/
35 
36 // Run all the tests that were declared with TEST()
37 int main(int argc, char **argv)
38 {
39  testing::InitGoogleTest(&argc, argv);
40  srand((int)time(0));
41  return RUN_ALL_TESTS();
42 }
int main(int argc, char **argv)
Definition: to_grid_map.cpp:37
const unsigned char NO_INFORMATION
Eigen::Array2i Index
const Size & getSize() const
void add(const std::string &layer, const DataType value=NO_INFORMATION)
const unsigned char FREE_SPACE
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
const std::vector< std::string > & getLayers() const
TEST(ToGridMap, creation)
Definition: to_grid_map.cpp:16
float & at(const std::string &layer, const Index &index)
grid_map::Position Position
grid_map::Length Length
void toGridMap(const cost_map::CostMap cost_map, grid_map::GridMap &grid_map)
Convert a cost map object into a grid map object.
Definition: converter.cpp:130
const Size & getSize() const


cost_map_ros
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:03:48