[ABSL] Use absl::Substitute in rigid_transform debug messages. (#1373)

it is at least readable.
master
Alexander Belyaev 2018-08-07 12:50:37 +02:00 committed by Wally B. Feed
parent 8d5bf2a5dd
commit 6274fc1558
3 changed files with 15 additions and 31 deletions

View File

@ -96,8 +96,9 @@ cc_library(
":cc_protos", ":cc_protos",
"@boost//:iostreams", "@boost//:iostreams",
"@com_google_absl//absl/base", "@com_google_absl//absl/base",
"@com_google_absl//absl/types:optional", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
"@com_google_absl//absl/types:optional",
"@com_google_glog//:glog", "@com_google_glog//:glog",
"@org_cairographics_cairo//:cairo", "@org_cairographics_cairo//:cairo",
"@org_ceres_solver_ceres_solver//:ceres", "@org_ceres_solver_ceres_solver//:ceres",
@ -113,8 +114,8 @@ cc_library(
deps = [ deps = [
":cartographer", ":cartographer",
":cartographer_test_library", ":cartographer_test_library",
"@com_google_googletest//:gtest_main",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_googletest//:gtest_main",
], ],
) for src in glob( ) for src in glob(
["**/*_test.cc"], ["**/*_test.cc"],

View File

@ -23,6 +23,7 @@
#include "Eigen/Core" #include "Eigen/Core"
#include "Eigen/Geometry" #include "Eigen/Geometry"
#include "absl/strings/substitute.h"
#include "cartographer/common/lua_parameter_dictionary.h" #include "cartographer/common/lua_parameter_dictionary.h"
#include "cartographer/common/math.h" #include "cartographer/common/math.h"
#include "cartographer/common/port.h" #include "cartographer/common/port.h"
@ -77,15 +78,8 @@ class Rigid2 {
} }
std::string DebugString() const { std::string DebugString() const {
std::string out; return absl::Substitute("{ t: [$0, $1], r: [$2] }", translation().x(),
out.append("{ t: ["); translation().y(), rotation().angle());
out.append(std::to_string(translation().x()));
out.append(", ");
out.append(std::to_string(translation().y()));
out.append("], r: [");
out.append(std::to_string(rotation().angle()));
out.append("] }");
return out;
} }
private: private:
@ -169,23 +163,10 @@ class Rigid3 {
} }
std::string DebugString() const { std::string DebugString() const {
std::string out; return absl::Substitute("{ t: [$0, $1, $2], q: [$3, $4, $5, $6] }",
out.append("{ t: ["); translation().x(), translation().y(),
out.append(std::to_string(translation().x())); translation().z(), rotation().w(), rotation().x(),
out.append(", "); rotation().y(), rotation().z());
out.append(std::to_string(translation().y()));
out.append(", ");
out.append(std::to_string(translation().z()));
out.append("], q: [");
out.append(std::to_string(rotation().w()));
out.append(", ");
out.append(std::to_string(rotation().x()));
out.append(", ");
out.append(std::to_string(rotation().y()));
out.append(", ");
out.append(std::to_string(rotation().z()));
out.append("] }");
return out;
} }
bool IsValid() const { bool IsValid() const {

View File

@ -29,6 +29,10 @@ if(NOT TARGET standalone_absl)
set(ABSEIL_DEPENDENT_LIBRARIES set(ABSEIL_DEPENDENT_LIBRARIES
"${ABSEIL_PROJECT_BUILD_DIR}/absl/debugging/${prefix}absl_symbolize${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/debugging/${prefix}absl_symbolize${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/time/${prefix}absl_time${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/time/${prefix}absl_time${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/strings/${prefix}absl_strings${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/strings/${prefix}str_format_internal${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/strings/${prefix}str_format_extension_internal${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/strings/${prefix}absl_str_format${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/algorithm/${prefix}absl_algorithm${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/algorithm/${prefix}absl_algorithm${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/base/${prefix}absl_base${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/base/${prefix}absl_base${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/base/${prefix}absl_dynamic_annotations${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/base/${prefix}absl_dynamic_annotations${suffix}"
@ -47,7 +51,6 @@ if(NOT TARGET standalone_absl)
"${ABSEIL_PROJECT_BUILD_DIR}/absl/meta/${prefix}absl_meta${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/meta/${prefix}absl_meta${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/numeric/${prefix}absl_int128${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/numeric/${prefix}absl_int128${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/numeric/${prefix}absl_numeric${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/numeric/${prefix}absl_numeric${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/strings/${prefix}absl_strings${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/synchronization/${prefix}absl_synchronization${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/synchronization/${prefix}absl_synchronization${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_any${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_any${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_bad_any_cast${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_bad_any_cast${suffix}"
@ -56,8 +59,7 @@ if(NOT TARGET standalone_absl)
"${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_span${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_span${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_variant${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/types/${prefix}absl_variant${suffix}"
"${ABSEIL_PROJECT_BUILD_DIR}/absl/utility/${prefix}absl_utility${suffix}" "${ABSEIL_PROJECT_BUILD_DIR}/absl/utility/${prefix}absl_utility${suffix}"
) )
ExternalProject_Add(${ABSEIL_PROJECT_NAME} ExternalProject_Add(${ABSEIL_PROJECT_NAME}
PREFIX ${ABSEIL_PROJECT_NAME} PREFIX ${ABSEIL_PROJECT_NAME}
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git