cartographer: add version 2.0.0 (#3173)
* cartographer: add 2.0.0 * cartographer: fix name * cartographer: add include memory * cartographer: remove files with `int main` * cartographer: remove another file * cartographer: remove `remove_files` (unneeded) * cartographer: remove unneeded statementspull/3186/head
parent
d1a178f465
commit
98c404ec08
4 changed files with 139 additions and 3 deletions
@ -0,0 +1,39 @@ |
||||
diff --git a/cartographer/common/math.h b/cartographer/common/math.h
|
||||
index c4a77ef..0248f66 100644
|
||||
--- a/cartographer/common/math.h
|
||||
+++ b/cartographer/common/math.h
|
||||
@@ -17,6 +17,10 @@
|
||||
#ifndef CARTOGRAPHER_COMMON_MATH_H_
|
||||
#define CARTOGRAPHER_COMMON_MATH_H_
|
||||
|
||||
+#ifndef M_PI
|
||||
+#define M_PI 3.14159265358979323846
|
||||
+#endif
|
||||
+
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
diff --git a/cartographer/mapping/pose_graph_interface.h b/cartographer/mapping/pose_graph_interface.h
|
||||
index 68551f1..6055485 100644
|
||||
--- a/cartographer/mapping/pose_graph_interface.h
|
||||
+++ b/cartographer/mapping/pose_graph_interface.h
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
+#include <array>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "cartographer/mapping/id.h"
|
||||
diff --git a/cartographer/mapping/value_conversion_tables.h b/cartographer/mapping/value_conversion_tables.h
|
||||
index 56924f0..f67854f 100644
|
||||
--- a/cartographer/mapping/value_conversion_tables.h
|
||||
+++ b/cartographer/mapping/value_conversion_tables.h
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
+#include <memory>
|
||||
|
||||
#include "cartographer/common/port.h"
|
||||
#include "glog/logging.h"
|
@ -0,0 +1,89 @@ |
||||
diff --git a/cartographer/common/port.h b/cartographer/common/port.h
|
||||
index eec8469..96881ad 100644
|
||||
--- a/cartographer/common/port.h
|
||||
+++ b/cartographer/common/port.h
|
||||
@@ -17,12 +17,14 @@
|
||||
#ifndef CARTOGRAPHER_COMMON_PORT_H_
|
||||
#define CARTOGRAPHER_COMMON_PORT_H_
|
||||
|
||||
-#include <boost/iostreams/device/back_inserter.hpp>
|
||||
-#include <boost/iostreams/filter/gzip.hpp>
|
||||
-#include <boost/iostreams/filtering_stream.hpp>
|
||||
#include <cinttypes>
|
||||
+#include <cstring>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
+#include <stdexcept>
|
||||
+#include <functional>
|
||||
+
|
||||
+#include <zlib.h>
|
||||
|
||||
namespace cartographer {
|
||||
|
||||
@@ -47,22 +49,54 @@ inline int64 RoundToInt64(const double x) { return std::lround(x); }
|
||||
|
||||
inline void FastGzipString(const std::string& uncompressed,
|
||||
std::string* compressed) {
|
||||
- boost::iostreams::filtering_ostream out;
|
||||
- out.push(
|
||||
- boost::iostreams::gzip_compressor(boost::iostreams::zlib::best_speed));
|
||||
- out.push(boost::iostreams::back_inserter(*compressed));
|
||||
- boost::iostreams::write(out,
|
||||
- reinterpret_cast<const char*>(uncompressed.data()),
|
||||
- uncompressed.size());
|
||||
+ z_stream zs;
|
||||
+ memset(&zs, 0, sizeof(zs));
|
||||
+
|
||||
+ if (deflateInit(&zs, Z_BEST_SPEED) != Z_OK)
|
||||
+ throw std::runtime_error("deflateInit failed while compressing.");
|
||||
+
|
||||
+ zs.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(uncompressed.data()));
|
||||
+ zs.avail_in = static_cast<uInt>(uncompressed.size());
|
||||
+
|
||||
+ int ret;
|
||||
+ char buffer[4096];
|
||||
+
|
||||
+ do {
|
||||
+ zs.next_out = reinterpret_cast<Bytef*>(buffer);
|
||||
+ zs.avail_out = sizeof(buffer);
|
||||
+
|
||||
+ ret = deflate(&zs, Z_FINISH);
|
||||
+
|
||||
+ compressed->append(buffer, sizeof(buffer) - zs.avail_out);
|
||||
+ } while (zs.avail_out == 0);
|
||||
+
|
||||
+ deflateEnd(&zs);
|
||||
}
|
||||
|
||||
inline void FastGunzipString(const std::string& compressed,
|
||||
std::string* decompressed) {
|
||||
- boost::iostreams::filtering_ostream out;
|
||||
- out.push(boost::iostreams::gzip_decompressor());
|
||||
- out.push(boost::iostreams::back_inserter(*decompressed));
|
||||
- boost::iostreams::write(out, reinterpret_cast<const char*>(compressed.data()),
|
||||
- compressed.size());
|
||||
+ z_stream zs;
|
||||
+ memset(&zs, 0, sizeof(zs));
|
||||
+
|
||||
+ if (inflateInit(&zs) != Z_OK)
|
||||
+ throw std::runtime_error("inflateInit failed while decompressing.");
|
||||
+
|
||||
+ zs.next_in = reinterpret_cast<Bytef*>(const_cast<char*>(compressed.data()));
|
||||
+ zs.avail_in = static_cast<uInt>(compressed.size());
|
||||
+
|
||||
+ int ret;
|
||||
+ char buffer[4096];
|
||||
+
|
||||
+ do {
|
||||
+ zs.next_out = reinterpret_cast<Bytef*>(buffer);
|
||||
+ zs.avail_out = sizeof(buffer);
|
||||
+
|
||||
+ ret = inflate(&zs, Z_NO_FLUSH);
|
||||
+
|
||||
+ decompressed->append(buffer, sizeof(buffer) - zs.avail_out);
|
||||
+ } while (zs.avail_out == 0);
|
||||
+
|
||||
+ inflateEnd(&zs);
|
||||
}
|
||||
|
||||
} // namespace common
|
Loading…
Reference in new issue