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

task: manual exclusion zones #13

Open
wants to merge 1 commit into
base: knight
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions cartographer/mapping/2d/map_limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ class MapLimits {
common::RoundToInt((max_.x() - point.x()) / resolution_ - 0.5));
}

// Returns the "point" given the index of the cell
// inverse of GetCellIndex
Eigen::Vector2f GetPointFromCellIndex(const Eigen::Array2i& cellIndex) const {
// Index values are row major and the top left has Eigen::Array2i::Zero()
// and contains (centered_max_x, centered_max_y). We need to flip and
// rotate.
return Eigen::Vector2f(
max_.y() - resolution_ * ((float)cellIndex.x() + 0.5),
max_.x() - resolution_ * ((float)cellIndex.y() + 0.5));
}

Comment on lines +80 to +88

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function below perform same operations. Any particular reason we need this here?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference I see is that instead of returning (x, y) in meters this function returns (y, x). Is that intended?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense

// Returns the center of the cell at 'cell_index'.
Eigen::Vector2f GetCellCenter(const Eigen::Array2i cell_index) const {
return {max_.x() - resolution() * (cell_index[1] + 0.5),
Expand Down