Go to the documentation of this file.
3 #include <boost/dynamic_bitset/dynamic_bitset.hpp>
6 #include <Eigen/Geometry>
34 void init(std::size_t gridSizeX,
35 std::size_t gridSizeY,
42 this->originX = originX;
43 this->originY = originY;
50 bool isOccupied(std::size_t indexX, std::size_t indexY)
const
60 void setOccupied(std::size_t indexX, std::size_t indexY,
bool posOccupied)
72 float posY =
originY + indexY * stepSize;
73 return Eigen::Vector2f(posX, posY);
78 std::size_t indexX = (std::size_t)std::roundf((posX -
originX) /
stepSize);
79 std::size_t indexY = (std::size_t)std::roundf((posY -
originY) /
stepSize);
85 const int indexX =
static_cast<int>(std::roundf((posX -
originX) /
stepSize));
86 const int indexY =
static_cast<int>(std::roundf((posY -
originY) /
stepSize));
125 float maxDistance = 15
'000; // TODO based on sensor specs
126 float testStepSize = 0.5f * stepSize;
127 Eigen::Vector2f testStep = testStepSize * dir;
128 std::size_t lineSteps = std::ceil(maxDistance / testStepSize);
129 for (std::size_t i = 0; i < lineSteps; ++i)
131 Eigen::Vector2f testPos = pos + i * testStep;
132 if (isInBounds(testPos.x(), testPos.y()) && isOccupied(testPos.x(), testPos.y()))
134 return i * testStepSize;
141 std::size_t sizeX = 0;
142 std::size_t sizeY = 0;
143 float originX = 0.0f;
144 float originY = 0.0f;
145 float stepSize = 0.0f;
146 boost::dynamic_bitset<std::size_t> occupied;
149 } // namespace armarx
boost::dynamic_bitset< std::size_t > occupied
bool isInBounds(float posX, float posY) const
float computeDistance(Eigen::Vector2f pos, Eigen::Vector2f dir)
bool isOccupied(std::size_t indexX, std::size_t indexY) const
std::shared_ptr< Value > value()
Interval< T > interval(T lo, T hi)
void init(std::size_t gridSizeX, std::size_t gridSizeY, float originX, float originY, float gridStepSize)
bool contains(T value) const
void setOccupied(std::size_t indexX, std::size_t indexY, bool posOccupied)
Eigen::Vector2f getCentralPosition(std::size_t indexX, std::size_t indexY) const
This file offers overloads of toIce() and fromIce() functions for STL container types.
bool isOccupied(float posX, float posY) const