本文整理汇总了C++中GridMap::move方法的典型用法代码示例。如果您正苦于以下问题:C++ GridMap::move方法的具体用法?C++ GridMap::move怎么用?C++ GridMap::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridMap
的用法示例。
在下文中一共展示了GridMap::move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Position
TEST(GridMap, Move)
{
GridMap map;
map.setGeometry(Length(8.1, 5.1), 1.0, Position(0.0, 0.0)); // bufferSize(8, 5)
map.add("layer", 0.0);
map.setBasicLayers(map.getLayers());
std::vector<BufferRegion> regions;
map.move(Position(-3.0, -2.0), regions);
Index startIndex = map.getStartIndex();
EXPECT_EQ(3, startIndex(0));
EXPECT_EQ(2, startIndex(1));
EXPECT_FALSE(map.isValid(Index(0, 0))); // TODO Check entire map.
EXPECT_TRUE(map.isValid(Index(3, 2)));
EXPECT_FALSE(map.isValid(Index(2, 2)));
EXPECT_FALSE(map.isValid(Index(3, 1)));
EXPECT_TRUE(map.isValid(Index(7, 4)));
EXPECT_EQ(2, regions.size());
EXPECT_EQ(0, regions[0].getStartIndex()[0]);
EXPECT_EQ(0, regions[0].getStartIndex()[1]);
EXPECT_EQ(3, regions[0].getSize()[0]);
EXPECT_EQ(5, regions[0].getSize()[1]);
EXPECT_EQ(0, regions[1].getStartIndex()[0]);
EXPECT_EQ(0, regions[1].getStartIndex()[1]);
EXPECT_EQ(8, regions[1].getSize()[0]);
EXPECT_EQ(2, regions[1].getSize()[1]);
}
示例2: position
TEST(GridMapCvProcessing, changeResolutionForMovedMap)
{
// Create grid map.
GridMap mapIn;
mapIn.setGeometry(grid_map::Length(2.0, 1.0), 0.01);
Position position(0.3, 0.4);
mapIn.move(position);
mapIn.add("layer", 1.0);
for (grid_map::CircleIterator iterator(mapIn, position, 0.2); !iterator.isPastEnd(); ++iterator) {
mapIn.at("layer", *iterator) = 2.0;
}
// Change resolution.
GridMap mapOut;
EXPECT_TRUE(GridMapCvProcessing::changeResolution(mapIn, mapOut, 0.1));
// Check data.
EXPECT_TRUE((mapIn.getLength() == mapOut.getLength()).all());
EXPECT_TRUE(mapIn.getPosition() == mapOut.getPosition());
EXPECT_TRUE((mapIn.getSize() == mapOut.getSize() * 10).all());
EXPECT_EQ(mapIn["layer"](0, 0), mapOut["layer"](0, 0)); // Corner.
EXPECT_EQ(mapIn.atPosition("layer", mapIn.getPosition()), mapOut.atPosition("layer", mapOut.getPosition())); // Center.
}