Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add external alignment of submaps #22

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/grid_map_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ bool GridMapGeo::initializeFromGeotiff(const std::string &path, bool align_terra
// TODO: This may be wrong if the pixelSizeY > 0
int x = width - 1 - gridMapIndex(0);
int y = gridMapIndex(1);

layer_elevation(x, y) = data[gridMapIndex(0) + width * gridMapIndex(1)];
double elevation = data[gridMapIndex(0) + width * gridMapIndex(1)];
if (elevation == 0.0) layer_elevation(x, y)= NAN;
else layer_elevation(x, y) = data[gridMapIndex(0) + width * gridMapIndex(1)];
}

/// TODO: This is a workaround with the problem of gdal 3 not translating altitude correctly.
Expand Down Expand Up @@ -325,6 +326,13 @@ bool GridMapGeo::AddLayerOffset(const double offset_distance, const std::string
}

void GridMapGeo::setGlobalOrigin(ESPG src_coord, const Eigen::Vector3d origin) {
auto original_espg = maporigin_.espg;
auto original_position = maporigin_.position;

Eigen::Vector3d map_position = original_position - origin;
// map_position(1) = -map_position(1);
grid_map_.setPosition(map_position.head(2));

// Transform global origin into CH1903 / LV03 coordinates
maporigin_.espg = src_coord;
maporigin_.position = origin;
Expand Down