tsdf_2d.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2018 The Cartographer Authors
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef CARTOGRAPHER_MAPPING_2D_TSDF_2D_H_
00018 #define CARTOGRAPHER_MAPPING_2D_TSDF_2D_H_
00019 
00020 #include <vector>
00021 
00022 #include "cartographer/common/port.h"
00023 #include "cartographer/mapping/2d/grid_2d.h"
00024 #include "cartographer/mapping/2d/map_limits.h"
00025 #include "cartographer/mapping/2d/tsd_value_converter.h"
00026 #include "cartographer/mapping/2d/xy_index.h"
00027 namespace cartographer {
00028 namespace mapping {
00029 
00030 // Represents a 2D grid of truncated signed distances and weights.
00031 class TSDF2D : public Grid2D {
00032  public:
00033   TSDF2D(const MapLimits& limits, float truncation_distance, float max_weight,
00034          ValueConversionTables* conversion_tables);
00035   explicit TSDF2D(const proto::Grid2D& proto,
00036                   ValueConversionTables* conversion_tables);
00037 
00038   void SetCell(const Eigen::Array2i& cell_index, const float tsd,
00039                const float weight);
00040   GridType GetGridType() const override;
00041   float GetTSD(const Eigen::Array2i& cell_index) const;
00042   float GetWeight(const Eigen::Array2i& cell_index) const;
00043   std::pair<float, float> GetTSDAndWeight(
00044       const Eigen::Array2i& cell_index) const;
00045 
00046   void GrowLimits(const Eigen::Vector2f& point) override;
00047   proto::Grid2D ToProto() const override;
00048   std::unique_ptr<Grid2D> ComputeCroppedGrid() const override;
00049   bool DrawToSubmapTexture(
00050       proto::SubmapQuery::Response::SubmapTexture* const texture,
00051       transform::Rigid3d local_pose) const override;
00052   bool CellIsUpdated(const Eigen::Array2i& cell_index) const;
00053 
00054  private:
00055   ValueConversionTables* conversion_tables_;
00056   std::unique_ptr<TSDValueConverter> value_converter_;
00057   std::vector<uint16> weight_cells_;  // Highest bit is update marker.
00058 };
00059 
00060 }  // namespace mapping
00061 }  // namespace cartographer
00062 
00063 #endif  // CARTOGRAPHER_MAPPING_2D_TSDF_2D_H_


cartographer
Author(s): The Cartographer Authors
autogenerated on Thu May 9 2019 02:27:36