Go to the documentation of this file.
3 #include <boost/dynamic_bitset/dynamic_bitset.hpp>
6 #include <Eigen/Geometry>
41 init(std::size_t gridSizeX,
42 std::size_t gridSizeY,
49 this->originX = originX;
50 this->originY = originY;
69 setOccupied(std::size_t indexX, std::size_t indexY,
bool posOccupied)
82 float posY =
originY + indexY * stepSize;
83 return Eigen::Vector2f(posX, posY);
89 std::size_t indexX = (std::size_t)std::roundf((posX -
originX) /
stepSize);
90 std::size_t indexY = (std::size_t)std::roundf((posY -
originY) /
stepSize);
97 const int indexX =
static_cast<int>(std::roundf((posX -
originX) /
stepSize));
98 const int indexY =
static_cast<int>(std::roundf((posY -
originY) /
stepSize));
139 float maxDistance = 15
'000; // TODO based on sensor specs
140 float testStepSize = 0.5f * stepSize;
141 Eigen::Vector2f testStep = testStepSize * dir;
142 std::size_t lineSteps = std::ceil(maxDistance / testStepSize);
143 for (std::size_t i = 0; i < lineSteps; ++i)
145 Eigen::Vector2f testPos = pos + i * testStep;
146 if (isInBounds(testPos.x(), testPos.y()) && isOccupied(testPos.x(), testPos.y()))
148 return i * testStepSize;
155 std::size_t sizeX = 0;
156 std::size_t sizeY = 0;
157 float originX = 0.0f;
158 float originY = 0.0f;
159 float stepSize = 0.0f;
160 boost::dynamic_bitset<std::size_t> occupied;
163 } // 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