1 #ifndef SLAM_CTOR_UTIL_MAP_DUMPERS     2 #define SLAM_CTOR_UTIL_MAP_DUMPERS     8 #include "../core/math_utils.h"     9 #include "../core/states/world.h"    10 #include "../core/states/state_data.h"    11 #include "../core/maps/grid_map.h"    13 template <
typename Gr
idMapType>
    25     void write(std::ostream &os)
 const {
    38       os.write(&new_line, 
sizeof(new_line));
    43       auto str = std::to_string(value);
    44       os.write(str.c_str(), str.size());
    60                       std::ios::binary | std::ios::out);
    66   static void dump_map(std::ofstream &os, 
const GridMapType &map) {
    67     auto w = map.width(), h = map.height();
    68     auto origin = map.origin();
    72     os.write(&new_line, 
sizeof(new_line));
    75     using AreaId = 
typename GridMapType::Coord;
    76     auto area_id = AreaId{};
    79     for (area_id.y = h - origin.y - 1; -origin.y <= area_id.y; --area_id.y) {
    80       for (area_id.x = -origin.x; area_id.x < 
w - origin.x; ++area_id.x) {
    81         auto occ = map.occupancy(area_id);
    82         auto value = 1.0 - (occ == -1 ? 0.5 : 
bound_value(0.0, occ, 1.0));
    83         auto intensity = 
static_cast<IntensityType>(Max_Intensity * value);
    84         static_assert(
sizeof(intensity) == 1, 
"PGM insensity is not char");
    85         os.write(reinterpret_cast<char*>(&intensity), 
sizeof(intensity));
    89     assert(val_nm == 
w * h); 
    93   unsigned long long _id;
 
static void dump_map(std::ofstream &os, const GridMapType &map)
 
double bound_value(double left, double v, double right)
 
void on_map_update(const GridMapType &map) override
 
TFSIMD_FORCE_INLINE const tfScalar & w() const 
 
static constexpr IntensityType Max_Intensity
 
unsigned char IntensityType
 
GridMapToPgmDumber(const std::string &base_fname)