MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / convertToDefaultStartIndex

Method convertToDefaultStartIndex

grid_map_core/src/GridMap.cpp:668–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

666}
667
668void GridMap::convertToDefaultStartIndex() {
669 if (isDefaultStartIndex()) return;
670
671 std::vector<BufferRegion> bufferRegions;
672 if (!getBufferRegionsForSubmap(bufferRegions, startIndex_, size_, size_, startIndex_)) {
673 throw std::out_of_range("Cannot access submap of this size.");
674 }
675
676 for (auto& data : data_) {
677 auto tempData(data.second);
678 for (const auto& bufferRegion : bufferRegions) {
679 Index index = bufferRegion.getStartIndex();
680 Size size = bufferRegion.getSize();
681
682 if (bufferRegion.getQuadrant() == BufferRegion::Quadrant::TopLeft) {
683 tempData.topLeftCorner(size(0), size(1)) = data.second.block(index(0), index(1), size(0), size(1));
684 } else if (bufferRegion.getQuadrant() == BufferRegion::Quadrant::TopRight) {
685 tempData.topRightCorner(size(0), size(1)) = data.second.block(index(0), index(1), size(0), size(1));
686 } else if (bufferRegion.getQuadrant() == BufferRegion::Quadrant::BottomLeft) {
687 tempData.bottomLeftCorner(size(0), size(1)) = data.second.block(index(0), index(1), size(0), size(1));
688 } else if (bufferRegion.getQuadrant() == BufferRegion::Quadrant::BottomRight) {
689 tempData.bottomRightCorner(size(0), size(1)) = data.second.block(index(0), index(1), size(0), size(1));
690 }
691 }
692 data.second = tempData;
693 }
694
695 startIndex_.setZero();
696}
697
698Position GridMap::getClosestPositionInMap(const Position& position) const {
699 if (getSize().x() < 1u || getSize().y() < 1u) {

Callers 5

updateMethod · 0.80
updateMethod · 0.80
computeVisualizationMethod · 0.80
changeResolutionMethod · 0.80
getTransformedMapMethod · 0.80

Calls 2

getQuadrantMethod · 0.80

Tested by

no test coverage detected