31 CHECK(proto.has_probability_grid_2d());
37 const float probability) {
54 const std::vector<uint16>& table) {
78 result.mutable_probability_grid_2d();
83 Eigen::Array2i offset;
87 const Eigen::Vector2d max =
88 limits().
max() - resolution * Eigen::Vector2d(offset.y(), offset.x());
89 std::unique_ptr<ProbabilityGrid> cropped_grid =
90 common::make_unique<ProbabilityGrid>(
93 if (!
IsKnown(xy_index + offset))
continue;
94 cropped_grid->SetProbability(xy_index,
GetProbability(xy_index + offset));
97 return std::unique_ptr<Grid2D>(cropped_grid.release());
101 proto::SubmapQuery::Response::SubmapTexture*
const texture,
103 Eigen::Array2i offset;
109 if (!
IsKnown(xy_index + offset)) {
122 const uint8 alpha = delta > 0 ? 0 : -delta;
123 const uint8 value = delta > 0 ? delta : 0;
124 cells.push_back(value);
125 cells.push_back((value || alpha) ? alpha : 1);
132 texture->set_resolution(resolution);
133 const double max_x =
limits().
max().x() - resolution * offset.y();
134 const double max_y =
limits().
max().y() - resolution * offset.x();
virtual std::unique_ptr< Grid2D > ComputeCroppedGrid() const override
const Eigen::Vector2d & max() const
void SetProbability(const Eigen::Array2i &cell_index, const float probability)
float ValueToCorrespondenceCost(const uint16 value)
double resolution() const
constexpr float kMinProbability
constexpr float kMaxCorrespondenceCost
virtual bool DrawToSubmapTexture(proto::SubmapQuery::Response::SubmapTexture *const texture, transform::Rigid3d local_pose) const override
float CorrespondenceCostToProbability(const float correspondence_cost)
Eigen::AlignedBox2i * mutable_known_cells_box()
virtual proto::Grid2D ToProto() const
uint8 ProbabilityToLogOddsInteger(const float probability)
ProbabilityGrid(const MapLimits &limits)
std::vector< uint16 > * mutable_correspondence_cost_cells()
const std::vector< uint16 > & correspondence_cost_cells() const
constexpr uint16 kUnknownProbabilityValue
float GetProbability(const Eigen::Array2i &cell_index) const
void ComputeCroppedLimits(Eigen::Array2i *const offset, CellLimits *const limits) const
float ProbabilityToCorrespondenceCost(const float probability)
bool IsKnown(const Eigen::Array2i &cell_index) const
virtual proto::Grid2D ToProto() const override
void FastGzipString(const std::string &uncompressed, std::string *compressed)
const MapLimits & limits() const
uint16 CorrespondenceCostToValue(const float correspondence_cost)
constexpr uint16 kUpdateMarker
int ToFlatIndex(const Eigen::Array2i &cell_index) const
bool ApplyLookupTable(const Eigen::Array2i &cell_index, const std::vector< uint16 > &table)
std::vector< int > * mutable_update_indices()
constexpr float kMinCorrespondenceCost