Remove output_debug_images. (#358)
This is now better done by RViz. This also gets rid of the dependency on webp.master
parent
10318d920e
commit
ff37b0bb7d
|
@ -124,8 +124,6 @@ target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
|
||||||
"${Boost_INCLUDE_DIRS}")
|
"${Boost_INCLUDE_DIRS}")
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC webp)
|
|
||||||
|
|
||||||
# We expect find_package(Ceres) to have located these for us.
|
# We expect find_package(Ceres) to have located these for us.
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC glog)
|
target_link_libraries(${PROJECT_NAME} PUBLIC glog)
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC gflags)
|
target_link_libraries(${PROJECT_NAME} PUBLIC gflags)
|
||||||
|
|
|
@ -30,8 +30,5 @@ message SubmapsOptions {
|
||||||
// against, then while being matched.
|
// against, then while being matched.
|
||||||
optional int32 num_range_data = 3;
|
optional int32 num_range_data = 3;
|
||||||
|
|
||||||
// If enabled, submap%d.png images are written for debugging.
|
|
||||||
optional bool output_debug_images = 4;
|
|
||||||
|
|
||||||
optional RangeDataInserterOptions range_data_inserter_options = 5;
|
optional RangeDataInserterOptions range_data_inserter_options = 5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,6 @@ class SparsePoseGraphTest : public ::testing::Test {
|
||||||
resolution = 0.05,
|
resolution = 0.05,
|
||||||
half_length = 21.,
|
half_length = 21.,
|
||||||
num_range_data = 1,
|
num_range_data = 1,
|
||||||
output_debug_images = false,
|
|
||||||
range_data_inserter = {
|
range_data_inserter = {
|
||||||
insert_free_space = true,
|
insert_free_space = true,
|
||||||
hit_probability = 0.53,
|
hit_probability = 0.53,
|
||||||
|
|
|
@ -26,44 +26,10 @@
|
||||||
#include "cartographer/common/make_unique.h"
|
#include "cartographer/common/make_unique.h"
|
||||||
#include "cartographer/common/port.h"
|
#include "cartographer/common/port.h"
|
||||||
#include "glog/logging.h"
|
#include "glog/logging.h"
|
||||||
#include "webp/encode.h"
|
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace mapping_2d {
|
namespace mapping_2d {
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
void WriteDebugImage(const string& filename,
|
|
||||||
const ProbabilityGrid& probability_grid) {
|
|
||||||
constexpr int kUnknown = 128;
|
|
||||||
const CellLimits& cell_limits = probability_grid.limits().cell_limits();
|
|
||||||
const int width = cell_limits.num_x_cells;
|
|
||||||
const int height = cell_limits.num_y_cells;
|
|
||||||
std::vector<uint8_t> rgb;
|
|
||||||
for (const Eigen::Array2i& xy_index :
|
|
||||||
XYIndexRangeIterator(probability_grid.limits().cell_limits())) {
|
|
||||||
CHECK(probability_grid.limits().Contains(xy_index));
|
|
||||||
const uint8_t value =
|
|
||||||
probability_grid.IsKnown(xy_index)
|
|
||||||
? common::RoundToInt(
|
|
||||||
(1. - probability_grid.GetProbability(xy_index)) * 255 + 0)
|
|
||||||
: kUnknown;
|
|
||||||
rgb.push_back(value);
|
|
||||||
rgb.push_back(value);
|
|
||||||
rgb.push_back(value);
|
|
||||||
}
|
|
||||||
uint8_t* output = nullptr;
|
|
||||||
size_t output_size =
|
|
||||||
WebPEncodeLosslessRGB(rgb.data(), width, height, 3 * width, &output);
|
|
||||||
std::unique_ptr<uint8_t, void (*)(void*)> output_deleter(output, std::free);
|
|
||||||
std::ofstream output_file(filename, std::ios::out | std::ios::binary);
|
|
||||||
output_file.write(reinterpret_cast<char*>(output), output_size);
|
|
||||||
output_file.close();
|
|
||||||
CHECK(output_file) << "Writing " << filename << " failed.";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
ProbabilityGrid ComputeCroppedProbabilityGrid(
|
ProbabilityGrid ComputeCroppedProbabilityGrid(
|
||||||
const ProbabilityGrid& probability_grid) {
|
const ProbabilityGrid& probability_grid) {
|
||||||
Eigen::Array2i offset;
|
Eigen::Array2i offset;
|
||||||
|
@ -91,8 +57,6 @@ proto::SubmapsOptions CreateSubmapsOptions(
|
||||||
options.set_half_length(parameter_dictionary->GetDouble("half_length"));
|
options.set_half_length(parameter_dictionary->GetDouble("half_length"));
|
||||||
options.set_num_range_data(
|
options.set_num_range_data(
|
||||||
parameter_dictionary->GetNonNegativeInt("num_range_data"));
|
parameter_dictionary->GetNonNegativeInt("num_range_data"));
|
||||||
options.set_output_debug_images(
|
|
||||||
parameter_dictionary->GetBool("output_debug_images"));
|
|
||||||
*options.mutable_range_data_inserter_options() =
|
*options.mutable_range_data_inserter_options() =
|
||||||
CreateRangeDataInserterOptions(
|
CreateRangeDataInserterOptions(
|
||||||
parameter_dictionary->GetDictionary("range_data_inserter").get());
|
parameter_dictionary->GetDictionary("range_data_inserter").get());
|
||||||
|
@ -190,11 +154,6 @@ int ActiveSubmaps::matching_index() const { return matching_submap_index_; }
|
||||||
void ActiveSubmaps::FinishSubmap() {
|
void ActiveSubmaps::FinishSubmap() {
|
||||||
Submap* submap = submaps_.front().get();
|
Submap* submap = submaps_.front().get();
|
||||||
submap->Finish();
|
submap->Finish();
|
||||||
if (options_.output_debug_images()) {
|
|
||||||
// Output the Submap that won't be changed from now on.
|
|
||||||
WriteDebugImage("submap" + std::to_string(matching_submap_index_) + ".webp",
|
|
||||||
submaps_.front()->probability_grid());
|
|
||||||
}
|
|
||||||
++matching_submap_index_;
|
++matching_submap_index_;
|
||||||
submaps_.erase(submaps_.begin());
|
submaps_.erase(submaps_.begin());
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ TEST(SubmapsTest, TheRightNumberOfScansAreInserted) {
|
||||||
"num_range_data = " +
|
"num_range_data = " +
|
||||||
std::to_string(kNumRangeData) +
|
std::to_string(kNumRangeData) +
|
||||||
", "
|
", "
|
||||||
"output_debug_images = false, "
|
|
||||||
"range_data_inserter = {"
|
"range_data_inserter = {"
|
||||||
"insert_free_space = true, "
|
"insert_free_space = true, "
|
||||||
"hit_probability = 0.53, "
|
"hit_probability = 0.53, "
|
||||||
|
|
|
@ -59,7 +59,6 @@ TRAJECTORY_BUILDER_2D = {
|
||||||
resolution = 0.05,
|
resolution = 0.05,
|
||||||
half_length = 200.,
|
half_length = 200.,
|
||||||
num_range_data = 90,
|
num_range_data = 90,
|
||||||
output_debug_images = false,
|
|
||||||
range_data_inserter = {
|
range_data_inserter = {
|
||||||
insert_free_space = true,
|
insert_free_space = true,
|
||||||
hit_probability = 0.55,
|
hit_probability = 0.55,
|
||||||
|
|
|
@ -267,9 +267,6 @@ int32 num_range_data
|
||||||
number of scans inserted: First for initialization without being matched
|
number of scans inserted: First for initialization without being matched
|
||||||
against, then while being matched.
|
against, then while being matched.
|
||||||
|
|
||||||
bool output_debug_images
|
|
||||||
If enabled, submap%d.png images are written for debugging.
|
|
||||||
|
|
||||||
cartographer.mapping_2d.proto.RangeDataInserterOptions range_data_inserter_options
|
cartographer.mapping_2d.proto.RangeDataInserterOptions range_data_inserter_options
|
||||||
Not yet documented.
|
Not yet documented.
|
||||||
|
|
||||||
|
@ -286,9 +283,6 @@ double translation_weight
|
||||||
double rotation_weight
|
double rotation_weight
|
||||||
Not yet documented.
|
Not yet documented.
|
||||||
|
|
||||||
double covariance_scale
|
|
||||||
Scale applied to the covariance estimate from Ceres.
|
|
||||||
|
|
||||||
cartographer.common.proto.CeresSolverOptions ceres_solver_options
|
cartographer.common.proto.CeresSolverOptions ceres_solver_options
|
||||||
Configure the Ceres solver. See the Ceres documentation for more
|
Configure the Ceres solver. See the Ceres documentation for more
|
||||||
information: https://code.google.com/p/ceres-solver/
|
information: https://code.google.com/p/ceres-solver/
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
<depend>libcairo2-dev</depend>
|
<depend>libcairo2-dev</depend>
|
||||||
<depend>libgflags-dev</depend>
|
<depend>libgflags-dev</depend>
|
||||||
<depend>libgoogle-glog-dev</depend>
|
<depend>libgoogle-glog-dev</depend>
|
||||||
<depend>libwebp-dev</depend>
|
|
||||||
<depend>lua5.2-dev</depend>
|
<depend>lua5.2-dev</depend>
|
||||||
<depend>protobuf-dev</depend>
|
<depend>protobuf-dev</depend>
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ sudo apt-get install -y \
|
||||||
liblua5.2-dev \
|
liblua5.2-dev \
|
||||||
libprotobuf-dev \
|
libprotobuf-dev \
|
||||||
libsuitesparse-dev \
|
libsuitesparse-dev \
|
||||||
libwebp-dev \
|
|
||||||
ninja-build \
|
ninja-build \
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
python-sphinx
|
python-sphinx
|
||||||
|
|
Loading…
Reference in New Issue