14 #include <gtest/gtest.h> 21 TEST(Costmap2DConversion, initializeFromCostmap2d)
40 EXPECT_EQ(costmap2d.
getOriginX(), position.x());
41 EXPECT_EQ(costmap2d.
getOriginY(), position.y());
44 TEST(Costmap2DConversion, addLayerFromCostmap2d)
52 const std::string layer(
"layer");
57 using TestValue = std::tuple<Position, unsigned char, double>;
58 std::vector<TestValue> testValues;
59 testValues.push_back(TestValue(
Position(8.5, 4.5), 1, 1.0));
60 testValues.push_back(TestValue(
Position(3.2, 5.1), 254, 100.0));
61 testValues.push_back(TestValue(
Position(5.2, 7.8), 255, -1.0));
64 for (
const auto& testValue : testValues) {
65 unsigned int xIndex, yIndex;
66 ASSERT_TRUE(costmap2d.
worldToMap(std::get<0>(testValue).x(), std::get<0>(testValue).
y(), xIndex, yIndex));
74 for (
const auto& testValue : testValues) {
75 EXPECT_EQ(std::get<2>(testValue), gridMap.
atPosition(layer, std::get<0>(testValue)));
const Length & getLength() const
Convert Costmap2DRos objects into cost or grid maps.
float & atPosition(const std::string &layer, const Position &position)
bool getPosition(const Index &index, Position &position) const
void initializeFromCostmap2D(costmap_2d::Costmap2DROS &costmap2d, MapType &outputMap)
double getOriginX() const
double getSizeInMetersX() const
TFSIMD_FORCE_INLINE const tfScalar & y() const
double getSizeInMetersY() const
unsigned char * getCharMap() const
double getResolution() const
double getOriginY() const
unsigned int getSizeInCellsY() const
bool addLayerFromCostmap2D(const costmap_2d::Costmap2D &costmap2d, const std::string &layer, MapType &outputMap)
unsigned int getSizeInCellsX() const
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
TEST(Costmap2DConversion, initializeFromCostmap2d)
double getResolution() const
bool worldToMap(double wx, double wy, unsigned int &mx, unsigned int &my) const
unsigned int getIndex(unsigned int mx, unsigned int my) const
const Size & getSize() const