diff --git a/CMakeLists.txt b/CMakeLists.txt index 7db7e1b..d39ee4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,40 +2,50 @@ cmake_minimum_required(VERSION 3.10) project(costmap_2d) set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) -# Dependencies +# ---- Dependencies ---- find_package(Eigen3 REQUIRED) +find_package(Boost REQUIRED COMPONENTS system thread) -# Include directories include_directories( include - ${EIGEN3_INCLUDE_DIR} + ${EIGEN3_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + /usr/include ) -# Library source files -set(COSTMAP_SOURCES +add_definitions(${EIGEN3_DEFINITIONS}) + +# ---- Core costmap_2d library ---- +add_library(costmap_2d + src/array_parser.cpp src/costmap_2d.cpp - # src/layer.cpp + src/observation_buffer.cpp + src/layer.cpp src/layered_costmap.cpp + # src/costmap_math.cpp + src/footprint.cpp # src/costmap_layer.cpp - # src/static_layer.cpp - # src/obstacle_layer.cpp - # src/inflation_layer.cpp - # src/observation_buffer.cpp - # src/footprint.cpp ) -# Create library -add_library(${PROJECT_NAME} SHARED ${COSTMAP_SOURCES}) -target_link_libraries(${PROJECT_NAME} Eigen3::Eigen) - -# Install -install(TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib +target_link_libraries(costmap_2d + ${Boost_LIBRARIES} ) -install(DIRECTORY include/${PROJECT_NAME}/ - DESTINATION include/${PROJECT_NAME} -) \ No newline at end of file +# # ---- Layer plugins ---- +add_library(layers + plugins/inflation_layer.cpp +# plugins/obstacle_layer.cpp +# plugins/static_layer.cpp +# plugins/voxel_layer.cpp +) + +target_link_libraries(layers + costmap_2d + ${Boost_LIBRARIES} +) + +# ---- Example Executable ---- +# add_executable(test_costmap main.cpp) +# target_link_libraries(test_costmap costmap_2d layers) diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt new file mode 100644 index 0000000..509c80c --- /dev/null +++ b/build/CMakeCache.txt @@ -0,0 +1,417 @@ +# This is the CMakeCache file. +# For build in directory: /home/duongtd/robotics_core/costmap_2d/build +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//The directory containing a CMake configuration file for Boost. +Boost_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0 + +//Path to a file. +Boost_INCLUDE_DIR:PATH=/usr/include + +Boost_SYSTEM_LIBRARY_RELEASE:STRING=/usr/lib/x86_64-linux-gnu/libboost_system.so.1.71.0 + +Boost_THREAD_LIBRARY_RELEASE:STRING=/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.71.0 + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=costmap_2d + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//The directory containing a CMake configuration file for Eigen3. +Eigen3_DIR:PATH=/usr/lib/cmake/eigen3 + +//The directory containing a CMake configuration file for boost_atomic. +boost_atomic_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/boost_atomic-1.71.0 + +//The directory containing a CMake configuration file for boost_headers. +boost_headers_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/boost_headers-1.71.0 + +//The directory containing a CMake configuration file for boost_system. +boost_system_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0 + +//The directory containing a CMake configuration file for boost_thread. +boost_thread_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/boost_thread-1.71.0 + +//Value Computed by CMake +costmap_2d_BINARY_DIR:STATIC=/home/duongtd/robotics_core/costmap_2d/build + +//Dependencies for the target +costmap_2d_LIB_DEPENDS:STATIC=general;Boost::system;general;Boost::thread; + +//Value Computed by CMake +costmap_2d_SOURCE_DIR:STATIC=/home/duongtd/robotics_core/costmap_2d + +//Dependencies for the target +layers_LIB_DEPENDS:STATIC=general;costmap_2d;general;Boost::system;general;Boost::thread; + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: Boost_DIR +Boost_DIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/duongtd/robotics_core/costmap_2d/build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=16 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Test CMAKE_HAVE_LIBC_PTHREAD +CMAKE_HAVE_LIBC_PTHREAD:INTERNAL= +//Have library pthreads +CMAKE_HAVE_PTHREADS_CREATE:INTERNAL= +//Have library pthread +CMAKE_HAVE_PTHREAD_CREATE:INTERNAL=1 +//Have include pthread.h +CMAKE_HAVE_PTHREAD_H:INTERNAL=1 +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/duongtd/robotics_core/costmap_2d +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.16 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//Details about finding Boost +FIND_PACKAGE_MESSAGE_DETAILS_Boost:INTERNAL=[/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake][cfound components: system thread ][v1.71.0()] +//ADVANCED property for variable: boost_atomic_DIR +boost_atomic_DIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: boost_headers_DIR +boost_headers_DIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: boost_system_DIR +boost_system_DIR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: boost_thread_DIR +boost_thread_DIR-ADVANCED:INTERNAL=1 + diff --git a/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake b/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..c5ece7b --- /dev/null +++ b/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake @@ -0,0 +1,76 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "9.4.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake b/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..278ef39 --- /dev/null +++ b/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake @@ -0,0 +1,88 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "9.4.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/9;/usr/include/x86_64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin b/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000..b7a0b09 Binary files /dev/null and b/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin differ diff --git a/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin b/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000..a9f2f4f Binary files /dev/null and b/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin differ diff --git a/build/CMakeFiles/3.16.3/CMakeSystem.cmake b/build/CMakeFiles/3.16.3/CMakeSystem.cmake new file mode 100644 index 0000000..8b384d4 --- /dev/null +++ b/build/CMakeFiles/3.16.3/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-5.15.0-139-generic") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "5.15.0-139-generic") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-5.15.0-139-generic") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "5.15.0-139-generic") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c b/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..d884b50 --- /dev/null +++ b/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,671 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if !defined(__STDC__) +# if (defined(_MSC_VER) && !defined(__clang__)) \ + || (defined(__ibmxl__) || defined(__IBMC__)) +# define C_DIALECT "90" +# else +# define C_DIALECT +# endif +#elif __STDC_VERSION__ >= 201000L +# define C_DIALECT "11" +#elif __STDC_VERSION__ >= 199901L +# define C_DIALECT "99" +#else +# define C_DIALECT "90" +#endif +const char* info_language_dialect_default = + "INFO" ":" "dialect_default[" C_DIALECT "]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/build/CMakeFiles/3.16.3/CompilerIdC/a.out b/build/CMakeFiles/3.16.3/CompilerIdC/a.out new file mode 100755 index 0000000..b5c91a3 Binary files /dev/null and b/build/CMakeFiles/3.16.3/CompilerIdC/a.out differ diff --git a/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..69cfdba --- /dev/null +++ b/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,660 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_dialect_default = "INFO" ":" "dialect_default[" +#if CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} diff --git a/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out b/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out new file mode 100755 index 0000000..2881803 Binary files /dev/null and b/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out differ diff --git a/build/CMakeFiles/CMakeDirectoryInformation.cmake b/build/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..5f050de --- /dev/null +++ b/build/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/duongtd/robotics_core/costmap_2d") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/duongtd/robotics_core/costmap_2d/build") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/build/CMakeFiles/CMakeError.log b/build/CMakeFiles/CMakeError.log new file mode 100644 index 0000000..4cc9111 --- /dev/null +++ b/build/CMakeFiles/CMakeError.log @@ -0,0 +1,58 @@ +Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_c018a/fast && /usr/bin/make -f CMakeFiles/cmTC_c018a.dir/build.make CMakeFiles/cmTC_c018a.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_c018a.dir/src.c.o +/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -fPIE -o CMakeFiles/cmTC_c018a.dir/src.c.o -c /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp/src.c +Linking C executable cmTC_c018a +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c018a.dir/link.txt --verbose=1 +/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD CMakeFiles/cmTC_c018a.dir/src.c.o -o cmTC_c018a +/usr/bin/ld: CMakeFiles/cmTC_c018a.dir/src.c.o: in function `main': +src.c:(.text+0x46): undefined reference to `pthread_create' +/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach' +/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join' +collect2: error: ld returned 1 exit status +make[1]: *** [CMakeFiles/cmTC_c018a.dir/build.make:87: cmTC_c018a] Error 1 +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +make: *** [Makefile:121: cmTC_c018a/fast] Error 2 + + +Source file was: +#include + +void* test_func(void* data) +{ + return data; +} + +int main(void) +{ + pthread_t thread; + pthread_create(&thread, NULL, test_func, NULL); + pthread_detach(thread); + pthread_join(thread, NULL); + pthread_atfork(NULL, NULL, NULL); + pthread_exit(NULL); + + return 0; +} + +Determining if the function pthread_create exists in the pthreads failed with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_08e7c/fast && /usr/bin/make -f CMakeFiles/cmTC_08e7c.dir/build.make CMakeFiles/cmTC_08e7c.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_08e7c.dir/CheckFunctionExists.c.o +/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -fPIE -o CMakeFiles/cmTC_08e7c.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c +Linking C executable cmTC_08e7c +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_08e7c.dir/link.txt --verbose=1 +/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_08e7c.dir/CheckFunctionExists.c.o -o cmTC_08e7c -lpthreads +/usr/bin/ld: cannot find -lpthreads +collect2: error: ld returned 1 exit status +make[1]: *** [CMakeFiles/cmTC_08e7c.dir/build.make:87: cmTC_08e7c] Error 1 +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +make: *** [Makefile:121: cmTC_08e7c/fast] Error 2 + + + diff --git a/build/CMakeFiles/CMakeOutput.log b/build/CMakeFiles/CMakeOutput.log new file mode 100644 index 0000000..efeec88 --- /dev/null +++ b/build/CMakeFiles/CMakeOutput.log @@ -0,0 +1,489 @@ +The system is: Linux - 5.15.0-139-generic - x86_64 +Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. +Compiler: /usr/bin/cc +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + +The C compiler identification is GNU, found in "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/3.16.3/CompilerIdC/a.out" + +Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. +Compiler: /usr/bin/c++ +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + +The CXX compiler identification is GNU, found in "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out" + +Determining if the C compiler works passed with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_049bd/fast && /usr/bin/make -f CMakeFiles/cmTC_049bd.dir/build.make CMakeFiles/cmTC_049bd.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_049bd.dir/testCCompiler.c.o +/usr/bin/cc -o CMakeFiles/cmTC_049bd.dir/testCCompiler.c.o -c /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp/testCCompiler.c +Linking C executable cmTC_049bd +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_049bd.dir/link.txt --verbose=1 +/usr/bin/cc CMakeFiles/cmTC_049bd.dir/testCCompiler.c.o -o cmTC_049bd +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' + + + +Detecting C compiler ABI info compiled with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_6fd48/fast && /usr/bin/make -f CMakeFiles/cmTC_6fd48.dir/build.make CMakeFiles/cmTC_6fd48.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc3c2RcL.s +GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 01da938ff5dc2163489aa33cb3b747a7 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o /tmp/cc3c2RcL.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' +Linking C executable cmTC_6fd48 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6fd48.dir/link.txt --verbose=1 +/usr/bin/cc -v CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -o cmTC_6fd48 +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_6fd48' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cconKWCg.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_6fd48 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_6fd48' '-mtune=generic' '-march=x86-64' +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' + + + +Parsed C implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/9/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed C implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/make cmTC_6fd48/fast && /usr/bin/make -f CMakeFiles/cmTC_6fd48.dir/build.make CMakeFiles/cmTC_6fd48.dir/build] + ignore line: [make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp'] + ignore line: [Building C object CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o] + ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc3c2RcL.s] + ignore line: [GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 01da938ff5dc2163489aa33cb3b747a7] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o /tmp/cc3c2RcL.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64'] + ignore line: [Linking C executable cmTC_6fd48] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6fd48.dir/link.txt --verbose=1] + ignore line: [/usr/bin/cc -v CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -o cmTC_6fd48 ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_6fd48' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cconKWCg.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_6fd48 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cconKWCg.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_6fd48] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_6fd48.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9] ==> [/usr/lib/gcc/x86_64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +Determining if the CXX compiler works passed with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_c9cbf/fast && /usr/bin/make -f CMakeFiles/cmTC_c9cbf.dir/build.make CMakeFiles/cmTC_c9cbf.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_c9cbf.dir/testCXXCompiler.cxx.o +/usr/bin/c++ -o CMakeFiles/cmTC_c9cbf.dir/testCXXCompiler.cxx.o -c /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx +Linking CXX executable cmTC_c9cbf +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c9cbf.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/cmTC_c9cbf.dir/testCXXCompiler.cxx.o -o cmTC_c9cbf +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' + + + +Detecting CXX compiler ABI info compiled with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_4e5e7/fast && /usr/bin/make -f CMakeFiles/cmTC_4e5e7.dir/build.make CMakeFiles/cmTC_4e5e7.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -v -o CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc7HlAOK.s +GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/9" +ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/9 + /usr/include/x86_64-linux-gnu/c++/9 + /usr/include/c++/9/backward + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include +End of search list. +GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 3d1eba838554fa2348dba760e4770469 +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + as -v --64 -o CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc7HlAOK.s +GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +Linking CXX executable cmTC_4e5e7 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4e5e7.dir/link.txt --verbose=1 +/usr/bin/c++ -v CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_4e5e7 +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper +OFFLOAD_TARGET_NAMES=nvptx-none:hsa +OFFLOAD_TARGET_DEFAULT=1 +Target: x86_64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_4e5e7' '-shared-libgcc' '-mtune=generic' '-march=x86-64' + /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cc83fSqd.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_4e5e7 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_4e5e7' '-shared-libgcc' '-mtune=generic' '-march=x86-64' +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' + + + +Parsed CXX implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/9] + add: [/usr/include/x86_64-linux-gnu/c++/9] + add: [/usr/include/c++/9/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/9] ==> [/usr/include/c++/9] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/9] ==> [/usr/include/x86_64-linux-gnu/c++/9] + collapse include dir [/usr/include/c++/9/backward] ==> [/usr/include/c++/9/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/9/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/9;/usr/include/x86_64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/x86_64-linux-gnu/9/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + +Parsed CXX implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/make cmTC_4e5e7/fast && /usr/bin/make -f CMakeFiles/cmTC_4e5e7.dir/build.make CMakeFiles/cmTC_4e5e7.dir/build] + ignore line: [make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp'] + ignore line: [Building CXX object CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mtune=generic -march=x86-64 -auxbase-strip CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc7HlAOK.s] + ignore line: [GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/9"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/9] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/9] + ignore line: [ /usr/include/c++/9/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 3d1eba838554fa2348dba760e4770469] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc7HlAOK.s] + ignore line: [GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + ignore line: [Linking CXX executable cmTC_4e5e7] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4e5e7.dir/link.txt --verbose=1] + ignore line: [/usr/bin/c++ -v CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_4e5e7 ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:hsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go brig d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/9/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_4e5e7' '-shared-libgcc' '-mtune=generic' '-march=x86-64'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/cc83fSqd.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_4e5e7 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/9/../../.. CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cc83fSqd.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_4e5e7] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_4e5e7.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9] ==> [/usr/lib/gcc/x86_64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +Determining if the include file pthread.h exists passed with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_4fb05/fast && /usr/bin/make -f CMakeFiles/cmTC_4fb05.dir/build.make CMakeFiles/cmTC_4fb05.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_4fb05.dir/CheckIncludeFile.c.o +/usr/bin/cc -fPIE -o CMakeFiles/cmTC_4fb05.dir/CheckIncludeFile.c.o -c /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c +Linking C executable cmTC_4fb05 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4fb05.dir/link.txt --verbose=1 +/usr/bin/cc CMakeFiles/cmTC_4fb05.dir/CheckIncludeFile.c.o -o cmTC_4fb05 +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' + + + +Determining if the function pthread_create exists in the pthread passed with the following output: +Change Dir: /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_0fd95/fast && /usr/bin/make -f CMakeFiles/cmTC_0fd95.dir/build.make CMakeFiles/cmTC_0fd95.dir/build +make[1]: Entering directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_0fd95.dir/CheckFunctionExists.c.o +/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -fPIE -o CMakeFiles/cmTC_0fd95.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c +Linking C executable cmTC_0fd95 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0fd95.dir/link.txt --verbose=1 +/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_0fd95.dir/CheckFunctionExists.c.o -o cmTC_0fd95 -lpthread +make[1]: Leaving directory '/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/CMakeTmp' + + + diff --git a/build/CMakeFiles/Makefile.cmake b/build/CMakeFiles/Makefile.cmake new file mode 100644 index 0000000..863d161 --- /dev/null +++ b/build/CMakeFiles/Makefile.cmake @@ -0,0 +1,78 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# The generator used is: +set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") + +# The top level Makefile was generated from the following files: +set(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "../CMakeLists.txt" + "CMakeFiles/3.16.3/CMakeCCompiler.cmake" + "CMakeFiles/3.16.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.16.3/CMakeSystem.cmake" + "/usr/lib/cmake/eigen3/Eigen3Config.cmake" + "/usr/lib/cmake/eigen3/Eigen3ConfigVersion.cmake" + "/usr/lib/cmake/eigen3/Eigen3Targets.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfigVersion.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/BoostDetectToolset-1.71.0.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_atomic-1.71.0/boost_atomic-config-version.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_atomic-1.71.0/boost_atomic-config.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_atomic-1.71.0/libboost_atomic-variant-shared.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_atomic-1.71.0/libboost_atomic-variant-static.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_headers-1.71.0/boost_headers-config-version.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_headers-1.71.0/boost_headers-config.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/boost_system-config-version.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/boost_system-config.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/libboost_system-variant-shared.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_system-1.71.0/libboost_system-variant-static.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_thread-1.71.0/boost_thread-config-version.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_thread-1.71.0/boost_thread-config.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_thread-1.71.0/libboost_thread-variant-shared.cmake" + "/usr/lib/x86_64-linux-gnu/cmake/boost_thread-1.71.0/libboost_thread-variant-static.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCXXInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake-3.16/Modules/CMakeFindDependencyMacro.cmake" + "/usr/share/cmake-3.16/Modules/CMakeGenericSystem.cmake" + "/usr/share/cmake-3.16/Modules/CMakeInitializeConfigs.cmake" + "/usr/share/cmake-3.16/Modules/CMakeLanguageInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInitialize.cmake" + "/usr/share/cmake-3.16/Modules/CheckCSourceCompiles.cmake" + "/usr/share/cmake-3.16/Modules/CheckIncludeFile.cmake" + "/usr/share/cmake-3.16/Modules/CheckLibraryExists.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU.cmake" + "/usr/share/cmake-3.16/Modules/FindBoost.cmake" + "/usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake" + "/usr/share/cmake-3.16/Modules/FindPackageMessage.cmake" + "/usr/share/cmake-3.16/Modules/FindThreads.cmake" + "/usr/share/cmake-3.16/Modules/Internal/CMakeCheckCompilerFlag.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-C.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-CXX.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux.cmake" + "/usr/share/cmake-3.16/Modules/Platform/UnixPaths.cmake" + ) + +# The corresponding makefile is: +set(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +set(CMAKE_DEPEND_INFO_FILES + "CMakeFiles/layers.dir/DependInfo.cmake" + "CMakeFiles/costmap_2d.dir/DependInfo.cmake" + ) diff --git a/build/CMakeFiles/Makefile2 b/build/CMakeFiles/Makefile2 new file mode 100644 index 0000000..a535eb3 --- /dev/null +++ b/build/CMakeFiles/Makefile2 @@ -0,0 +1,135 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/duongtd/robotics_core/costmap_2d + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/duongtd/robotics_core/costmap_2d/build + +#============================================================================= +# Directory level rules for the build root directory + +# The main recursive "all" target. +all: CMakeFiles/layers.dir/all +all: CMakeFiles/costmap_2d.dir/all + +.PHONY : all + +# The main recursive "preinstall" target. +preinstall: + +.PHONY : preinstall + +# The main recursive "clean" target. +clean: CMakeFiles/layers.dir/clean +clean: CMakeFiles/costmap_2d.dir/clean + +.PHONY : clean + +#============================================================================= +# Target rules for target CMakeFiles/layers.dir + +# All Build rule for target. +CMakeFiles/layers.dir/all: CMakeFiles/costmap_2d.dir/all + $(MAKE) -f CMakeFiles/layers.dir/build.make CMakeFiles/layers.dir/depend + $(MAKE) -f CMakeFiles/layers.dir/build.make CMakeFiles/layers.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=8,9 "Built target layers" +.PHONY : CMakeFiles/layers.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/layers.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles 9 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/layers.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles 0 +.PHONY : CMakeFiles/layers.dir/rule + +# Convenience name for target. +layers: CMakeFiles/layers.dir/rule + +.PHONY : layers + +# clean rule for target. +CMakeFiles/layers.dir/clean: + $(MAKE) -f CMakeFiles/layers.dir/build.make CMakeFiles/layers.dir/clean +.PHONY : CMakeFiles/layers.dir/clean + +#============================================================================= +# Target rules for target CMakeFiles/costmap_2d.dir + +# All Build rule for target. +CMakeFiles/costmap_2d.dir/all: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/depend + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=1,2,3,4,5,6,7 "Built target costmap_2d" +.PHONY : CMakeFiles/costmap_2d.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/costmap_2d.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles 7 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/costmap_2d.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles 0 +.PHONY : CMakeFiles/costmap_2d.dir/rule + +# Convenience name for target. +costmap_2d: CMakeFiles/costmap_2d.dir/rule + +.PHONY : costmap_2d + +# clean rule for target. +CMakeFiles/costmap_2d.dir/clean: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/clean +.PHONY : CMakeFiles/costmap_2d.dir/clean + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/build/CMakeFiles/Progress/3 b/build/CMakeFiles/Progress/3 new file mode 100644 index 0000000..7b4d68d --- /dev/null +++ b/build/CMakeFiles/Progress/3 @@ -0,0 +1 @@ +empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/count.txt b/build/CMakeFiles/Progress/count.txt new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/build/CMakeFiles/Progress/count.txt @@ -0,0 +1 @@ +9 diff --git a/build/CMakeFiles/TargetDirectories.txt b/build/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..665892b --- /dev/null +++ b/build/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,4 @@ +/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/rebuild_cache.dir +/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/layers.dir +/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/edit_cache.dir +/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir diff --git a/build/CMakeFiles/cmake.check_cache b/build/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/build/CMakeFiles/costmap_2d.dir/CXX.includecache b/build/CMakeFiles/costmap_2d.dir/CXX.includecache new file mode 100644 index 0000000..c4d6649 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/CXX.includecache @@ -0,0 +1,36 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + +../include/costmap_2d/observation_buffer.h +vector +- +list +- +string +- +ros/time.h +- +costmap_2d/observation.h +- +tf2_ros/buffer.h +- +sensor_msgs/PointCloud2.h +- +boost/thread.hpp +- + +/home/duongtd/robotics_core/costmap_2d/src/observation_buffer.cpp +costmap_2d/observation_buffer.h +- +tf2_geometry_msgs/tf2_geometry_msgs.h +- +tf2_sensor_msgs/tf2_sensor_msgs.h +- +sensor_msgs/point_cloud2_iterator.h +- + diff --git a/build/CMakeFiles/costmap_2d.dir/DependInfo.cmake b/build/CMakeFiles/costmap_2d.dir/DependInfo.cmake new file mode 100644 index 0000000..fd5ac44 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/DependInfo.cmake @@ -0,0 +1,35 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/duongtd/robotics_core/costmap_2d/src/array_parser.cpp" "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o" + "/home/duongtd/robotics_core/costmap_2d/src/costmap_2d.cpp" "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o" + "/home/duongtd/robotics_core/costmap_2d/src/footprint.cpp" "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/src/footprint.cpp.o" + "/home/duongtd/robotics_core/costmap_2d/src/layer.cpp" "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/src/layer.cpp.o" + "/home/duongtd/robotics_core/costmap_2d/src/layered_costmap.cpp" "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o" + "/home/duongtd/robotics_core/costmap_2d/src/observation_buffer.cpp" "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# Preprocessor definitions for this target. +set(CMAKE_TARGET_DEFINITIONS_CXX + "BOOST_ALL_NO_LIB" + "BOOST_ATOMIC_DYN_LINK" + "BOOST_SYSTEM_DYN_LINK" + "BOOST_THREAD_DYN_LINK" + ) + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "../include" + "/usr/include/eigen3" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/build/CMakeFiles/costmap_2d.dir/build.make b/build/CMakeFiles/costmap_2d.dir/build.make new file mode 100644 index 0000000..0702c62 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/build.make @@ -0,0 +1,174 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/duongtd/robotics_core/costmap_2d + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/duongtd/robotics_core/costmap_2d/build + +# Include any dependencies generated for this target. +include CMakeFiles/costmap_2d.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/costmap_2d.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/costmap_2d.dir/flags.make + +CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o: CMakeFiles/costmap_2d.dir/flags.make +CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o: ../src/array_parser.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o -c /home/duongtd/robotics_core/costmap_2d/src/array_parser.cpp + +CMakeFiles/costmap_2d.dir/src/array_parser.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/costmap_2d.dir/src/array_parser.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/duongtd/robotics_core/costmap_2d/src/array_parser.cpp > CMakeFiles/costmap_2d.dir/src/array_parser.cpp.i + +CMakeFiles/costmap_2d.dir/src/array_parser.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/costmap_2d.dir/src/array_parser.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/duongtd/robotics_core/costmap_2d/src/array_parser.cpp -o CMakeFiles/costmap_2d.dir/src/array_parser.cpp.s + +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o: CMakeFiles/costmap_2d.dir/flags.make +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o: ../src/costmap_2d.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o -c /home/duongtd/robotics_core/costmap_2d/src/costmap_2d.cpp + +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/duongtd/robotics_core/costmap_2d/src/costmap_2d.cpp > CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.i + +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/duongtd/robotics_core/costmap_2d/src/costmap_2d.cpp -o CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.s + +CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o: CMakeFiles/costmap_2d.dir/flags.make +CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o: ../src/observation_buffer.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building CXX object CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o -c /home/duongtd/robotics_core/costmap_2d/src/observation_buffer.cpp + +CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/duongtd/robotics_core/costmap_2d/src/observation_buffer.cpp > CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.i + +CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/duongtd/robotics_core/costmap_2d/src/observation_buffer.cpp -o CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.s + +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: CMakeFiles/costmap_2d.dir/flags.make +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: ../src/layer.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_4) "Building CXX object CMakeFiles/costmap_2d.dir/src/layer.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/costmap_2d.dir/src/layer.cpp.o -c /home/duongtd/robotics_core/costmap_2d/src/layer.cpp + +CMakeFiles/costmap_2d.dir/src/layer.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/costmap_2d.dir/src/layer.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/duongtd/robotics_core/costmap_2d/src/layer.cpp > CMakeFiles/costmap_2d.dir/src/layer.cpp.i + +CMakeFiles/costmap_2d.dir/src/layer.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/costmap_2d.dir/src/layer.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/duongtd/robotics_core/costmap_2d/src/layer.cpp -o CMakeFiles/costmap_2d.dir/src/layer.cpp.s + +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: CMakeFiles/costmap_2d.dir/flags.make +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../src/layered_costmap.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_5) "Building CXX object CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o -c /home/duongtd/robotics_core/costmap_2d/src/layered_costmap.cpp + +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/duongtd/robotics_core/costmap_2d/src/layered_costmap.cpp > CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.i + +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/duongtd/robotics_core/costmap_2d/src/layered_costmap.cpp -o CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.s + +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o: CMakeFiles/costmap_2d.dir/flags.make +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o: ../src/footprint.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_6) "Building CXX object CMakeFiles/costmap_2d.dir/src/footprint.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/costmap_2d.dir/src/footprint.cpp.o -c /home/duongtd/robotics_core/costmap_2d/src/footprint.cpp + +CMakeFiles/costmap_2d.dir/src/footprint.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/costmap_2d.dir/src/footprint.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/duongtd/robotics_core/costmap_2d/src/footprint.cpp > CMakeFiles/costmap_2d.dir/src/footprint.cpp.i + +CMakeFiles/costmap_2d.dir/src/footprint.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/costmap_2d.dir/src/footprint.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/duongtd/robotics_core/costmap_2d/src/footprint.cpp -o CMakeFiles/costmap_2d.dir/src/footprint.cpp.s + +# Object files for target costmap_2d +costmap_2d_OBJECTS = \ +"CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o" \ +"CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o" \ +"CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o" \ +"CMakeFiles/costmap_2d.dir/src/layer.cpp.o" \ +"CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o" \ +"CMakeFiles/costmap_2d.dir/src/footprint.cpp.o" + +# External object files for target costmap_2d +costmap_2d_EXTERNAL_OBJECTS = + +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/src/layer.cpp.o +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/src/footprint.cpp.o +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/build.make +libcostmap_2d.a: CMakeFiles/costmap_2d.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_7) "Linking CXX static library libcostmap_2d.a" + $(CMAKE_COMMAND) -P CMakeFiles/costmap_2d.dir/cmake_clean_target.cmake + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/costmap_2d.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/costmap_2d.dir/build: libcostmap_2d.a + +.PHONY : CMakeFiles/costmap_2d.dir/build + +CMakeFiles/costmap_2d.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/costmap_2d.dir/cmake_clean.cmake +.PHONY : CMakeFiles/costmap_2d.dir/clean + +CMakeFiles/costmap_2d.dir/depend: + cd /home/duongtd/robotics_core/costmap_2d/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/duongtd/robotics_core/costmap_2d /home/duongtd/robotics_core/costmap_2d /home/duongtd/robotics_core/costmap_2d/build /home/duongtd/robotics_core/costmap_2d/build /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/costmap_2d.dir/depend + diff --git a/build/CMakeFiles/costmap_2d.dir/cmake_clean.cmake b/build/CMakeFiles/costmap_2d.dir/cmake_clean.cmake new file mode 100644 index 0000000..942ff64 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/cmake_clean.cmake @@ -0,0 +1,15 @@ +file(REMOVE_RECURSE + "CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o" + "CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o" + "CMakeFiles/costmap_2d.dir/src/footprint.cpp.o" + "CMakeFiles/costmap_2d.dir/src/layer.cpp.o" + "CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o" + "CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o" + "libcostmap_2d.a" + "libcostmap_2d.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/costmap_2d.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/build/CMakeFiles/costmap_2d.dir/cmake_clean_target.cmake b/build/CMakeFiles/costmap_2d.dir/cmake_clean_target.cmake new file mode 100644 index 0000000..cc64826 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/cmake_clean_target.cmake @@ -0,0 +1,3 @@ +file(REMOVE_RECURSE + "libcostmap_2d.a" +) diff --git a/build/CMakeFiles/costmap_2d.dir/depend.internal b/build/CMakeFiles/costmap_2d.dir/depend.internal new file mode 100644 index 0000000..ee23026 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/depend.internal @@ -0,0 +1,33 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o + /home/duongtd/robotics_core/costmap_2d/src/array_parser.cpp +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o + ../include/costmap_2d/costmap_2d.h + ../include/costmap_2d/msg.h + /home/duongtd/robotics_core/costmap_2d/src/costmap_2d.cpp +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o + ../include/costmap_2d/array_parser.h + ../include/costmap_2d/costmap_math.h + ../include/costmap_2d/footprint.h + ../include/costmap_2d/msg.h + /home/duongtd/robotics_core/costmap_2d/src/footprint.cpp +CMakeFiles/costmap_2d.dir/src/layer.cpp.o + ../include/costmap_2d/cost_values.h + ../include/costmap_2d/costmap_2d.h + ../include/costmap_2d/layer.h + ../include/costmap_2d/layered_costmap.h + ../include/costmap_2d/msg.h + /home/duongtd/robotics_core/costmap_2d/src/layer.cpp +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o + ../include/costmap_2d/cost_values.h + ../include/costmap_2d/costmap_2d.h + ../include/costmap_2d/footprint.h + ../include/costmap_2d/layer.h + ../include/costmap_2d/layered_costmap.h + ../include/costmap_2d/msg.h + /home/duongtd/robotics_core/costmap_2d/src/layered_costmap.cpp +CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o + ../include/costmap_2d/observation_buffer.h + /home/duongtd/robotics_core/costmap_2d/src/observation_buffer.cpp diff --git a/build/CMakeFiles/costmap_2d.dir/depend.make b/build/CMakeFiles/costmap_2d.dir/depend.make new file mode 100644 index 0000000..ea34c7f --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/depend.make @@ -0,0 +1,33 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o: ../src/array_parser.cpp + +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o: ../include/costmap_2d/costmap_2d.h +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o: ../include/costmap_2d/msg.h +CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o: ../src/costmap_2d.cpp + +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o: ../include/costmap_2d/array_parser.h +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o: ../include/costmap_2d/costmap_math.h +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o: ../include/costmap_2d/footprint.h +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o: ../include/costmap_2d/msg.h +CMakeFiles/costmap_2d.dir/src/footprint.cpp.o: ../src/footprint.cpp + +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: ../include/costmap_2d/cost_values.h +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: ../include/costmap_2d/costmap_2d.h +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: ../include/costmap_2d/layer.h +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: ../include/costmap_2d/layered_costmap.h +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: ../include/costmap_2d/msg.h +CMakeFiles/costmap_2d.dir/src/layer.cpp.o: ../src/layer.cpp + +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../include/costmap_2d/cost_values.h +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../include/costmap_2d/costmap_2d.h +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../include/costmap_2d/footprint.h +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../include/costmap_2d/layer.h +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../include/costmap_2d/layered_costmap.h +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../include/costmap_2d/msg.h +CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o: ../src/layered_costmap.cpp + +CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o: ../include/costmap_2d/observation_buffer.h +CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o: ../src/observation_buffer.cpp + diff --git a/build/CMakeFiles/costmap_2d.dir/flags.make b/build/CMakeFiles/costmap_2d.dir/flags.make new file mode 100644 index 0000000..ad98dd8 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -fPIC -std=gnu++17 + +CXX_DEFINES = -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK + +CXX_INCLUDES = -I/home/duongtd/robotics_core/costmap_2d/include -I/usr/include/eigen3 + diff --git a/build/CMakeFiles/costmap_2d.dir/link.txt b/build/CMakeFiles/costmap_2d.dir/link.txt new file mode 100644 index 0000000..eb03c95 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/link.txt @@ -0,0 +1,2 @@ +/usr/bin/ar qc libcostmap_2d.a CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o CMakeFiles/costmap_2d.dir/src/layer.cpp.o CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o CMakeFiles/costmap_2d.dir/src/footprint.cpp.o +/usr/bin/ranlib libcostmap_2d.a diff --git a/build/CMakeFiles/costmap_2d.dir/progress.make b/build/CMakeFiles/costmap_2d.dir/progress.make new file mode 100644 index 0000000..2f82315 --- /dev/null +++ b/build/CMakeFiles/costmap_2d.dir/progress.make @@ -0,0 +1,8 @@ +CMAKE_PROGRESS_1 = 1 +CMAKE_PROGRESS_2 = 2 +CMAKE_PROGRESS_3 = 3 +CMAKE_PROGRESS_4 = 4 +CMAKE_PROGRESS_5 = 5 +CMAKE_PROGRESS_6 = 6 +CMAKE_PROGRESS_7 = 7 + diff --git a/build/CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o b/build/CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o new file mode 100644 index 0000000..a83818f Binary files /dev/null and b/build/CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o differ diff --git a/build/CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o b/build/CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o new file mode 100644 index 0000000..1156f3c Binary files /dev/null and b/build/CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o differ diff --git a/build/CMakeFiles/costmap_2d.dir/src/footprint.cpp.o b/build/CMakeFiles/costmap_2d.dir/src/footprint.cpp.o new file mode 100644 index 0000000..ccb5104 Binary files /dev/null and b/build/CMakeFiles/costmap_2d.dir/src/footprint.cpp.o differ diff --git a/build/CMakeFiles/costmap_2d.dir/src/layer.cpp.o b/build/CMakeFiles/costmap_2d.dir/src/layer.cpp.o new file mode 100644 index 0000000..75b428d Binary files /dev/null and b/build/CMakeFiles/costmap_2d.dir/src/layer.cpp.o differ diff --git a/build/CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o b/build/CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o new file mode 100644 index 0000000..d0463f1 Binary files /dev/null and b/build/CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o differ diff --git a/build/CMakeFiles/layers.dir/CXX.includecache b/build/CMakeFiles/layers.dir/CXX.includecache new file mode 100644 index 0000000..8e54ca9 --- /dev/null +++ b/build/CMakeFiles/layers.dir/CXX.includecache @@ -0,0 +1,8 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + diff --git a/build/CMakeFiles/layers.dir/DependInfo.cmake b/build/CMakeFiles/layers.dir/DependInfo.cmake new file mode 100644 index 0000000..4cb1564 --- /dev/null +++ b/build/CMakeFiles/layers.dir/DependInfo.cmake @@ -0,0 +1,31 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/duongtd/robotics_core/costmap_2d/plugins/inflation_layer.cpp" "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# Preprocessor definitions for this target. +set(CMAKE_TARGET_DEFINITIONS_CXX + "BOOST_ALL_NO_LIB" + "BOOST_ATOMIC_DYN_LINK" + "BOOST_SYSTEM_DYN_LINK" + "BOOST_THREAD_DYN_LINK" + ) + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "../include" + "/usr/include/eigen3" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + "/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/costmap_2d.dir/DependInfo.cmake" + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/build/CMakeFiles/layers.dir/build.make b/build/CMakeFiles/layers.dir/build.make new file mode 100644 index 0000000..803d64f --- /dev/null +++ b/build/CMakeFiles/layers.dir/build.make @@ -0,0 +1,99 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/duongtd/robotics_core/costmap_2d + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/duongtd/robotics_core/costmap_2d/build + +# Include any dependencies generated for this target. +include CMakeFiles/layers.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/layers.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/layers.dir/flags.make + +CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o: CMakeFiles/layers.dir/flags.make +CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o: ../plugins/inflation_layer.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o -c /home/duongtd/robotics_core/costmap_2d/plugins/inflation_layer.cpp + +CMakeFiles/layers.dir/plugins/inflation_layer.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/layers.dir/plugins/inflation_layer.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/duongtd/robotics_core/costmap_2d/plugins/inflation_layer.cpp > CMakeFiles/layers.dir/plugins/inflation_layer.cpp.i + +CMakeFiles/layers.dir/plugins/inflation_layer.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/layers.dir/plugins/inflation_layer.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/duongtd/robotics_core/costmap_2d/plugins/inflation_layer.cpp -o CMakeFiles/layers.dir/plugins/inflation_layer.cpp.s + +# Object files for target layers +layers_OBJECTS = \ +"CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o" + +# External object files for target layers +layers_EXTERNAL_OBJECTS = + +liblayers.a: CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o +liblayers.a: CMakeFiles/layers.dir/build.make +liblayers.a: CMakeFiles/layers.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/duongtd/robotics_core/costmap_2d/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX static library liblayers.a" + $(CMAKE_COMMAND) -P CMakeFiles/layers.dir/cmake_clean_target.cmake + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/layers.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/layers.dir/build: liblayers.a + +.PHONY : CMakeFiles/layers.dir/build + +CMakeFiles/layers.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/layers.dir/cmake_clean.cmake +.PHONY : CMakeFiles/layers.dir/clean + +CMakeFiles/layers.dir/depend: + cd /home/duongtd/robotics_core/costmap_2d/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/duongtd/robotics_core/costmap_2d /home/duongtd/robotics_core/costmap_2d /home/duongtd/robotics_core/costmap_2d/build /home/duongtd/robotics_core/costmap_2d/build /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/layers.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/layers.dir/depend + diff --git a/build/CMakeFiles/layers.dir/cmake_clean.cmake b/build/CMakeFiles/layers.dir/cmake_clean.cmake new file mode 100644 index 0000000..1089c36 --- /dev/null +++ b/build/CMakeFiles/layers.dir/cmake_clean.cmake @@ -0,0 +1,10 @@ +file(REMOVE_RECURSE + "CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o" + "liblayers.a" + "liblayers.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/layers.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/build/CMakeFiles/layers.dir/cmake_clean_target.cmake b/build/CMakeFiles/layers.dir/cmake_clean_target.cmake new file mode 100644 index 0000000..13815ce --- /dev/null +++ b/build/CMakeFiles/layers.dir/cmake_clean_target.cmake @@ -0,0 +1,3 @@ +file(REMOVE_RECURSE + "liblayers.a" +) diff --git a/build/CMakeFiles/layers.dir/depend.internal b/build/CMakeFiles/layers.dir/depend.internal new file mode 100644 index 0000000..5636432 --- /dev/null +++ b/build/CMakeFiles/layers.dir/depend.internal @@ -0,0 +1,5 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o + /home/duongtd/robotics_core/costmap_2d/plugins/inflation_layer.cpp diff --git a/build/CMakeFiles/layers.dir/depend.make b/build/CMakeFiles/layers.dir/depend.make new file mode 100644 index 0000000..8013d5e --- /dev/null +++ b/build/CMakeFiles/layers.dir/depend.make @@ -0,0 +1,5 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o: ../plugins/inflation_layer.cpp + diff --git a/build/CMakeFiles/layers.dir/flags.make b/build/CMakeFiles/layers.dir/flags.make new file mode 100644 index 0000000..ad98dd8 --- /dev/null +++ b/build/CMakeFiles/layers.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -fPIC -std=gnu++17 + +CXX_DEFINES = -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK + +CXX_INCLUDES = -I/home/duongtd/robotics_core/costmap_2d/include -I/usr/include/eigen3 + diff --git a/build/CMakeFiles/layers.dir/link.txt b/build/CMakeFiles/layers.dir/link.txt new file mode 100644 index 0000000..6e4bd22 --- /dev/null +++ b/build/CMakeFiles/layers.dir/link.txt @@ -0,0 +1,2 @@ +/usr/bin/ar qc liblayers.a CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o +/usr/bin/ranlib liblayers.a diff --git a/build/CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o b/build/CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o new file mode 100644 index 0000000..0a2a870 Binary files /dev/null and b/build/CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o differ diff --git a/build/CMakeFiles/layers.dir/progress.make b/build/CMakeFiles/layers.dir/progress.make new file mode 100644 index 0000000..895faac --- /dev/null +++ b/build/CMakeFiles/layers.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 8 +CMAKE_PROGRESS_2 = 9 + diff --git a/build/CMakeFiles/progress.marks b/build/CMakeFiles/progress.marks new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/build/CMakeFiles/progress.marks @@ -0,0 +1 @@ +9 diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 0000000..f7df123 --- /dev/null +++ b/build/Makefile @@ -0,0 +1,372 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/duongtd/robotics_core/costmap_2d + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/duongtd/robotics_core/costmap_2d/build + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache + +.PHONY : rebuild_cache/fast + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache + +.PHONY : edit_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles/progress.marks + $(MAKE) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/duongtd/robotics_core/costmap_2d/build/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean + +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named layers + +# Build rule for target. +layers: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 layers +.PHONY : layers + +# fast build rule for target. +layers/fast: + $(MAKE) -f CMakeFiles/layers.dir/build.make CMakeFiles/layers.dir/build +.PHONY : layers/fast + +#============================================================================= +# Target rules for targets named costmap_2d + +# Build rule for target. +costmap_2d: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 costmap_2d +.PHONY : costmap_2d + +# fast build rule for target. +costmap_2d/fast: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/build +.PHONY : costmap_2d/fast + +plugins/inflation_layer.o: plugins/inflation_layer.cpp.o + +.PHONY : plugins/inflation_layer.o + +# target to build an object file +plugins/inflation_layer.cpp.o: + $(MAKE) -f CMakeFiles/layers.dir/build.make CMakeFiles/layers.dir/plugins/inflation_layer.cpp.o +.PHONY : plugins/inflation_layer.cpp.o + +plugins/inflation_layer.i: plugins/inflation_layer.cpp.i + +.PHONY : plugins/inflation_layer.i + +# target to preprocess a source file +plugins/inflation_layer.cpp.i: + $(MAKE) -f CMakeFiles/layers.dir/build.make CMakeFiles/layers.dir/plugins/inflation_layer.cpp.i +.PHONY : plugins/inflation_layer.cpp.i + +plugins/inflation_layer.s: plugins/inflation_layer.cpp.s + +.PHONY : plugins/inflation_layer.s + +# target to generate assembly for a file +plugins/inflation_layer.cpp.s: + $(MAKE) -f CMakeFiles/layers.dir/build.make CMakeFiles/layers.dir/plugins/inflation_layer.cpp.s +.PHONY : plugins/inflation_layer.cpp.s + +src/array_parser.o: src/array_parser.cpp.o + +.PHONY : src/array_parser.o + +# target to build an object file +src/array_parser.cpp.o: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/array_parser.cpp.o +.PHONY : src/array_parser.cpp.o + +src/array_parser.i: src/array_parser.cpp.i + +.PHONY : src/array_parser.i + +# target to preprocess a source file +src/array_parser.cpp.i: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/array_parser.cpp.i +.PHONY : src/array_parser.cpp.i + +src/array_parser.s: src/array_parser.cpp.s + +.PHONY : src/array_parser.s + +# target to generate assembly for a file +src/array_parser.cpp.s: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/array_parser.cpp.s +.PHONY : src/array_parser.cpp.s + +src/costmap_2d.o: src/costmap_2d.cpp.o + +.PHONY : src/costmap_2d.o + +# target to build an object file +src/costmap_2d.cpp.o: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.o +.PHONY : src/costmap_2d.cpp.o + +src/costmap_2d.i: src/costmap_2d.cpp.i + +.PHONY : src/costmap_2d.i + +# target to preprocess a source file +src/costmap_2d.cpp.i: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.i +.PHONY : src/costmap_2d.cpp.i + +src/costmap_2d.s: src/costmap_2d.cpp.s + +.PHONY : src/costmap_2d.s + +# target to generate assembly for a file +src/costmap_2d.cpp.s: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/costmap_2d.cpp.s +.PHONY : src/costmap_2d.cpp.s + +src/footprint.o: src/footprint.cpp.o + +.PHONY : src/footprint.o + +# target to build an object file +src/footprint.cpp.o: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/footprint.cpp.o +.PHONY : src/footprint.cpp.o + +src/footprint.i: src/footprint.cpp.i + +.PHONY : src/footprint.i + +# target to preprocess a source file +src/footprint.cpp.i: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/footprint.cpp.i +.PHONY : src/footprint.cpp.i + +src/footprint.s: src/footprint.cpp.s + +.PHONY : src/footprint.s + +# target to generate assembly for a file +src/footprint.cpp.s: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/footprint.cpp.s +.PHONY : src/footprint.cpp.s + +src/layer.o: src/layer.cpp.o + +.PHONY : src/layer.o + +# target to build an object file +src/layer.cpp.o: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/layer.cpp.o +.PHONY : src/layer.cpp.o + +src/layer.i: src/layer.cpp.i + +.PHONY : src/layer.i + +# target to preprocess a source file +src/layer.cpp.i: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/layer.cpp.i +.PHONY : src/layer.cpp.i + +src/layer.s: src/layer.cpp.s + +.PHONY : src/layer.s + +# target to generate assembly for a file +src/layer.cpp.s: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/layer.cpp.s +.PHONY : src/layer.cpp.s + +src/layered_costmap.o: src/layered_costmap.cpp.o + +.PHONY : src/layered_costmap.o + +# target to build an object file +src/layered_costmap.cpp.o: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.o +.PHONY : src/layered_costmap.cpp.o + +src/layered_costmap.i: src/layered_costmap.cpp.i + +.PHONY : src/layered_costmap.i + +# target to preprocess a source file +src/layered_costmap.cpp.i: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.i +.PHONY : src/layered_costmap.cpp.i + +src/layered_costmap.s: src/layered_costmap.cpp.s + +.PHONY : src/layered_costmap.s + +# target to generate assembly for a file +src/layered_costmap.cpp.s: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/layered_costmap.cpp.s +.PHONY : src/layered_costmap.cpp.s + +src/observation_buffer.o: src/observation_buffer.cpp.o + +.PHONY : src/observation_buffer.o + +# target to build an object file +src/observation_buffer.cpp.o: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.o +.PHONY : src/observation_buffer.cpp.o + +src/observation_buffer.i: src/observation_buffer.cpp.i + +.PHONY : src/observation_buffer.i + +# target to preprocess a source file +src/observation_buffer.cpp.i: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.i +.PHONY : src/observation_buffer.cpp.i + +src/observation_buffer.s: src/observation_buffer.cpp.s + +.PHONY : src/observation_buffer.s + +# target to generate assembly for a file +src/observation_buffer.cpp.s: + $(MAKE) -f CMakeFiles/costmap_2d.dir/build.make CMakeFiles/costmap_2d.dir/src/observation_buffer.cpp.s +.PHONY : src/observation_buffer.cpp.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... rebuild_cache" + @echo "... layers" + @echo "... edit_cache" + @echo "... costmap_2d" + @echo "... plugins/inflation_layer.o" + @echo "... plugins/inflation_layer.i" + @echo "... plugins/inflation_layer.s" + @echo "... src/array_parser.o" + @echo "... src/array_parser.i" + @echo "... src/array_parser.s" + @echo "... src/costmap_2d.o" + @echo "... src/costmap_2d.i" + @echo "... src/costmap_2d.s" + @echo "... src/footprint.o" + @echo "... src/footprint.i" + @echo "... src/footprint.s" + @echo "... src/layer.o" + @echo "... src/layer.i" + @echo "... src/layer.s" + @echo "... src/layered_costmap.o" + @echo "... src/layered_costmap.i" + @echo "... src/layered_costmap.s" + @echo "... src/observation_buffer.o" + @echo "... src/observation_buffer.i" + @echo "... src/observation_buffer.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/build/cmake_install.cmake b/build/cmake_install.cmake new file mode 100644 index 0000000..28f5752 --- /dev/null +++ b/build/cmake_install.cmake @@ -0,0 +1,49 @@ +# Install script for directory: /home/duongtd/robotics_core/costmap_2d + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/home/duongtd/robotics_core/costmap_2d/build/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/build/libcostmap_2d.a b/build/libcostmap_2d.a new file mode 100644 index 0000000..6d872bd Binary files /dev/null and b/build/libcostmap_2d.a differ diff --git a/build/liblayers.a b/build/liblayers.a new file mode 100644 index 0000000..65e07b5 Binary files /dev/null and b/build/liblayers.a differ diff --git a/include/costmap_2d/array_parser.h b/include/costmap_2d/array_parser.h new file mode 100644 index 0000000..0275bde --- /dev/null +++ b/include/costmap_2d/array_parser.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2012, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * author: Dave Hershberger + */ +#ifndef COSTMAP_2D_ARRAY_PARSER_H +#define COSTMAP_2D_ARRAY_PARSER_H + +#include +#include + +namespace costmap_2d +{ + +/** @brief Parse a vector of vectors of floats from a string. + * @param error_return If no error, error_return is set to "". If + * error, error_return will describe the error. + * Syntax is [[1.0, 2.0], [3.3, 4.4, 5.5], ...] + * + * On error, error_return is set and the return value could be + * anything, like part of a successful parse. */ +std::vector > parseVVF(const std::string& input, std::string& error_return); + +} // end namespace costmap_2d + +#endif // COSTMAP_2D_ARRAY_PARSER_H diff --git a/include/costmap_2d/costmap_2d.h b/include/costmap_2d/costmap_2d.h index b7fec3a..2849ace 100644 --- a/include/costmap_2d/costmap_2d.h +++ b/include/costmap_2d/costmap_2d.h @@ -1,137 +1,103 @@ -#ifndef COSTMAP_2D_COSTMAP_2D_H_ +#ifndef COSTMAP_2D_COSTMAP_2D_H_ // Bảo vệ tránh include file nhiều lần #define COSTMAP_2D_COSTMAP_2D_H_ -#include -#include -#include +#include // Dùng cho std::vector +#include // Dùng trong các thuật toán quét ô (flood fill, BFS) +#include // Dùng mutex để đồng bộ truy cập giữa các thread (multi-thread safe) +#include -namespace costmap_2d +namespace costmap_2d // Mọi thứ nằm trong namespace costmap_2d { - // convenient for storing x/y point pairs - struct MapLocation - { - unsigned int x; - unsigned int y; - }; - struct Point - { - double x; - double y; - }; - /** +// Cấu trúc tiện dụng để lưu trữ cặp tọa độ (x, y) trên bản đồ (dạng ô) +struct MapLocation +{ + unsigned int x; // Chỉ số hàng (hoặc cột) theo trục X trong costmap + unsigned int y; // Chỉ số hàng (hoặc cột) theo trục Y trong costmap +}; + +/** * @class Costmap2D - * @brief A 2D costmap provides a mapping between points in the world and their associated "costs". + * @brief Lớp này đại diện cho bản đồ chi phí 2D (costmap) + * + * Nó ánh xạ giữa không gian thế giới (tọa độ thực, mét) và lưới ô (cells), + * mỗi ô chứa "cost" – tức là chi phí để robot đi qua ô đó (ví dụ: 0 là free, 255 là obstacle). */ class Costmap2D { + // friend class CostmapTester; // Cho phép lớp test (gtest) truy cập vào các thành viên private public: /** - * @brief Constructor for a costmap - * @param cells_size_x The x size of the map in cells - * @param cells_size_y The y size of the map in cells - * @param resolution The resolution of the map in meters/cell - * @param origin_x The x origin of the map - * @param origin_y The y origin of the map - * @param default_value Default Value + * Constructor khởi tạo bản đồ costmap + * @param cells_size_x: số ô theo chiều X + * @param cells_size_y: số ô theo chiều Y + * @param resolution: kích thước 1 ô (mét / ô) + * @param origin_x: gốc bản đồ (tọa độ thế giới) theo trục X + * @param origin_y: gốc bản đồ (tọa độ thế giới) theo trục Y + * @param default_value: giá trị mặc định của mỗi ô (thường là 0 = free) */ Costmap2D(unsigned int cells_size_x, unsigned int cells_size_y, double resolution, double origin_x, double origin_y, unsigned char default_value = 0); /** - * @brief Copy constructor for a costmap, creates a copy efficiently - * @param map The costmap to copy + * Constructor sao chép (copy constructor) + * Dùng để tạo bản sao nhanh của một bản đồ costmap khác. */ Costmap2D(const Costmap2D& map); /** - * @brief Overloaded assignment operator - * @param map The costmap to copy - * @return A reference to the map after the copy has finished + * Toán tử gán (=) được overload để sao chép dữ liệu từ bản đồ khác. */ Costmap2D& operator=(const Costmap2D& map); /** - * @brief Turn this costmap into a copy of a window of a costmap passed in - * @param map The costmap to copy - * @param win_origin_x The x origin (lower left corner) for the window to copy, in meters - * @param win_origin_y The y origin (lower left corner) for the window to copy, in meters - * @param win_size_x The x size of the window, in meters - * @param win_size_y The y size of the window, in meters + * Tạo bản sao từ một vùng (window) của bản đồ khác. + * Dùng khi ta chỉ muốn sao chép một phần nhỏ của bản đồ lớn. */ bool copyCostmapWindow(const Costmap2D& map, double win_origin_x, double win_origin_y, double win_size_x, double win_size_y); - /** - * @brief Default constructor - */ + /// Constructor mặc định (không khởi tạo kích thước) Costmap2D(); - /** - * @brief Destructor - */ + /// Destructor virtual ~Costmap2D(); /** - * @brief Get the cost of a cell in the costmap - * @param mx The x coordinate of the cell - * @param my The y coordinate of the cell - * @return The cost of the cell + * Trả về giá trị chi phí (cost) của một ô (mx, my) */ unsigned char getCost(unsigned int mx, unsigned int my) const; /** - * @brief Set the cost of a cell in the costmap - * @param mx The x coordinate of the cell - * @param my The y coordinate of the cell - * @param cost The cost to set the cell to + * Đặt giá trị cost cho một ô (mx, my) */ void setCost(unsigned int mx, unsigned int my, unsigned char cost); /** - * @brief Convert from map coordinates to world coordinates - * @param mx The x map coordinate - * @param my The y map coordinate - * @param wx Will be set to the associated world x coordinate - * @param wy Will be set to the associated world y coordinate + * Chuyển đổi tọa độ map (ô) → tọa độ thế giới (mét) + * Dùng để vẽ, debug hoặc xác định vị trí thực tế của một ô. */ void mapToWorld(unsigned int mx, unsigned int my, double& wx, double& wy) const; /** - * @brief Convert from world coordinates to map coordinates - * @param wx The x world coordinate - * @param wy The y world coordinate - * @param mx Will be set to the associated map x coordinate - * @param my Will be set to the associated map y coordinate - * @return True if the conversion was successful (legal bounds) false otherwise + * Chuyển đổi tọa độ thế giới → tọa độ map (ô) + * Nếu tọa độ nằm ngoài bản đồ → trả về false */ bool worldToMap(double wx, double wy, unsigned int& mx, unsigned int& my) const; /** - * @brief Convert from world coordinates to map coordinates without checking for legal bounds - * @param wx The x world coordinate - * @param wy The y world coordinate - * @param mx Will be set to the associated map x coordinate - * @param my Will be set to the associated map y coordinate - * @note The returned map coordinates are not guaranteed to lie within the map. + * Chuyển đổi mà không kiểm tra biên hợp lệ (có thể nằm ngoài bản đồ) */ void worldToMapNoBounds(double wx, double wy, int& mx, int& my) const; /** - * @brief Convert from world coordinates to map coordinates, constraining results to legal bounds. - * @param wx The x world coordinate - * @param wy The y world coordinate - * @param mx Will be set to the associated map x coordinate - * @param my Will be set to the associated map y coordinate - * @note The returned map coordinates are guaranteed to lie within the map. + * Chuyển đổi nhưng ép kết quả nằm trong biên của bản đồ (clamped) */ void worldToMapEnforceBounds(double wx, double wy, int& mx, int& my) const; /** - * @brief Given two map coordinates... compute the associated index - * @param mx The x coordinate - * @param my The y coordinate - * @return The associated index + * Tính chỉ số 1D của ô từ cặp tọa độ (mx, my) + * Công thức: index = my * size_x_ + mx */ inline unsigned int getIndex(unsigned int mx, unsigned int my) const { @@ -139,10 +105,7 @@ public: } /** - * @brief Given an index... compute the associated map coordinates - * @param index The index - * @param mx Will be set to the x coordinate - * @param my Will be set to the y coordinate + * Chuyển ngược lại: từ chỉ số 1D → cặp tọa độ (mx, my) */ inline void indexToCells(unsigned int index, unsigned int& mx, unsigned int& my) const { @@ -151,111 +114,103 @@ public: } /** - * @brief Will return a pointer to the underlying unsigned char array used as the costmap - * @return A pointer to the underlying unsigned char array storing cost values + * Trả về con trỏ đến mảng dữ liệu costmap (unsigned char array) */ unsigned char* getCharMap() const; /** - * @brief Accessor for the x size of the costmap in cells - * @return The x size of the costmap + * Trả về số ô theo trục X */ unsigned int getSizeInCellsX() const; /** - * @brief Accessor for the y size of the costmap in cells - * @return The y size of the costmap + * Trả về số ô theo trục Y */ unsigned int getSizeInCellsY() const; /** - * @brief Accessor for the x size of the costmap in meters - * @return The x size of the costmap (returns the centerpoint of the last legal cell in the map) + * Trả về kích thước bản đồ theo mét (theo X) */ double getSizeInMetersX() const; /** - * @brief Accessor for the y size of the costmap in meters - * @return The y size of the costmap (returns the centerpoint of the last legal cell in the map) + * Trả về kích thước bản đồ theo mét (theo Y) */ double getSizeInMetersY() const; /** - * @brief Accessor for the x origin of the costmap - * @return The x origin of the costmap + * Trả về tọa độ gốc bản đồ theo trục X (tọa độ thế giới) */ double getOriginX() const; /** - * @brief Accessor for the y origin of the costmap - * @return The y origin of the costmap + * Trả về tọa độ gốc bản đồ theo trục Y (tọa độ thế giới) */ double getOriginY() const; /** - * @brief Accessor for the resolution of the costmap - * @return The resolution of the costmap + * Trả về độ phân giải (mét / ô) */ double getResolution() const; + /// Đặt giá trị mặc định (cost khi reset map) void setDefaultValue(unsigned char c) { default_value_ = c; } + /// Trả về giá trị mặc định unsigned char getDefaultValue() { return default_value_; } /** - * @brief Sets the cost of a convex polygon to a desired value - * @param polygon The polygon to perform the operation on - * @param cost_value The value to set costs to - * @return True if the polygon was filled... false if it could not be filled + * Đặt cost cho một vùng đa giác lồi (convex polygon) + * Dùng để đánh dấu vùng chướng ngại vật hoặc vùng forbidden. */ bool setConvexPolygonCost(const std::vector& polygon, unsigned char cost_value); /** - * @brief Get the map cells that make up the outline of a polygon - * @param polygon The polygon in map coordinates to rasterize - * @param polygon_cells Will be set to the cells contained in the outline of the polygon + * Lấy danh sách các ô nằm trên viền (outline) của một polygon. */ void polygonOutlineCells(const std::vector& polygon, std::vector& polygon_cells); /** - * @brief Get the map cells that fill a convex polygon - * @param polygon The polygon in map coordinates to rasterize - * @param polygon_cells Will be set to the cells that fill the polygon + * Lấy danh sách các ô nằm bên trong polygon (điền vùng lồi). */ void convexFillCells(const std::vector& polygon, std::vector& polygon_cells); /** - * @brief Move the origin of the costmap to a new location.... keeping data when it can - * @param new_origin_x The x coordinate of the new origin - * @param new_origin_y The y coordinate of the new origin + * Cập nhật lại gốc bản đồ (origin) sang vị trí mới, + * giữ lại dữ liệu cũ nếu có thể (thường dùng khi robot di chuyển xa). */ virtual void updateOrigin(double new_origin_x, double new_origin_y); /** - * @brief Save the costmap out to a pgm file - * @param file_name The name of the file to save + * Lưu bản đồ ra file ảnh PGM (phục vụ debug hoặc visualization) */ bool saveMap(std::string file_name); + /** + * Thay đổi kích thước bản đồ (resize toàn bộ) + */ void resizeMap(unsigned int size_x, unsigned int size_y, double resolution, double origin_x, double origin_y); + /** + * Reset toàn bộ costmap trong vùng (x0, y0) → (xn, yn) + */ void resetMap(unsigned int x0, unsigned int y0, unsigned int xn, unsigned int yn); /** - * @brief Given distance in the world... convert it to cells - * @param world_dist The world distance - * @return The equivalent cell distance + * Chuyển khoảng cách theo mét → số ô tương ứng */ unsigned int cellDistance(double world_dist); - // Provide a typedef to ease future code maintenance + /** + * Định nghĩa mutex để bảo vệ truy cập đồng thời. + */ typedef boost::recursive_mutex mutex_t; mutex_t* getMutex() { @@ -264,17 +219,8 @@ public: protected: /** - * @brief Copy a region of a source map into a destination map - * @param source_map The source map - * @param sm_lower_left_x The lower left x point of the source map to start the copy - * @param sm_lower_left_y The lower left y point of the source map to start the copy - * @param sm_size_x The x size of the source map - * @param dest_map The destination map - * @param dm_lower_left_x The lower left x point of the destination map to start the copy - * @param dm_lower_left_y The lower left y point of the destination map to start the copy - * @param dm_size_x The x size of the destination map - * @param region_size_x The x size of the region to copy - * @param region_size_y The y size of the region to copy + * Hàm template copy một vùng dữ liệu từ bản đồ nguồn → bản đồ đích + * Dữ liệu được copy bằng memcpy để đảm bảo nhanh. */ template void copyMapRegion(data_type* source_map, unsigned int sm_lower_left_x, unsigned int sm_lower_left_y, @@ -282,65 +228,60 @@ protected: unsigned int dm_lower_left_y, unsigned int dm_size_x, unsigned int region_size_x, unsigned int region_size_y) { - // we'll first need to compute the starting points for each map + // Con trỏ bắt đầu tại vị trí góc dưới trái của vùng cần copy trong source data_type* sm_index = source_map + (sm_lower_left_y * sm_size_x + sm_lower_left_x); + // Con trỏ bắt đầu tại vị trí góc dưới trái trong dest data_type* dm_index = dest_map + (dm_lower_left_y * dm_size_x + dm_lower_left_x); - // now, we'll copy the source map into the destination map + // Lặp qua từng hàng trong vùng copy for (unsigned int i = 0; i < region_size_y; ++i) { + // Copy nguyên hàng (memcpy nhanh hơn vòng for từng phần tử) memcpy(dm_index, sm_index, region_size_x * sizeof(data_type)); - sm_index += sm_size_x; - dm_index += dm_size_x; + sm_index += sm_size_x; // chuyển sang hàng tiếp theo của source + dm_index += dm_size_x; // chuyển sang hàng tiếp theo của dest } } /** - * @brief Deletes the costmap, static_map, and markers data structures + * Xóa toàn bộ dữ liệu bản đồ (free bộ nhớ) */ virtual void deleteMaps(); /** - * @brief Resets the costmap and static_map to be unknown space + * Reset toàn bộ dữ liệu bản đồ về trạng thái UNKNOWN (NO_INFORMATION) */ virtual void resetMaps(); /** - * @brief Initializes the costmap, static_map, and markers data structures - * @param size_x The x size to use for map initialization - * @param size_y The y size to use for map initialization + * Cấp phát và khởi tạo bộ nhớ cho costmap */ virtual void initMaps(unsigned int size_x, unsigned int size_y); /** - * @brief Raytrace a line and apply some action at each step - * @param at The action to take... a functor - * @param x0 The starting x coordinate - * @param y0 The starting y coordinate - * @param x1 The ending x coordinate - * @param y1 The ending y coordinate - * @param max_length The maximum desired length of the segment... allows you to not go all the way to the endpoint + * Thuật toán raytracing Bresenham — đi từ điểm (x0,y0) → (x1,y1) + * Mỗi bước sẽ gọi “ActionType” (một functor) để đánh dấu hoặc xử lý từng ô. + * Thường dùng cho sensor update (quét laser). */ template inline void raytraceLine(ActionType at, unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1, unsigned int max_length = UINT_MAX) { - int dx = x1 - x0; - int dy = y1 - y0; + int dx = x1 - x0; // Khoảng cách theo trục X + int dy = y1 - y0; // Khoảng cách theo trục Y unsigned int abs_dx = abs(dx); unsigned int abs_dy = abs(dy); - int offset_dx = sign(dx); - int offset_dy = sign(dy) * size_x_; + int offset_dx = sign(dx); // Hướng đi theo X + int offset_dy = sign(dy) * size_x_; // Hướng đi theo Y (theo stride của hàng) - unsigned int offset = y0 * size_x_ + x0; + unsigned int offset = y0 * size_x_ + x0; // Vị trí bắt đầu trong mảng costmap - // we need to chose how much to scale our dominant dimension, based on the maximum length of the line - double dist = hypot(dx, dy); + double dist = hypot(dx, dy); // Chiều dài đoạn thẳng double scale = (dist == 0.0) ? 1.0 : std::min(1.0, max_length / dist); - // if x is dominant + // Xét hướng nào là trục chính (dominant) if (abs_dx >= abs_dy) { int error_y = abs_dx / 2; @@ -348,14 +289,13 @@ protected: return; } - // otherwise y is dominant int error_x = abs_dy / 2; bresenham2D(at, abs_dy, abs_dx, error_x, offset_dy, offset_dx, offset, (unsigned int)(scale * abs_dy)); } private: /** - * @brief A 2D implementation of Bresenham's raytracing algorithm... applies an action at each step + * Triển khai Bresenham 2D — đi qua từng ô trên đường thẳng và gọi “at(offset)” mỗi bước. */ template inline void bresenham2D(ActionType at, unsigned int abs_da, unsigned int abs_db, int error_b, int offset_a, @@ -364,33 +304,38 @@ private: unsigned int end = std::min(max_length, abs_da); for (unsigned int i = 0; i < end; ++i) { - at(offset); - offset += offset_a; + at(offset); // Gọi hành động (thường là đánh dấu costmap) + offset += offset_a; // Tiến thêm 1 bước theo hướng chính error_b += abs_db; if ((unsigned int)error_b >= abs_da) { - offset += offset_b; + offset += offset_b; // Bước sang hàng tiếp theo khi sai số tích lũy đủ lớn error_b -= abs_da; } } - at(offset); + at(offset); // Xử lý ô cuối cùng } + /// Trả về dấu của số nguyên (x>0:1, x<0:-1) inline int sign(int x) { return x > 0 ? 1.0 : -1.0; } - mutex_t* access_; -protected: - unsigned int size_x_; - unsigned int size_y_; - double resolution_; - double origin_x_; - double origin_y_; - unsigned char* costmap_; - unsigned char default_value_; + mutex_t* access_; // Con trỏ đến mutex (đồng bộ truy cập costmap giữa các thread) +protected: + unsigned int size_x_; // Số lượng ô theo trục X + unsigned int size_y_; // Số lượng ô theo trục Y + double resolution_; // Độ phân giải: mét/ô + double origin_x_; // Tọa độ gốc bản đồ (theo thế giới) trục X + double origin_y_; // Tọa độ gốc bản đồ (theo thế giới) trục Y + unsigned char* costmap_; // Mảng 1 chiều chứa giá trị cost của toàn bộ bản đồ + unsigned char default_value_; // Giá trị mặc định cho các ô (thường = 0 hoặc 255 nếu unknown) + + /** + * Functor nội bộ: dùng trong raytraceLine để đánh dấu một ô. + */ class MarkCell { public: @@ -400,13 +345,16 @@ protected: } inline void operator()(unsigned int offset) { - costmap_[offset] = value_; + costmap_[offset] = value_; // Gán cost của ô bằng giá trị value_ } private: unsigned char* costmap_; unsigned char value_; }; + /** + * Functor nội bộ: dùng để thu thập các ô nằm trên viền polygon. + */ class PolygonOutlineCells { public: @@ -415,12 +363,11 @@ protected: { } - // just push the relevant cells back onto the list inline void operator()(unsigned int offset) { MapLocation loc; - costmap_.indexToCells(offset, loc.x, loc.y); - cells_.push_back(loc); + costmap_.indexToCells(offset, loc.x, loc.y); // Chuyển index → (x, y) + cells_.push_back(loc); // Thêm ô này vào danh sách viền polygon } private: @@ -432,4 +379,4 @@ protected: } // namespace costmap_2d -#endif // COSTMAP_2D_COSTMAP_2D_H +#endif // COSTMAP_2D_COSTMAP_2D_H_ diff --git a/include/costmap_2d/costmap_layer.h b/include/costmap_2d/costmap_layer.h new file mode 100644 index 0000000..a989796 --- /dev/null +++ b/include/costmap_2d/costmap_layer.h @@ -0,0 +1,151 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + * David V. Lu!! + *********************************************************************/ +#ifndef COSTMAP_2D_COSTMAP_LAYER_H_ +#define COSTMAP_2D_COSTMAP_LAYER_H_ +#include +#include +#include + +namespace costmap_2d +{ + +class CostmapLayer : public Layer, public Costmap2D +{ +public: + CostmapLayer() : has_extra_bounds_(false), + extra_min_x_(1e6), extra_max_x_(-1e6), + extra_min_y_(1e6), extra_max_y_(-1e6) {} + + bool isDiscretized() + { + return true; + } + + virtual void matchSize(); + + virtual void clearArea(int start_x, int start_y, int end_x, int end_y, bool invert_area=false); + + /** + * If an external source changes values in the costmap, + * it should call this method with the area that it changed + * to ensure that the costmap includes this region as well. + * @param mx0 Minimum x value of the bounding box + * @param my0 Minimum y value of the bounding box + * @param mx1 Maximum x value of the bounding box + * @param my1 Maximum y value of the bounding box + */ + void addExtraBounds(double mx0, double my0, double mx1, double my1); + +protected: + /* + * Updates the master_grid within the specified + * bounding box using this layer's values. + * + * TrueOverwrite means every value from this layer + * is written into the master grid. + */ + void updateWithTrueOverwrite(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j); + + /* + * Updates the master_grid within the specified + * bounding box using this layer's values. + * + * Overwrite means every valid value from this layer + * is written into the master grid (does not copy NO_INFORMATION) + */ + void updateWithOverwrite(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j); + + /* + * Updates the master_grid within the specified + * bounding box using this layer's values. + * + * Sets the new value to the maximum of the master_grid's value + * and this layer's value. If the master value is NO_INFORMATION, + * it is overwritten. If the layer's value is NO_INFORMATION, + * the master value does not change. + */ + void updateWithMax(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j); + + /* + * Updates the master_grid within the specified + * bounding box using this layer's values. + * + * Sets the new value to the sum of the master grid's value + * and this layer's value. If the master value is NO_INFORMATION, + * it is overwritten with the layer's value. If the layer's value + * is NO_INFORMATION, then the master value does not change. + * + * If the sum value is larger than INSCRIBED_INFLATED_OBSTACLE, + * the master value is set to (INSCRIBED_INFLATED_OBSTACLE - 1). + */ + void updateWithAddition(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j); + + /** + * Updates the bounding box specified in the parameters to include + * the location (x,y) + * + * @param x x-coordinate to include + * @param y y-coordinate to include + * @param min_x bounding box + * @param min_y bounding box + * @param max_x bounding box + * @param max_y bounding box + */ + void touch(double x, double y, double* min_x, double* min_y, double* max_x, double* max_y); + + /* + * Updates the bounding box specified in the parameters + * to include the bounding box from the addExtraBounds + * call. If addExtraBounds was not called, the method will do nothing. + * + * Should be called at the beginning of the updateBounds method + * + * @param min_x bounding box (input and output) + * @param min_y bounding box (input and output) + * @param max_x bounding box (input and output) + * @param max_y bounding box (input and output) + */ + void useExtraBounds(double* min_x, double* min_y, double* max_x, double* max_y); + bool has_extra_bounds_; + +private: + double extra_min_x_, extra_max_x_, extra_min_y_, extra_max_y_; +}; + +} // namespace costmap_2d +#endif // COSTMAP_2D_COSTMAP_LAYER_H_ diff --git a/include/costmap_2d/costmap_math.h b/include/costmap_2d/costmap_math.h new file mode 100644 index 0000000..46872b3 --- /dev/null +++ b/include/costmap_2d/costmap_math.h @@ -0,0 +1,69 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + * David V. Lu!! + *********************************************************************/ +#ifndef COSTMAP_2D_COSTMAP_MATH_H_ +#define COSTMAP_2D_COSTMAP_MATH_H_ + +#include +#include +#include +#include + +/** @brief Return -1 if x < 0, +1 otherwise. */ +inline double sign(double x) +{ + return x < 0.0 ? -1.0 : 1.0; +} + +/** @brief Same as sign(x) but returns 0 if x is 0. */ +inline double sign0(double x) +{ + return x < 0.0 ? -1.0 : (x > 0.0 ? 1.0 : 0.0); +} + +inline double distance(double x0, double y0, double x1, double y1) +{ + return hypot(x1 - x0, y1 - y0); +} + +double distanceToLine(double pX, double pY, double x0, double y0, double x1, double y1); + +bool intersects(std::vector& polygon, float testx, float testy); + +bool intersects(std::vector& polygon1, std::vector& polygon2); + +#endif // COSTMAP_2D_COSTMAP_MATH_H_ diff --git a/include/costmap_2d/critical_layer.h b/include/costmap_2d/critical_layer.h new file mode 100644 index 0000000..eb4e3ee --- /dev/null +++ b/include/costmap_2d/critical_layer.h @@ -0,0 +1,19 @@ +#ifndef COSTMAP_2D_CRITICAL_LAYER_H_ +#define COSTMAP_2D_CRITICAL_LAYER_H_ + +#include + +namespace costmap_2d +{ +class CriticalLayer : public StaticLayer +{ +public: + CriticalLayer(); + virtual ~CriticalLayer(); +private: + unsigned char interpretValue(unsigned char value); + void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j); +}; +} + +#endif // COSTMAP_2D_CRITICAL_LAYER_H_ \ No newline at end of file diff --git a/include/costmap_2d/footprint.h b/include/costmap_2d/footprint.h new file mode 100644 index 0000000..8fce107 --- /dev/null +++ b/include/costmap_2d/footprint.h @@ -0,0 +1,147 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + * David V. Lu!! + *********************************************************************/ +#ifndef COSTMAP_2D_FOOTPRINT_H +#define COSTMAP_2D_FOOTPRINT_H + +#include +#include +#include + +using namespace std; + +namespace costmap_2d +{ + +/** + * @brief Calculate the extreme distances for the footprint + * + * @param footprint The footprint to examine + * @param min_dist Output parameter of the minimum distance + * @param max_dist Output parameter of the maximum distance + */ +void calculateMinAndMaxDistances(const std::vector& footprint, + double& min_dist, double& max_dist); + +/** + * @brief Convert Point32 to Point + */ +Point toPoint(Point32 pt); + +/** + * @brief Convert Point to Point32 + */ +Point32 toPoint32(Point pt); + +/** + * @brief Convert vector of Points to Polygon msg + */ +Polygon toPolygon(std::vector pts); + +/** + * @brief Convert Polygon msg to vector of Points. + */ +std::vector toPointVector(Polygon polygon); + +/** + * @brief Given a pose and base footprint, build the oriented footprint of the robot (list of Points) + * @param x The x position of the robot + * @param y The y position of the robot + * @param theta The orientation of the robot + * @param footprint_spec Basic shape of the footprint + * @param oriented_footprint Will be filled with the points in the oriented footprint of the robot +*/ +void transformFootprint(double x, double y, double theta, const std::vector& footprint_spec, + std::vector& oriented_footprint); + +/** + * @brief Given a pose and base footprint, build the oriented footprint of the robot (PolygonStamped) + * @param x The x position of the robot + * @param y The y position of the robot + * @param theta The orientation of the robot + * @param footprint_spec Basic shape of the footprint + * @param oriented_footprint Will be filled with the points in the oriented footprint of the robot +*/ +void transformFootprint(double x, double y, double theta, const std::vector& footprint_spec, + PolygonStamped & oriented_footprint); + +/** + * @brief Adds the specified amount of padding to the footprint (in place) + */ +void padFootprint(std::vector& footprint, double padding); + +/** + * @brief Create a circular footprint from a given radius + */ +std::vector makeFootprintFromRadius(double radius); + +/** + * @brief Make the footprint from the given string. + * + * Format should be bracketed array of arrays of floats, like so: [[1.0, 2.2], [3.3, 4.2], ...] + * + */ +bool makeFootprintFromString(const std::string& footprint_string, std::vector& footprint); + +/** + * @brief Read the ros-params "footprint" and/or "robot_radius" from + * the given NodeHandle using searchParam() to go up the tree. + */ +std::vector makeFootprintFromParams(std::string& nh); + +/** + * @brief Create the footprint from the given XmlRpcValue. + * + * @param footprint_xmlrpc should be an array of arrays, where the + * top-level array should have 3 or more elements, and the + * sub-arrays should all have exactly 2 elements (x and y + * coordinates). + * + * @param full_param_name this is the full name of the rosparam from + * which the footprint_xmlrpc value came. It is used only for + * reporting errors. */ +std::vector makeFootprintFromXMLRPC(XmlRpcValue& footprint_xmlrpc, + const std::string& full_param_name); + +/** @brief Write the current unpadded_footprint_ to the "footprint" + * parameter of the given NodeHandle so that dynamic_reconfigure + * will see the new value. */ +void writeFootprintToParam(std::string& nh, const std::vector& footprint); + +} // end namespace costmap_2d + +#endif // COSTMAP_2D_FOOTPRINT_H diff --git a/include/costmap_2d/inflation_layer.h b/include/costmap_2d/inflation_layer.h new file mode 100644 index 0000000..ff6c7ff --- /dev/null +++ b/include/costmap_2d/inflation_layer.h @@ -0,0 +1,164 @@ + +#ifndef COSTMAP_2D_INFLATION_LAYER_H_ +#define COSTMAP_2D_INFLATION_LAYER_H_ + +// #include +// #include +// #include +// #include +// #include +// #include + +// namespace costmap_2d +// { +// /** +// * @class CellData +// * @brief Storage for cell information used during obstacle inflation +// */ +// class CellData +// { +// public: +// /** +// * @brief Constructor for a CellData objects +// * @param i The index of the cell in the cost map +// * @param x The x coordinate of the cell in the cost map +// * @param y The y coordinate of the cell in the cost map +// * @param sx The x coordinate of the closest obstacle cell in the costmap +// * @param sy The y coordinate of the closest obstacle cell in the costmap +// * @return +// */ +// CellData(double i, unsigned int x, unsigned int y, unsigned int sx, unsigned int sy) : +// index_(i), x_(x), y_(y), src_x_(sx), src_y_(sy) +// { +// } +// unsigned int index_; +// unsigned int x_, y_; +// unsigned int src_x_, src_y_; +// }; + +// class InflationLayer : public Layer +// { +// public: +// InflationLayer(); + +// virtual ~InflationLayer() +// { +// deleteKernels(); +// if (dsrv_) +// delete dsrv_; +// if (seen_) +// delete[] seen_; +// } + +// virtual void onInitialize(); +// virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y, +// double* max_x, double* max_y); +// virtual void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j); +// virtual bool isDiscretized() +// { +// return true; +// } +// virtual void matchSize(); + +// virtual void reset() { onInitialize(); } + +// /** @brief Given a distance, compute a cost. +// * @param distance The distance from an obstacle in cells +// * @return A cost value for the distance */ +// virtual inline unsigned char computeCost(double distance) const +// { +// unsigned char cost = 0; +// if (distance == 0) +// cost = LETHAL_OBSTACLE; +// else if (distance * resolution_ <= inscribed_radius_) +// cost = INSCRIBED_INFLATED_OBSTACLE; +// else +// { +// // make sure cost falls off by Euclidean distance +// double euclidean_distance = distance * resolution_; +// double factor = exp(-1.0 * weight_ * (euclidean_distance - inscribed_radius_)); +// cost = (unsigned char)((INSCRIBED_INFLATED_OBSTACLE - 1) * factor); +// } +// return cost; +// } + +// /** +// * @brief Change the values of the inflation radius parameters +// * @param inflation_radius The new inflation radius +// * @param cost_scaling_factor The new weight +// */ +// void setInflationParameters(double inflation_radius, double cost_scaling_factor); + +// protected: +// virtual void onFootprintChanged(); +// boost::recursive_mutex* inflation_access_; + +// double resolution_; +// double inflation_radius_; +// double inscribed_radius_; +// double weight_; +// bool inflate_unknown_; + +// private: +// /** +// * @brief Lookup pre-computed distances +// * @param mx The x coordinate of the current cell +// * @param my The y coordinate of the current cell +// * @param src_x The x coordinate of the source cell +// * @param src_y The y coordinate of the source cell +// * @return +// */ +// inline double distanceLookup(int mx, int my, int src_x, int src_y) +// { +// unsigned int dx = abs(mx - src_x); +// unsigned int dy = abs(my - src_y); +// return cached_distances_[dx][dy]; +// } + +// /** +// * @brief Lookup pre-computed costs +// * @param mx The x coordinate of the current cell +// * @param my The y coordinate of the current cell +// * @param src_x The x coordinate of the source cell +// * @param src_y The y coordinate of the source cell +// * @return +// */ +// inline unsigned char costLookup(int mx, int my, int src_x, int src_y) +// { +// unsigned int dx = abs(mx - src_x); +// unsigned int dy = abs(my - src_y); +// return cached_costs_[dx][dy]; +// } + +// void computeCaches(); +// void deleteKernels(); +// void inflate_area(int min_i, int min_j, int max_i, int max_j, unsigned char* master_grid); + +// unsigned int cellDistance(double world_dist) +// { +// return layered_costmap_->getCostmap()->cellDistance(world_dist); +// } + +// inline void enqueue(unsigned int index, unsigned int mx, unsigned int my, +// unsigned int src_x, unsigned int src_y); + +// unsigned int cell_inflation_radius_; +// unsigned int cached_cell_inflation_radius_; +// std::map > inflation_cells_; + +// bool* seen_; +// int seen_size_; + +// unsigned char** cached_costs_; +// double** cached_distances_; +// double last_min_x_, last_min_y_, last_max_x_, last_max_y_; + +// dynamic_reconfigure::Server *dsrv_; +// void reconfigureCB(costmap_2d::InflationPluginConfig &config, uint32_t level); + +// bool need_reinflation_; ///< Indicates that the entire costmap should be reinflated next time around. +// }; + +// } // namespace costmap_2d + +#endif // COSTMAP_2D_INFLATION_LAYER_H_ diff --git a/include/costmap_2d/layer.h b/include/costmap_2d/layer.h new file mode 100644 index 0000000..d5940ff --- /dev/null +++ b/include/costmap_2d/layer.h @@ -0,0 +1,151 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: David V. Lu!! + *********************************************************************/ +#ifndef COSTMAP_2D_LAYER_H_ +#define COSTMAP_2D_LAYER_H_ + +#include +#include +#include +#include "tf2/buffer_core.h" + +namespace costmap_2d +{ +class LayeredCostmap; + +class Layer +{ +public: + Layer(); + + void initialize(LayeredCostmap* parent, std::string name, std::shared_ptr *tf); + + /** + * @brief This is called by the LayeredCostmap to poll this plugin as to how + * much of the costmap it needs to update. Each layer can increase + * the size of this bounds. + * + * For more details, see "Layered Costmaps for Context-Sensitive Navigation", + * by Lu et. Al, IROS 2014. + */ + virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y, + double* max_x, double* max_y) {} + + /** + * @brief Actually update the underlying costmap, only within the bounds + * calculated during UpdateBounds(). + */ + virtual void updateCosts(Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) {} + + /** @brief Stop publishers. */ + virtual void deactivate() {} + + /** @brief Restart publishers if they've been stopped. */ + virtual void activate() {} + + virtual void reset() {} + + virtual ~Layer() {} + + /** + * @brief Check to make sure all the data in the layer is up to date. + * If the layer is not up to date, then it may be unsafe to + * plan using the data from this layer, and the planner may + * need to know. + * + * A layer's current state should be managed by the protected + * variable current_. + * @return Whether the data in the layer is up to date. + */ + bool isCurrent() const + { + return current_; + } + + /** + * @brief getter if the current layer is enabled. + * + * The user may enable/disable a layer though dynamic reconfigure. + * Disabled layers won't receive calls to + * - Layer::updateCosts + * - Layer::updateBounds + * - Layer::isCurrent + * from the LayeredCostmap. + * + * Calls to Layer::activate, Layer::deactivate and Layer::reset won't be + * blocked. + */ + inline bool isEnabled() const noexcept + { + return enabled_; + } + + /** @brief Implement this to make this layer match the size of the parent costmap. */ + virtual void matchSize() {} + + inline const std::string& getName() const noexcept + { + return name_; + } + + /** @brief Convenience function for layered_costmap_->getFootprint(). */ + const std::vector& getFootprint() const; + + /** @brief LayeredCostmap calls this whenever the footprint there + * changes (via LayeredCostmap::setFootprint()). Override to be + * notified of changes to the robot's footprint. */ + virtual void onFootprintChanged() {} + +protected: + /** @brief This is called at the end of initialize(). Override to + * implement subclass-specific initialization. + * + * tf_, name_, and layered_costmap_ will all be set already when this is called. */ + virtual void onInitialize() {} + + LayeredCostmap* layered_costmap_; + bool current_; + bool enabled_; + std::string name_; + std::shared_ptr *tf_; + +private: + std::vector footprint_spec_; +}; + +} // namespace costmap_2d + +#endif // COSTMAP_2D_LAYER_H_ diff --git a/include/costmap_2d/layered_costmap.h b/include/costmap_2d/layered_costmap.h index e69de29..6227106 100644 --- a/include/costmap_2d/layered_costmap.h +++ b/include/costmap_2d/layered_costmap.h @@ -0,0 +1,193 @@ +#ifndef COSTMAP_2D_LAYERED_COSTMAP_H_ +#define COSTMAP_2D_LAYERED_COSTMAP_H_ + +#include // Chứa các hằng số giá trị chi phí (ví dụ: FREE_SPACE, LETHAL_OBSTACLE, NO_INFORMATION) +#include // Lớp cơ sở cho các lớp (layer) con: static layer, obstacle layer, inflation layer... +#include // Định nghĩa lớp Costmap2D (bản đồ 2D cơ bản) +#include +#include + +namespace costmap_2d +{ + +class Layer; // Khai báo trước để dùng trong vector plugin + +/** + * @class LayeredCostmap + * @brief Lớp này quản lý nhiều "layer" (tầng bản đồ) khác nhau và kết hợp chúng thành một bản đồ chi phí tổng hợp. + * Mỗi layer có thể chứa thông tin khác nhau: chướng ngại vật, vùng lạm phát, vùng cấm, v.v. + */ +class LayeredCostmap +{ +public: + /** + * @brief Hàm khởi tạo LayeredCostmap. + * @param global_frame: Tên frame toàn cục (ví dụ: "map" hoặc "odom"). + * @param rolling_window: Nếu true, bản đồ sẽ "trượt" theo robot (rolling window). + * @param track_unknown: Nếu true, sẽ lưu trữ vùng chưa biết (NO_INFORMATION). + */ + LayeredCostmap(std::string global_frame, bool rolling_window, bool track_unknown); + + /** + * @brief Hàm huỷ lớp LayeredCostmap. + */ + ~LayeredCostmap(); + + /** + * @brief Cập nhật bản đồ tổng hợp từ tất cả các layer. + * @param robot_x, robot_y, robot_yaw: vị trí và hướng hiện tại của robot. + * @note Hàm này gọi updateBounds() và updateCosts() trên từng layer. + */ + void updateMap(double robot_x, double robot_y, double robot_yaw); + + /// @brief Trả về frame toàn cục (ví dụ "map"). + inline const std::string& getGlobalFrameID() const noexcept + { + return global_frame_; + } + + /** + * @brief Thay đổi kích thước bản đồ (số ô, độ phân giải, gốc). + * @param size_x, size_y: kích thước theo ô (cells). + * @param resolution: độ phân giải (mỗi ô = bao nhiêu mét). + * @param origin_x, origin_y: toạ độ gốc của bản đồ. + * @param size_locked: nếu true, không cho phép thay đổi kích thước sau này. + */ + void resizeMap(unsigned int size_x, unsigned int size_y, double resolution, double origin_x, double origin_y, + bool size_locked = false); + + /** + * @brief Lấy vùng bản đồ bị thay đổi gần nhất sau lần cập nhật gần nhất. + * @param [out] minx, miny, maxx, maxy: toạ độ của vùng được cập nhật. + */ + void getUpdatedBounds(double& minx, double& miny, double& maxx, double& maxy) + { + minx = minx_; + miny = miny_; + maxx = maxx_; + maxy = maxy_; + } + + /** + * @brief Kiểm tra xem tất cả các layer hiện tại có dữ liệu mới nhất (current) hay không. + * @return true nếu tất cả layer đều cập nhật. + */ + bool isCurrent(); + + /** + * @brief Trả về con trỏ đến bản đồ Costmap2D cơ sở (master map). + */ + Costmap2D* getCostmap() + { + return &costmap_; + } + + /** + * @brief Kiểm tra xem bản đồ có phải kiểu "rolling window" không. + */ + bool isRolling() + { + return rolling_window_; + } + + /** + * @brief Kiểm tra xem bản đồ có đang lưu trữ vùng "chưa biết" không (NO_INFORMATION). + */ + bool isTrackingUnknown() + { + return costmap_.getDefaultValue() == costmap_2d::NO_INFORMATION; + } + + /** + * @brief Trả về danh sách các plugin (layer) đã được nạp. + * @return vector các shared_ptr. + */ + std::vector >* getPlugins() + { + return &plugins_; + } + + /** + * @brief Thêm một plugin (layer) mới vào bản đồ. + * @param plugin: con trỏ thông minh đến lớp layer. + */ + void addPlugin(boost::shared_ptr plugin) + { + plugins_.push_back(plugin); + } + + /** + * @brief Kiểm tra xem bản đồ có bị khoá kích thước không. + */ + bool isSizeLocked() + { + return size_locked_; + } + + /** + * @brief Lấy giới hạn vùng bản đồ được cập nhật trong lần gọi update gần nhất. + * @param [out] x0, xn, y0, yn: chỉ số ô (cells) bắt đầu và kết thúc. + */ + void getBounds(unsigned int* x0, unsigned int* xn, unsigned int* y0, unsigned int* yn) + { + *x0 = bx0_; + *xn = bxn_; + *y0 = by0_; + *yn = byn_; + } + + /** + * @brief Kiểm tra xem lớp LayeredCostmap đã được khởi tạo hoàn chỉnh chưa. + */ + bool isInitialized() + { + return initialized_; + } + + /** + * @brief Cập nhật footprint (hình dạng chiếm chỗ của robot). + * Đồng thời tính lại bán kính bao quanh và nội tiếp. + * Gọi hàm onFootprintChanged() của tất cả layer. + * @param footprint_spec: vector các điểm (geometry_msgs::Point) mô tả đa giác footprint. + */ + void setFootprint(const std::vector& footprint_spec); + + /** + * @brief Trả về footprint hiện tại của robot. + */ + const std::vector& getFootprint() { return footprint_; } + + /** + * @brief Bán kính đường tròn bao ngoài (circumscribed radius): + * bán kính nhỏ nhất của đường tròn chứa toàn bộ robot. + */ + double getCircumscribedRadius() { return circumscribed_radius_; } + + /** + * @brief Bán kính đường tròn nội tiếp (inscribed radius): + * bán kính lớn nhất của đường tròn nằm hoàn toàn bên trong footprint robot. + */ + double getInscribedRadius() { return inscribed_radius_; } + +private: + Costmap2D costmap_; ///< Bản đồ 2D chính (lưu ma trận chi phí tổng hợp) + std::string global_frame_; ///< Frame toàn cục (thường là "map" hoặc "odom") + + bool rolling_window_; ///< Nếu true, bản đồ sẽ di chuyển theo robot (bản đồ trượt) + + bool current_; ///< Cờ đánh dấu tất cả các layer có dữ liệu mới nhất hay không + double minx_, miny_, maxx_, maxy_; ///< Giới hạn vùng bản đồ được cập nhật (tọa độ thế giới) + unsigned int bx0_, bxn_, by0_, byn_; ///< Giới hạn vùng bản đồ được cập nhật (tọa độ lưới) + + std::vector > plugins_; ///< Danh sách các layer plugin (ví dụ: StaticLayer, ObstacleLayer, InflationLayer) + + bool initialized_; ///< Đã được khởi tạo hoàn toàn hay chưa + bool size_locked_; ///< Có cho phép thay đổi kích thước bản đồ sau này không + + double circumscribed_radius_, inscribed_radius_; ///< Hai bán kính của footprint robot (bao ngoài và nội tiếp) + std::vector footprint_; ///< Đa giác mô tả footprint robot +}; + +} // namespace costmap_2d + +#endif // COSTMAP_2D_LAYERED_COSTMAP_H_ diff --git a/include/costmap_2d/msg.h b/include/costmap_2d/msg.h new file mode 100644 index 0000000..1987718 --- /dev/null +++ b/include/costmap_2d/msg.h @@ -0,0 +1,66 @@ +#ifndef COSTMAP_2D_COST_VALUES_H_MSG +#define COSTMAP_2D_COST_VALUES_H_MSG +/** Provides a mapping for often used cost values */ +#include +namespace costmap_2d +{ + struct Point + { + double x; + double y; + double z; + }; + + struct Point32 + { + float x; + float y; + float z; + }; + + struct Polygon + { + std::vector points; + }; + + struct PolygonStamped + { + // std_msgs/Header header; // Ignored for simplicity + Polygon polygon; + }; + + struct XmlRpcValue + { + std::vector points; + }; + + struct PointField + { + uint8_t INT8=1; + uint8_t UINT8=2; + uint8_t INT16=3; + uint8_t UINT16=4; + uint8_t INT32=5; + uint8_t UINT32=6; + uint8_t FLOAT32=7; + uint8_t FLOAT64=8; + std::string name; + uint32_t offset; + uint8_t datatype; + uint32_t count; + }; + + struct PointCloud2 + { + uint32_t height; + uint32_t width; + std::vector fields; + bool is_bigendian; + uint32_t point_step; + uint32_t row_step; + std::vector data; + bool is_dense; + }; + +} +#endif // COSTMAP_2D_COST_VALUES_H_MSG diff --git a/include/costmap_2d/observation_buffer.h b/include/costmap_2d/observation_buffer.h new file mode 100644 index 0000000..14d7165 --- /dev/null +++ b/include/costmap_2d/observation_buffer.h @@ -0,0 +1,154 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + *********************************************************************/ +#ifndef COSTMAP_2D_OBSERVATION_BUFFER_H_ +#define COSTMAP_2D_OBSERVATION_BUFFER_H_ + +#include +#include +#include +#include +#include +#include + +#include + +// Thread support +#include + +namespace costmap_2d +{ +/** + * @class ObservationBuffer + * @brief Takes in point clouds from sensors, transforms them to the desired frame, and stores them + */ +class ObservationBuffer +{ +public: + /** + * @brief Constructs an observation buffer + * @param topic_name The topic of the observations, used as an identifier for error and warning messages + * @param observation_keep_time Defines the persistence of observations in seconds, 0 means only keep the latest + * @param expected_update_rate How often this buffer is expected to be updated, 0 means there is no limit + * @param min_obstacle_height The minimum height of a hitpoint to be considered legal + * @param max_obstacle_height The minimum height of a hitpoint to be considered legal + * @param obstacle_range The range to which the sensor should be trusted for inserting obstacles + * @param raytrace_range The range to which the sensor should be trusted for raytracing to clear out space + * @param tf2_buffer A reference to a tf2 Buffer + * @param global_frame The frame to transform PointClouds into + * @param sensor_frame The frame of the origin of the sensor, can be left blank to be read from the messages + * @param tf_tolerance The amount of time to wait for a transform to be available when setting a new global frame + */ + ObservationBuffer(std::string topic_name, double observation_keep_time, double expected_update_rate, + double min_obstacle_height, double max_obstacle_height, double obstacle_range, + double raytrace_range, tf2_ros::Buffer& tf2_buffer, std::string global_frame, + std::string sensor_frame, double tf_tolerance); + + /** + * @brief Destructor... cleans up + */ + ~ObservationBuffer(); + + /** + * @brief Sets the global frame of an observation buffer. This will + * transform all the currently cached observations to the new global + * frame + * @param new_global_frame The name of the new global frame. + * @return True if the operation succeeds, false otherwise + */ + bool setGlobalFrame(const std::string new_global_frame); + + /** + * @brief Transforms a PointCloud to the global frame and buffers it + * Note: The burden is on the user to make sure the transform is available... ie they should use a MessageNotifier + * @param cloud The cloud to be buffered + */ + void bufferCloud(const sensor_msgs::PointCloud2& cloud); + + /** + * @brief Pushes copies of all current observations onto the end of the vector passed in + * @param observations The vector to be filled + */ + void getObservations(std::vector& observations); + + /** + * @brief Check if the observation buffer is being update at its expected rate + * @return True if it is being updated at the expected rate, false otherwise + */ + bool isCurrent() const; + + /** + * @brief Lock the observation buffer + */ + inline void lock() + { + lock_.lock(); + } + + /** + * @brief Lock the observation buffer + */ + inline void unlock() + { + lock_.unlock(); + } + + /** + * @brief Reset last updated timestamp + */ + void resetLastUpdated(); + +private: + /** + * @brief Removes any stale observations from the buffer list + */ + void purgeStaleObservations(); + + tf2_ros::Buffer& tf2_buffer_; + const ros::Duration observation_keep_time_; + const ros::Duration expected_update_rate_; + ros::Time last_updated_; + std::string global_frame_; + std::string sensor_frame_; + std::list observation_list_; + std::string topic_name_; + double min_obstacle_height_, max_obstacle_height_; + boost::recursive_mutex lock_; ///< @brief A lock for accessing data in callbacks safely + double obstacle_range_, raytrace_range_; + double tf_tolerance_; +}; +} // namespace costmap_2d +#endif // COSTMAP_2D_OBSERVATION_BUFFER_H_ diff --git a/include/costmap_2d/static_layer.h b/include/costmap_2d/static_layer.h new file mode 100644 index 0000000..893431d --- /dev/null +++ b/include/costmap_2d/static_layer.h @@ -0,0 +1,101 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + * David V. Lu!! + *********************************************************************/ +#ifndef COSTMAP_2D_STATIC_LAYER_H_ +#define COSTMAP_2D_STATIC_LAYER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace costmap_2d +{ + +class StaticLayer : public CostmapLayer +{ +public: + StaticLayer(); + virtual ~StaticLayer(); + virtual void onInitialize(); + virtual void activate(); + virtual void deactivate(); + virtual void reset(); + + virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y, + double* max_x, double* max_y); + virtual void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j); + + virtual void matchSize(); +protected: + virtual unsigned char interpretValue(unsigned char value); + virtual void incomingMap(const nav_msgs::OccupancyGridConstPtr& new_map); + virtual void incomingUpdate(const map_msgs::OccupancyGridUpdateConstPtr& update); + unsigned char* threshold_; + std::string base_frame_id_; + std::string global_frame_; ///< @brief The global frame for the costmap + std::string map_frame_; /// @brief frame that map is located in + std::string map_topic_; // Hiep thêm vào mục đich phân biết zones + bool subscribe_to_updates_; + bool map_received_; + bool has_updated_data_; + unsigned int x_, y_, width_, height_; + bool track_unknown_space_; + bool use_maximum_; + bool first_map_only_; ///< @brief Store the first static map and reuse it on reinitializing + bool trinary_costmap_; + ros::Subscriber map_sub_, map_update_sub_; + unsigned char lethal_threshold_, unknown_cost_value_; + +private: + /** + * @brief Callback to update the costmap's map from the map_server + * @param new_map The map to put into the costmap. The origin of the new + * map along with its size will determine what parts of the costmap's + * static map are overwritten. + */ + void reconfigureCB(costmap_2d::GenericPluginConfig &config, uint32_t level); + dynamic_reconfigure::Server *dsrv_; +}; + +} // namespace costmap_2d + +#endif // COSTMAP_2D_STATIC_LAYER_H_ diff --git a/plugins/critical_layer.cpp b/plugins/critical_layer.cpp new file mode 100644 index 0000000..d695165 --- /dev/null +++ b/plugins/critical_layer.cpp @@ -0,0 +1,38 @@ +#include +#include +#include "shared.h" + +PLUGINLIB_EXPORT_CLASS(costmap_2d::CriticalLayer, costmap_2d::Layer) + +using costmap_2d::NO_INFORMATION; +using costmap_2d::LETHAL_OBSTACLE; +using costmap_2d::CRITICAL_SPACE; + +namespace costmap_2d +{ + +CriticalLayer::CriticalLayer(){} +CriticalLayer::~CriticalLayer(){} + +unsigned char CriticalLayer::interpretValue(unsigned char value) +{ + // check if the static value is above the unknown or lethal thresholds + if(value >= *this->threshold_) + return CRITICAL_SPACE; + else + return NO_INFORMATION; +} + +void CriticalLayer::updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) +{ + if (!map_received_) + return; + + // if not rolling, the layered costmap (master_grid) has same coordinates as this layer + if (!use_maximum_) + updateWithOverwrite(master_grid, min_i, min_j, max_i, max_j); + else + updateWithMax(master_grid, min_i, min_j, max_i, max_j); + +} +} \ No newline at end of file diff --git a/plugins/directional_layer.cpp b/plugins/directional_layer.cpp new file mode 100644 index 0000000..be4bd40 --- /dev/null +++ b/plugins/directional_layer.cpp @@ -0,0 +1,412 @@ +#include +#include +#include +#include +#include +#include + +PLUGINLIB_EXPORT_CLASS(costmap_2d::DirectionalLayer, costmap_2d::Layer) + +#define MAP_IDX(sx, i, j) ((sx) * (j) + (i)) + +using costmap_2d::CRITICAL_SPACE; +using costmap_2d::LETHAL_OBSTACLE; +using costmap_2d::NO_INFORMATION; + +namespace costmap_2d +{ + DirectionalLayer::DirectionalLayer() + { + ros::NodeHandle nh("~/" + name_); + lane_mask_pub_ = nh.advertise("/direction_zones/lanes", 1); + } + DirectionalLayer::~DirectionalLayer() {} + + bool DirectionalLayer::laneFilter(const std::vector plan) + { + if (directional_areas_.empty()) + throw "Has no map data"; + nav_msgs::Path path; + path.header.stamp = ros::Time::now(); + path.header.frame_id = map_frame_; + path.poses = plan; + return this->laneFilter(directional_areas_, path); + } + + void DirectionalLayer::incomingMap(const nav_msgs::OccupancyGridConstPtr &new_map) + { + unsigned int size_x = new_map->info.width, size_y = new_map->info.height; + + ROS_DEBUG("Received a %d X %d map at %f m/pix", size_x / 2, size_y / 2, new_map->info.resolution); + + // resize costmap if size, resolution or origin do not match + Costmap2D *master = layered_costmap_->getCostmap(); + if (!layered_costmap_->isRolling() && + (master->getSizeInCellsX() != size_x / 2 || + master->getSizeInCellsY() != size_y / 2 || + master->getResolution() != new_map->info.resolution || + master->getOriginX() != new_map->info.origin.position.x || + master->getOriginY() != new_map->info.origin.position.y)) + { + // Update the size of the layered costmap (and all layers, including this one) + ROS_INFO("Resizing costmap to %d X %d at %f m/pix", size_x / 2, size_y / 2, new_map->info.resolution); + layered_costmap_->resizeMap(size_x / 2, size_y / 2, new_map->info.resolution, new_map->info.origin.position.x, + new_map->info.origin.position.y, + true /* set size_locked to true, prevents reconfigureCb from overriding map size*/); + } + else if (size_x_ != size_x / 2 || size_y_ != size_y / 2 || + resolution_ != new_map->info.resolution || + origin_x_ != new_map->info.origin.position.x || + origin_y_ != new_map->info.origin.position.y) + { + // only update the size of the costmap stored locally in this layer + ROS_INFO("Resizing static layer to %d X %d at %f m/pix", size_x / 2, size_y / 2, new_map->info.resolution); + resizeMap(size_x / 2, size_y / 2, new_map->info.resolution, + new_map->info.origin.position.x, new_map->info.origin.position.y); + } + unsigned char values[4]; + directional_areas_.clear(); + directional_areas_.resize(size_x / 2 * size_y / 2); + // initialize the costmap with static data + for (unsigned int iy = 0; iy < size_y; iy += 2) + { + for (unsigned int ix = 0; ix < size_x; ix += 2) + { + values[0] = new_map->data[MAP_IDX(size_x, ix, iy)]; + values[1] = new_map->data[MAP_IDX(size_x, ix + 1, iy)]; + values[2] = new_map->data[MAP_IDX(size_x, ix, iy + 1)]; + values[3] = new_map->data[MAP_IDX(size_x, ix + 1, iy + 1)]; + uint32_t color_avg = (uint32_t)(values[0] | values[1] << 8u | values[2] << 16u | values[3] << 24u); + int index = getIndex(ix / 2, iy / 2); + directional_areas_[index][0] = (uint16_t)(color_avg & 0xfff); + directional_areas_[index][1] = (uint16_t)(color_avg >> 12u); + costmap_[index] = costmap_2d::NO_INFORMATION; + } + } + map_frame_ = new_map->header.frame_id; + + // we have a new map, update full size of map + x_ = y_ = 0; + width_ = size_x_; + height_ = size_y_; + map_received_ = true; + has_updated_data_ = true; + + new_map_.header = new_map->header; + new_map_.header.stamp = ros::Time::now(); + new_map_.info = new_map->info; + new_map_.info.width = width_; + new_map_.info.height = height_; + + // shutdown the map subscrber if firt_map_only_ flag is on + if (first_map_only_) + { + ROS_INFO("Shutting down the map subscriber. first_map_only flag is on"); + map_sub_.shutdown(); + } + } + + bool DirectionalLayer::laneFilter(std::vector> new_map, const nav_msgs::Path path) + { + boost::unique_lock lock(*layered_costmap_->getCostmap()->getMutex()); + if (new_map.empty()) + return false; + + std::vector> X_List, Y_List; + std::vector Yaw_list; + + const geometry_msgs::PoseStamped &e = path.poses.back(); + + bool get_success = getRobotPose(pose_x_, pose_y_, pose_yaw_); + if(!get_success) return false; + for (auto it = path.poses.begin(); it != path.poses.end(); ++it) + { + const geometry_msgs::PoseStamped &p = *it; // Get the pose from the iterator + unsigned int mx, my; + if (!worldToMap(p.pose.position.x, p.pose.position.y, mx, my)) + { + ROS_ERROR("ERROR: trying to set a start cell %f %f that is outside of map\n", p.pose.position.x, p.pose.position.y); + return false; + } + // Convert to yaw + tf::Quaternion quaternion; + tf::quaternionMsgToTF(p.pose.orientation, quaternion); + double theta = tf::getYaw(quaternion); + unsigned char value = laneFilter(mx, my, theta); + if (get_success) + { + if ( + (!inSkipErea(pose_x_, pose_y_, p.pose.position.x, p.pose.position.y, distance_skip_) & + !inSkipErea(p.pose.position.x, p.pose.position.y, e.pose.position.x, e.pose.position.y, distance_skip_)) + || p == path.poses.back() + ) + { + if (value == costmap_2d::INSCRIBED_INFLATED_OBSTACLE || value == costmap_2d::LETHAL_OBSTACLE) + { + std::pair x_val(mx, p.pose.position.x); + std::pair y_val(my, p.pose.position.y); + X_List.push_back(x_val); + Y_List.push_back(y_val); + Yaw_list.push_back(theta); + // costmap_[getIndex(mx, my)] = value; + } + } + } + } + if (!Yaw_list.empty()) + { + laneFilter(X_List, Y_List, Yaw_list); + nav_msgs::OccupancyGrid lanes; + convertToMap(costmap_, lanes, 0.65, 0.196); + lane_mask_pub_.publish(lanes); + return false; + } + return true; + + } + + void DirectionalLayer::convertToMap(unsigned char *costmap, nav_msgs::OccupancyGrid &dir_map, double occ_th, double free_th) + { + dir_map.header = new_map_.header; + dir_map.header.stamp = ros::Time::now(); + dir_map.info = new_map_.info; + int size_costmap = new_map_.info.width * new_map_.info.height; + dir_map.data.resize(size_costmap); + for (int i = 0; i < size_costmap; i++) + { + int8_t value; + if (costmap[i] == costmap_2d::NO_INFORMATION) + { + value = -1; + } + else + { + double occ = (costmap[i]) / 255.0; + if (occ > occ_th) + value = +100; + else if (occ < free_th) + value = 0; + else + { + double ratio = (occ - free_th) / (occ_th - free_th); + value = 1 + 98 * ratio; + } + } + dir_map.data[i] = value; + } + } + + unsigned char DirectionalLayer::laneFilter(unsigned int x, unsigned int y, double yaw_robot) + { + double yaw_lane; + unsigned char cost = costmap_2d::NO_INFORMATION; + + int index = getIndex(x, y); + for (auto &lane : directional_areas_[index]) + { + if (lane > 359) + { + cost = std::min(cost, costmap_2d::NO_INFORMATION); + } + else + { + double yaw_lane = (double)lane / 180 * M_PI; + if (0.4 <= cos(yaw_robot - yaw_lane) && cos(yaw_robot - yaw_lane) <= 1.0) + cost = std::min(cost, costmap_2d::FREE_SPACE); + else if (-1.0 <= cos(yaw_robot - yaw_lane) && cos(yaw_robot - yaw_lane) <= -0.4) + cost = std::min(cost, costmap_2d::LETHAL_OBSTACLE); + else + cost = std::min(cost, costmap_2d::NO_INFORMATION); + } + } + return cost; + } + + void DirectionalLayer::laneFilter(std::vector> x, + std::vector> y, + std::vector yaw_robot) + { + if(x.empty() || y.empty() || yaw_robot.empty()) + return; + + unsigned int x_min, y_min, x_max, y_max; + double x_min_w, y_min_w, x_max_w, y_max_w; + + x_min = x.front().first; y_min = y.front().first; + x_max = x.front().first; y_max = y.front().first; + x_min_w = x.front().second; y_min_w = y.front().second; + x_max_w = x.front().second; y_max_w = y.front().second; + for (int i = 1; i < yaw_robot.size(); i++) + { + if(inSkipErea(pose_x_, pose_y_, x[i].second, y[i].second, distance_skip_)) + continue; + x_min = std::min(x_min, x[i].first); + y_min = std::min(y_min, y[i].first); + x_max = std::max(x_max, x[i].first); + y_max = std::max(y_max, y[i].first); + + x_min_w = std::min(x_min_w, x[i].second); + y_min_w = std::min(y_min_w, y[i].second); + x_max_w = std::max(x_max_w, x[i].second); + y_max_w = std::max(y_max_w, y[i].second); + + } + // ROS_INFO("%d %d %d %d", x_min, y_min, x_max, y_max); + // ROS_INFO("%f %f %f %f", x_min_w, y_min_w, x_max_w, y_max_w); + for (int i = 0; i < yaw_robot.size(); i++) + { + if(inSkipErea(pose_x_, pose_y_, x[i].second, y[i].second, distance_skip_)) + continue; + + double yaw_rad = (double)yaw_robot[i] / 180 * M_PI; + if (fabs(cos(yaw_rad)) > fabs(sin(yaw_rad))) + { + int x_ = x[i].first; + // Dưới lên trên + for (int j = y[i].first; j <= y_max; j++) + { + int y_ = j; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + // Trên xuống dưới + for (int k = y[i].first; k >= y_min; k--) + { + int y_ = k; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + + int y_ = y[i].first; + // Phải qua trái + for (int j = x[i].first; j < layered_costmap_->getCostmap()->getSizeInCellsX(); j++) + { + int x_ = j; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + // Trái qua phải + for (int k = x[i].first; k >= 0; k--) + { + int x_ = k; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + } + else if(fabs(cos(yaw_rad)) < fabs(sin(yaw_rad))) + { + int y_ = y[i].first; + // Phải qua trái + for (int j = x[i].first; j <= x_max; j++) + { + int x_ = j; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + // Trái qua phải + for (int k = x[i].first; k >= x_min; k--) + { + int x_ = k; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + + int x_ = x[i].first; + // Dưới lên trên + for (int j = y[i].first; j < layered_costmap_->getCostmap()->getSizeInCellsY(); j++) + { + int y_ = j; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + // Trên xuống dưới + for (int k = y[i].first; k >= 0; k--) + { + int y_ = k; + if (costmap_[getIndex(x_, y_)] == costmap_2d::LETHAL_OBSTACLE) + continue; + unsigned char value = laneFilter(x_, y_, yaw_robot[i]); + if (value >= costmap_2d::INSCRIBED_INFLATED_OBSTACLE && value != costmap_2d::NO_INFORMATION) + costmap_[getIndex(x_, y_)] = value; + else + break; + } + } + } + } + + void DirectionalLayer::resetMap() + { + unsigned int size_x = layered_costmap_->getCostmap()->getSizeInCellsX(); + unsigned int size_y = layered_costmap_->getCostmap()->getSizeInCellsY(); + for (unsigned int iy = 0; iy < size_y; iy++) + { + for (unsigned int ix = 0; ix < size_x; ix++) + { + int index = getIndex(ix, iy); + costmap_[index] = costmap_2d::NO_INFORMATION; + } + } + } + + bool DirectionalLayer::getRobotPose(double &x, double &y, double &yaw) + { + tf::StampedTransform transform; + try + { + listener_.lookupTransform(map_frame_, base_frame_id_, ros::Time(0), transform); + } + catch (tf::TransformException &ex) + { + ROS_ERROR("%s", ex.what()); + return false; + } + x = transform.getOrigin().x(); + y = transform.getOrigin().y(); + // Extract the rotation as a quaternion from the transform + tf::Quaternion rotation = transform.getRotation(); + // Convert the quaternion to a yaw angle (in radians) + yaw = tf::getYaw(rotation); + return true; + } + + bool DirectionalLayer::inSkipErea(double start_x, double start_y, double end_x, double end_y, double skip_distance) + { + return fabs(hypot(start_x - end_x, start_y - end_y)) <= skip_distance; + } +} \ No newline at end of file diff --git a/plugins/inflation_layer.cpp b/plugins/inflation_layer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/plugins/obstacle_layer.cpp b/plugins/obstacle_layer.cpp new file mode 100644 index 0000000..1f713a3 --- /dev/null +++ b/plugins/obstacle_layer.cpp @@ -0,0 +1,623 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + * David V. Lu!! + *********************************************************************/ +#include +#include +#include + +#include +#include + +PLUGINLIB_EXPORT_CLASS(costmap_2d::ObstacleLayer, costmap_2d::Layer) + +using costmap_2d::NO_INFORMATION; +using costmap_2d::LETHAL_OBSTACLE; +using costmap_2d::FREE_SPACE; + +using costmap_2d::ObservationBuffer; +using costmap_2d::Observation; + +namespace costmap_2d +{ + +void ObstacleLayer::onInitialize() +{ + ros::NodeHandle nh("~/" + name_), g_nh; + rolling_window_ = layered_costmap_->isRolling(); + + bool track_unknown_space; + nh.param("track_unknown_space", track_unknown_space, layered_costmap_->isTrackingUnknown()); + if (track_unknown_space) + default_value_ = NO_INFORMATION; + else + default_value_ = FREE_SPACE; + + ObstacleLayer::matchSize(); + current_ = true; + + global_frame_ = layered_costmap_->getGlobalFrameID(); + double transform_tolerance; + nh.param("transform_tolerance", transform_tolerance, 0.2); + + std::string topics_string; + // get the topics that we'll subscribe to from the parameter server + nh.param("observation_sources", topics_string, std::string("")); + ROS_INFO(" Subscribed to Topics: %s", topics_string.c_str()); + + // now we need to split the topics based on whitespace which we can use a stringstream for + std::stringstream ss(topics_string); + + std::string source; + while (ss >> source) + { + ros::NodeHandle source_node(nh, source); + + // get the parameters for the specific topic + double observation_keep_time, expected_update_rate, min_obstacle_height, max_obstacle_height; + std::string topic, sensor_frame, data_type; + bool inf_is_valid, clearing, marking; + + source_node.param("topic", topic, source); + source_node.param("sensor_frame", sensor_frame, std::string("")); + source_node.param("observation_persistence", observation_keep_time, 0.0); + source_node.param("expected_update_rate", expected_update_rate, 0.0); + source_node.param("data_type", data_type, std::string("PointCloud")); + source_node.param("min_obstacle_height", min_obstacle_height, 0.0); + source_node.param("max_obstacle_height", max_obstacle_height, 2.0); + source_node.param("inf_is_valid", inf_is_valid, false); + source_node.param("clearing", clearing, false); + source_node.param("marking", marking, true); + + if (!(data_type == "PointCloud2" || data_type == "PointCloud" || data_type == "LaserScan")) + { + ROS_FATAL("Only topics that use point clouds or laser scans are currently supported"); + throw std::runtime_error("Only topics that use point clouds or laser scans are currently supported"); + } + + std::string raytrace_range_param_name, obstacle_range_param_name; + + // get the obstacle range for the sensor + double obstacle_range = 2.5; + if (source_node.searchParam("obstacle_range", obstacle_range_param_name)) + { + source_node.getParam(obstacle_range_param_name, obstacle_range); + } + + // get the raytrace range for the sensor + double raytrace_range = 3.0; + if (source_node.searchParam("raytrace_range", raytrace_range_param_name)) + { + source_node.getParam(raytrace_range_param_name, raytrace_range); + } + + ROS_DEBUG("Creating an observation buffer for source %s, topic %s, frame %s", source.c_str(), topic.c_str(), + sensor_frame.c_str()); + + // create an observation buffer + observation_buffers_.push_back( + boost::shared_ptr < ObservationBuffer + > (new ObservationBuffer(topic, observation_keep_time, expected_update_rate, min_obstacle_height, + max_obstacle_height, obstacle_range, raytrace_range, *tf_, global_frame_, + sensor_frame, transform_tolerance))); + + // check if we'll add this buffer to our marking observation buffers + if (marking) + marking_buffers_.push_back(observation_buffers_.back()); + + // check if we'll also add this buffer to our clearing observation buffers + if (clearing) + clearing_buffers_.push_back(observation_buffers_.back()); + + ROS_DEBUG( + "Created an observation buffer for source %s, topic %s, global frame: %s, " + "expected update rate: %.2f, observation persistence: %.2f", + source.c_str(), topic.c_str(), global_frame_.c_str(), expected_update_rate, observation_keep_time); + + // create a callback for the topic + if (data_type == "LaserScan") + { + boost::shared_ptr < message_filters::Subscriber + > sub(new message_filters::Subscriber(g_nh, topic, 50)); + + boost::shared_ptr > filter( + new tf2_ros::MessageFilter(*sub, *tf_, global_frame_, 50, g_nh)); + + if (inf_is_valid) + { + filter->registerCallback([this,buffer=observation_buffers_.back()](auto& msg){ laserScanValidInfCallback(msg, buffer); }); + } + else + { + filter->registerCallback([this,buffer=observation_buffers_.back()](auto& msg){ laserScanCallback(msg, buffer); }); + } + + observation_subscribers_.push_back(sub); + observation_notifiers_.push_back(filter); + + observation_notifiers_.back()->setTolerance(ros::Duration(0.05)); + } + else if (data_type == "PointCloud") + { + boost::shared_ptr < message_filters::Subscriber + > sub(new message_filters::Subscriber(g_nh, topic, 50)); + + if (inf_is_valid) + { + ROS_WARN("obstacle_layer: inf_is_valid option is not applicable to PointCloud observations."); + } + + boost::shared_ptr < tf2_ros::MessageFilter + > filter(new tf2_ros::MessageFilter(*sub, *tf_, global_frame_, 50, g_nh)); + filter->registerCallback([this,buffer=observation_buffers_.back()](auto& msg){ pointCloudCallback(msg, buffer); }); + + observation_subscribers_.push_back(sub); + observation_notifiers_.push_back(filter); + } + else + { + boost::shared_ptr < message_filters::Subscriber + > sub(new message_filters::Subscriber(g_nh, topic, 50)); + + if (inf_is_valid) + { + ROS_WARN("obstacle_layer: inf_is_valid option is not applicable to PointCloud observations."); + } + + boost::shared_ptr < tf2_ros::MessageFilter + > filter(new tf2_ros::MessageFilter(*sub, *tf_, global_frame_, 50, g_nh)); + filter->registerCallback([this,buffer=observation_buffers_.back()](auto& msg){ pointCloud2Callback(msg, buffer); }); + + observation_subscribers_.push_back(sub); + observation_notifiers_.push_back(filter); + } + + if (sensor_frame != "") + { + std::vector < std::string > target_frames; + target_frames.push_back(global_frame_); + target_frames.push_back(sensor_frame); + observation_notifiers_.back()->setTargetFrames(target_frames); + } + } + + dsrv_ = NULL; + setupDynamicReconfigure(nh); +} + +void ObstacleLayer::setupDynamicReconfigure(ros::NodeHandle& nh) +{ + dsrv_ = new dynamic_reconfigure::Server(nh); + dynamic_reconfigure::Server::CallbackType cb = + [this](auto& config, auto level){ reconfigureCB(config, level); }; + dsrv_->setCallback(cb); +} + +ObstacleLayer::~ObstacleLayer() +{ + if (dsrv_) + delete dsrv_; +} +void ObstacleLayer::reconfigureCB(costmap_2d::ObstaclePluginConfig &config, uint32_t level) +{ + enabled_ = config.enabled; + footprint_clearing_enabled_ = config.footprint_clearing_enabled; + max_obstacle_height_ = config.max_obstacle_height; + combination_method_ = config.combination_method; +} + +void ObstacleLayer::laserScanCallback(const sensor_msgs::LaserScanConstPtr& message, + const boost::shared_ptr& buffer) +{ + // project the laser into a point cloud + sensor_msgs::PointCloud2 cloud; + cloud.header = message->header; + + // project the scan into a point cloud + try + { + projector_.transformLaserScanToPointCloud(message->header.frame_id, *message, cloud, *tf_); + } + catch (tf2::TransformException &ex) + { + ROS_WARN("High fidelity enabled, but TF returned a transform exception to frame %s: %s", global_frame_.c_str(), + ex.what()); + projector_.projectLaser(*message, cloud); + } + catch (std::runtime_error &ex) + { + ROS_WARN("transformLaserScanToPointCloud error, it seems the message from laser sensor is malformed. Ignore this laser scan. what(): %s", ex.what()); + return; //ignore this message + } + + // buffer the point cloud + buffer->lock(); + buffer->bufferCloud(cloud); + buffer->unlock(); +} + +void ObstacleLayer::laserScanValidInfCallback(const sensor_msgs::LaserScanConstPtr& raw_message, + const boost::shared_ptr& buffer) +{ + // Filter positive infinities ("Inf"s) to max_range. + float epsilon = 0.0001; // a tenth of a millimeter + sensor_msgs::LaserScan message = *raw_message; + for (size_t i = 0; i < message.ranges.size(); i++) + { + float range = message.ranges[ i ]; + if (!std::isfinite(range) && range > 0) + { + message.ranges[ i ] = message.range_max - epsilon; + } + } + + // project the laser into a point cloud + sensor_msgs::PointCloud2 cloud; + cloud.header = message.header; + + // project the scan into a point cloud + try + { + projector_.transformLaserScanToPointCloud(message.header.frame_id, message, cloud, *tf_); + } + catch (tf2::TransformException &ex) + { + ROS_WARN("High fidelity enabled, but TF returned a transform exception to frame %s: %s", + global_frame_.c_str(), ex.what()); + projector_.projectLaser(message, cloud); + } + catch (std::runtime_error &ex) + { + ROS_WARN("transformLaserScanToPointCloud error, it seems the message from laser sensor is malformed. Ignore this laser scan. what(): %s", ex.what()); + return; //ignore this message + } + + // buffer the point cloud + buffer->lock(); + buffer->bufferCloud(cloud); + buffer->unlock(); +} + +void ObstacleLayer::pointCloudCallback(const sensor_msgs::PointCloudConstPtr& message, + const boost::shared_ptr& buffer) +{ + sensor_msgs::PointCloud2 cloud2; + + if (!sensor_msgs::convertPointCloudToPointCloud2(*message, cloud2)) + { + ROS_ERROR("Failed to convert a PointCloud to a PointCloud2, dropping message"); + return; + } + + // buffer the point cloud + buffer->lock(); + buffer->bufferCloud(cloud2); + buffer->unlock(); +} + +void ObstacleLayer::pointCloud2Callback(const sensor_msgs::PointCloud2ConstPtr& message, + const boost::shared_ptr& buffer) +{ + // buffer the point cloud + buffer->lock(); + buffer->bufferCloud(*message); + buffer->unlock(); +} + +void ObstacleLayer::updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, + double* min_y, double* max_x, double* max_y) +{ + if (rolling_window_) + updateOrigin(robot_x - getSizeInMetersX() / 2, robot_y - getSizeInMetersY() / 2); + useExtraBounds(min_x, min_y, max_x, max_y); + + bool current = true; + std::vector observations, clearing_observations; + + // get the marking observations + current = current && getMarkingObservations(observations); + + // get the clearing observations + current = current && getClearingObservations(clearing_observations); + + // update the global current status + current_ = current; + + // raytrace freespace + for (unsigned int i = 0; i < clearing_observations.size(); ++i) + { + raytraceFreespace(clearing_observations[i], min_x, min_y, max_x, max_y); + } + + // place the new obstacles into a priority queue... each with a priority of zero to begin with + for (std::vector::const_iterator it = observations.begin(); it != observations.end(); ++it) + { + const Observation& obs = *it; + + const sensor_msgs::PointCloud2& cloud = *(obs.cloud_); + + double sq_obstacle_range = obs.obstacle_range_ * obs.obstacle_range_; + + sensor_msgs::PointCloud2ConstIterator iter_x(cloud, "x"); + sensor_msgs::PointCloud2ConstIterator iter_y(cloud, "y"); + sensor_msgs::PointCloud2ConstIterator iter_z(cloud, "z"); + + for (; iter_x !=iter_x.end(); ++iter_x, ++iter_y, ++iter_z) + { + double px = *iter_x, py = *iter_y, pz = *iter_z; + + // if the obstacle is too high or too far away from the robot we won't add it + if (pz > max_obstacle_height_) + { + ROS_DEBUG("The point is too high"); + continue; + } + + // compute the squared distance from the hitpoint to the pointcloud's origin + double sq_dist = (px - obs.origin_.x) * (px - obs.origin_.x) + (py - obs.origin_.y) * (py - obs.origin_.y) + + (pz - obs.origin_.z) * (pz - obs.origin_.z); + + // if the point is far enough away... we won't consider it + if (sq_dist >= sq_obstacle_range) + { + ROS_DEBUG("The point is too far away"); + continue; + } + + // now we need to compute the map coordinates for the observation + unsigned int mx, my; + if (!worldToMap(px, py, mx, my)) + { + ROS_DEBUG("Computing map coords failed"); + continue; + } + + unsigned int index = getIndex(mx, my); + costmap_[index] = LETHAL_OBSTACLE; + touch(px, py, min_x, min_y, max_x, max_y); + } + } + + updateFootprint(robot_x, robot_y, robot_yaw, min_x, min_y, max_x, max_y); +} + +void ObstacleLayer::updateFootprint(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y, + double* max_x, double* max_y) +{ + if (!footprint_clearing_enabled_) return; + transformFootprint(robot_x, robot_y, robot_yaw, getFootprint(), transformed_footprint_); + + for (unsigned int i = 0; i < transformed_footprint_.size(); i++) + { + touch(transformed_footprint_[i].x, transformed_footprint_[i].y, min_x, min_y, max_x, max_y); + } +} + +void ObstacleLayer::updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) +{ + if (footprint_clearing_enabled_) + { + setConvexPolygonCost(transformed_footprint_, costmap_2d::FREE_SPACE); + } + + switch (combination_method_) + { + case 0: // Overwrite + updateWithOverwrite(master_grid, min_i, min_j, max_i, max_j); + break; + case 1: // Maximum + updateWithMax(master_grid, min_i, min_j, max_i, max_j); + break; + default: // Nothing + break; + } + +} + +void ObstacleLayer::addStaticObservation(costmap_2d::Observation& obs, bool marking, bool clearing) +{ + if (marking) + static_marking_observations_.push_back(obs); + if (clearing) + static_clearing_observations_.push_back(obs); +} + +void ObstacleLayer::clearStaticObservations(bool marking, bool clearing) +{ + if (marking) + static_marking_observations_.clear(); + if (clearing) + static_clearing_observations_.clear(); +} + +bool ObstacleLayer::getMarkingObservations(std::vector& marking_observations) const +{ + bool current = true; + // get the marking observations + for (unsigned int i = 0; i < marking_buffers_.size(); ++i) + { + marking_buffers_[i]->lock(); + marking_buffers_[i]->getObservations(marking_observations); + current = marking_buffers_[i]->isCurrent() && current; + marking_buffers_[i]->unlock(); + } + marking_observations.insert(marking_observations.end(), + static_marking_observations_.begin(), static_marking_observations_.end()); + return current; +} + +bool ObstacleLayer::getClearingObservations(std::vector& clearing_observations) const +{ + bool current = true; + // get the clearing observations + for (unsigned int i = 0; i < clearing_buffers_.size(); ++i) + { + clearing_buffers_[i]->lock(); + clearing_buffers_[i]->getObservations(clearing_observations); + current = clearing_buffers_[i]->isCurrent() && current; + clearing_buffers_[i]->unlock(); + } + clearing_observations.insert(clearing_observations.end(), + static_clearing_observations_.begin(), static_clearing_observations_.end()); + return current; +} + +void ObstacleLayer::raytraceFreespace(const Observation& clearing_observation, double* min_x, double* min_y, + double* max_x, double* max_y) +{ + double ox = clearing_observation.origin_.x; + double oy = clearing_observation.origin_.y; + const sensor_msgs::PointCloud2 &cloud = *(clearing_observation.cloud_); + + // get the map coordinates of the origin of the sensor + unsigned int x0, y0; + if (!worldToMap(ox, oy, x0, y0)) + { + ROS_WARN_THROTTLE( + 1.0, "The origin for the sensor at (%.2f, %.2f) is out of map bounds. So, the costmap cannot raytrace for it.", + ox, oy); + return; + } + + // we can pre-compute the enpoints of the map outside of the inner loop... we'll need these later + double origin_x = origin_x_, origin_y = origin_y_; + double map_end_x = origin_x + size_x_ * resolution_; + double map_end_y = origin_y + size_y_ * resolution_; + + + touch(ox, oy, min_x, min_y, max_x, max_y); + + // for each point in the cloud, we want to trace a line from the origin and clear obstacles along it + sensor_msgs::PointCloud2ConstIterator iter_x(cloud, "x"); + sensor_msgs::PointCloud2ConstIterator iter_y(cloud, "y"); + + for (; iter_x != iter_x.end(); ++iter_x, ++iter_y) + { + double wx = *iter_x; + double wy = *iter_y; + + // now we also need to make sure that the enpoint we're raytracing + // to isn't off the costmap and scale if necessary + double a = wx - ox; + double b = wy - oy; + + // the minimum value to raytrace from is the origin + if (wx < origin_x) + { + double t = (origin_x - ox) / a; + wx = origin_x; + wy = oy + b * t; + } + if (wy < origin_y) + { + double t = (origin_y - oy) / b; + wx = ox + a * t; + wy = origin_y; + } + + // the maximum value to raytrace to is the end of the map + if (wx > map_end_x) + { + double t = (map_end_x - ox) / a; + wx = map_end_x - .001; + wy = oy + b * t; + } + if (wy > map_end_y) + { + double t = (map_end_y - oy) / b; + wx = ox + a * t; + wy = map_end_y - .001; + } + + // now that the vector is scaled correctly... we'll get the map coordinates of its endpoint + unsigned int x1, y1; + + // check for legality just in case + if (!worldToMap(wx, wy, x1, y1)) + continue; + + unsigned int cell_raytrace_range = cellDistance(clearing_observation.raytrace_range_); + MarkCell marker(costmap_, FREE_SPACE); + // and finally... we can execute our trace to clear obstacles along that line + raytraceLine(marker, x0, y0, x1, y1, cell_raytrace_range); + + updateRaytraceBounds(ox, oy, wx, wy, clearing_observation.raytrace_range_, min_x, min_y, max_x, max_y); + } +} + +void ObstacleLayer::activate() +{ + // if we're stopped we need to re-subscribe to topics + for (unsigned int i = 0; i < observation_subscribers_.size(); ++i) + { + if (observation_subscribers_[i] != NULL) + observation_subscribers_[i]->subscribe(); + } + + for (unsigned int i = 0; i < observation_buffers_.size(); ++i) + { + if (observation_buffers_[i]) + observation_buffers_[i]->resetLastUpdated(); + } +} +void ObstacleLayer::deactivate() +{ + for (unsigned int i = 0; i < observation_subscribers_.size(); ++i) + { + if (observation_subscribers_[i] != NULL) + observation_subscribers_[i]->unsubscribe(); + } +} + +void ObstacleLayer::updateRaytraceBounds(double ox, double oy, double wx, double wy, double range, + double* min_x, double* min_y, double* max_x, double* max_y) +{ + double dx = wx-ox, dy = wy-oy; + double full_distance = hypot(dx, dy); + double scale = std::min(1.0, range / full_distance); + double ex = ox + dx * scale, ey = oy + dy * scale; + touch(ex, ey, min_x, min_y, max_x, max_y); +} + +void ObstacleLayer::reset() +{ + deactivate(); + resetMaps(); + current_ = true; + activate(); +} + +} // namespace costmap_2d diff --git a/plugins/preferred_layer.cpp b/plugins/preferred_layer.cpp new file mode 100644 index 0000000..fbe128f --- /dev/null +++ b/plugins/preferred_layer.cpp @@ -0,0 +1,28 @@ +#include +#include + +PLUGINLIB_EXPORT_CLASS(costmap_2d::PreferredLayer, costmap_2d::Layer) + +using costmap_2d::NO_INFORMATION; +using costmap_2d::FREE_SPACE; +using costmap_2d::LETHAL_OBSTACLE; +using costmap_2d::PREFERRED_SPACE; + +namespace costmap_2d +{ + +PreferredLayer::PreferredLayer(){} +PreferredLayer::~PreferredLayer(){} + +unsigned char PreferredLayer::interpretValue(unsigned char value) +{ + // check if the static value is above the unknown or lethal thresholds + if(value == 0) return NO_INFORMATION; + else if (value >= *this->threshold_) + return PREFERRED_SPACE; + + double scale = (double) value / *this->threshold_; + return scale * LETHAL_OBSTACLE; +} + +} \ No newline at end of file diff --git a/plugins/static_layer.cpp b/plugins/static_layer.cpp new file mode 100644 index 0000000..2b633dd --- /dev/null +++ b/plugins/static_layer.cpp @@ -0,0 +1,351 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * Copyright (c) 2015, Fetch Robotics, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + * David V. Lu!! + *********************************************************************/ +#include +#include +#include +#include +#include + +PLUGINLIB_EXPORT_CLASS(costmap_2d::StaticLayer, costmap_2d::Layer) + +using costmap_2d::NO_INFORMATION; +using costmap_2d::LETHAL_OBSTACLE; +using costmap_2d::FREE_SPACE; + +namespace costmap_2d +{ + +StaticLayer::StaticLayer() : dsrv_(NULL) +{ + threshold_ = &lethal_threshold_; +} + +StaticLayer::~StaticLayer() +{ + if (dsrv_) + delete dsrv_; +} + +void StaticLayer::onInitialize() +{ + ros::NodeHandle nh("~/" + name_), g_nh; + current_ = true; + + global_frame_ = layered_costmap_->getGlobalFrameID(); + nh.param("map_topic", map_topic_, std::string("map")); + nh.param("first_map_only", first_map_only_, false); + nh.param("subscribe_to_updates", subscribe_to_updates_, false); + + nh.param("track_unknown_space", track_unknown_space_, true); + nh.param("use_maximum", use_maximum_, false); + + int temp_lethal_threshold, temp_unknown_cost_value; + nh.param("lethal_cost_threshold", temp_lethal_threshold, int(100)); + nh.param("unknown_cost_value", temp_unknown_cost_value, int(-1)); + nh.param("trinary_costmap", trinary_costmap_, true); + nh.param("base_frame_id", base_frame_id_, std::string("base_footprint")); + + // ROS_WARN("global_frame_[%s] map_frame_[%s] map_topic[%s] first_map_only[%d] subscribe_to_updates[%d] track_unknown_space[%d] use_maximum[%d] \n lethal_cost_threshold[%d] unknown_cost_value[%d] trinary_costmap[%d]", + // global_frame_.c_str(), map_frame_.c_str(),map_topic_.c_str(), first_map_only_, subscribe_to_updates_, track_unknown_space_, use_maximum_, temp_lethal_threshold, temp_unknown_cost_value, trinary_costmap_); + lethal_threshold_ = std::max(std::min(temp_lethal_threshold, 100), 0); + unknown_cost_value_ = temp_unknown_cost_value; + + // Only resubscribe if topic has changed + if (map_sub_.getTopic() != ros::names::resolve(map_topic_)) + { + // we'll subscribe to the latched topic that the map server uses + ROS_INFO("Requesting the map..."); + map_sub_ = g_nh.subscribe(map_topic_, 1, &StaticLayer::incomingMap, this); + map_received_ = false; + has_updated_data_ = false; + + ros::Rate r(10); + while (!map_received_ && g_nh.ok()) + { + ros::spinOnce(); + r.sleep(); + } + + ROS_INFO("Received a %d X %d map at %f m/pix", getSizeInCellsX(), getSizeInCellsY(), getResolution()); + + if (subscribe_to_updates_) + { + ROS_INFO("Subscribing to updates"); + map_update_sub_ = g_nh.subscribe(map_topic_ + "_updates", 10, &StaticLayer::incomingUpdate, this); + } + } + else + { + has_updated_data_ = true; + } + + if (dsrv_) + { + delete dsrv_; + } + + dsrv_ = new dynamic_reconfigure::Server(nh); + dynamic_reconfigure::Server::CallbackType cb = + [this](auto& config, auto level){ reconfigureCB(config, level); }; + dsrv_->setCallback(cb); +} + +void StaticLayer::reconfigureCB(costmap_2d::GenericPluginConfig &config, uint32_t level) +{ + if (config.enabled != enabled_) + { + enabled_ = config.enabled; + has_updated_data_ = true; + x_ = y_ = 0; + width_ = size_x_; + height_ = size_y_; + } +} + +void StaticLayer::matchSize() +{ + // If we are using rolling costmap, the static map size is + // unrelated to the size of the layered costmap + if (!layered_costmap_->isRolling()) + { + Costmap2D* master = layered_costmap_->getCostmap(); + resizeMap(master->getSizeInCellsX(), master->getSizeInCellsY(), master->getResolution(), + master->getOriginX(), master->getOriginY()); + } +} + +unsigned char StaticLayer::interpretValue(unsigned char value) +{ + // check if the static value is above the unknown or lethal thresholds + if (track_unknown_space_ && value == unknown_cost_value_) + return NO_INFORMATION; + else if (!track_unknown_space_ && value == unknown_cost_value_) + return FREE_SPACE; + else if (value >= lethal_threshold_) + return LETHAL_OBSTACLE; + else if (trinary_costmap_) + return FREE_SPACE; + + double scale = (double) value / lethal_threshold_; + return scale * LETHAL_OBSTACLE; +} + +void StaticLayer::incomingMap(const nav_msgs::OccupancyGridConstPtr& new_map) +{ + unsigned int size_x = new_map->info.width, size_y = new_map->info.height; + + ROS_DEBUG("Received a %d X %d map at %f m/pix", size_x, size_y, new_map->info.resolution); + + // resize costmap if size, resolution or origin do not match + Costmap2D* master = layered_costmap_->getCostmap(); + if (!layered_costmap_->isRolling() && + (master->getSizeInCellsX() != size_x || + master->getSizeInCellsY() != size_y || + master->getResolution() != new_map->info.resolution || + master->getOriginX() != new_map->info.origin.position.x || + master->getOriginY() != new_map->info.origin.position.y)) + { + // Update the size of the layered costmap (and all layers, including this one) + ROS_INFO("Resizing costmap to %d X %d at %f m/pix", size_x, size_y, new_map->info.resolution); + layered_costmap_->resizeMap(size_x, size_y, new_map->info.resolution, new_map->info.origin.position.x, + new_map->info.origin.position.y, + true /* set size_locked to true, prevents reconfigureCb from overriding map size*/); + } + else if (size_x_ != size_x || size_y_ != size_y || + resolution_ != new_map->info.resolution || + origin_x_ != new_map->info.origin.position.x || + origin_y_ != new_map->info.origin.position.y) + { + // only update the size of the costmap stored locally in this layer + ROS_INFO("Resizing static layer to %d X %d at %f m/pix", size_x, size_y, new_map->info.resolution); + resizeMap(size_x, size_y, new_map->info.resolution, + new_map->info.origin.position.x, new_map->info.origin.position.y); + } + + unsigned int index = 0; + + // initialize the costmap with static data + for (unsigned int i = 0; i < size_y; ++i) + { + for (unsigned int j = 0; j < size_x; ++j) + { + unsigned char value = new_map->data[index]; + costmap_[index] = interpretValue(value); + ++index; + } + } + map_frame_ = new_map->header.frame_id; + + // we have a new map, update full size of map + x_ = y_ = 0; + width_ = size_x_; + height_ = size_y_; + map_received_ = true; + has_updated_data_ = true; + + // shutdown the map subscrber if firt_map_only_ flag is on + if (first_map_only_) + { + ROS_INFO("Shutting down the map subscriber. first_map_only flag is on"); + map_sub_.shutdown(); + } +} + +void StaticLayer::incomingUpdate(const map_msgs::OccupancyGridUpdateConstPtr& update) +{ + unsigned int di = 0; + for (unsigned int y = 0; y < update->height ; y++) + { + unsigned int index_base = (update->y + y) * size_x_; + for (unsigned int x = 0; x < update->width ; x++) + { + unsigned int index = index_base + x + update->x; + costmap_[index] = interpretValue(update->data[di++]); + } + } + x_ = update->x; + y_ = update->y; + width_ = update->width; + height_ = update->height; + has_updated_data_ = true; +} + +void StaticLayer::activate() +{ + onInitialize(); +} + +void StaticLayer::deactivate() +{ + map_sub_.shutdown(); + if (subscribe_to_updates_) + map_update_sub_.shutdown(); +} + +void StaticLayer::reset() +{ + if (first_map_only_) + { + has_updated_data_ = true; + } + else + { + onInitialize(); + } +} + +void StaticLayer::updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y, + double* max_x, double* max_y) +{ + + if( !layered_costmap_->isRolling() ){ + if (!map_received_ || !(has_updated_data_ || has_extra_bounds_)) + return; + } + + useExtraBounds(min_x, min_y, max_x, max_y); + + double wx, wy; + + mapToWorld(x_, y_, wx, wy); + *min_x = std::min(wx, *min_x); + *min_y = std::min(wy, *min_y); + + mapToWorld(x_ + width_, y_ + height_, wx, wy); + *max_x = std::max(wx, *max_x); + *max_y = std::max(wy, *max_y); + + has_updated_data_ = false; +} + +void StaticLayer::updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) +{ + if (!map_received_) + return; + + if (!layered_costmap_->isRolling()) + { + // if not rolling, the layered costmap (master_grid) has same coordinates as this layer + if (!use_maximum_) + updateWithOverwrite(master_grid, min_i, min_j, max_i, max_j); + else + updateWithMax(master_grid, min_i, min_j, max_i, max_j); + } + else + { + // If rolling window, the master_grid is unlikely to have same coordinates as this layer + unsigned int mx, my; + double wx, wy; + // Might even be in a different frame + geometry_msgs::TransformStamped transform; + try + { + transform = tf_->lookupTransform(map_frame_, global_frame_, ros::Time(0)); + } + catch (tf2::TransformException ex) + { + ROS_ERROR("%s", ex.what()); + return; + } + // Copy map data given proper transformations + tf2::Transform tf2_transform; + tf2::convert(transform.transform, tf2_transform); + for (unsigned int i = min_i; i < max_i; ++i) + { + for (unsigned int j = min_j; j < max_j; ++j) + { + // Convert master_grid coordinates (i,j) into global_frame_(wx,wy) coordinates + layered_costmap_->getCostmap()->mapToWorld(i, j, wx, wy); + // Transform from global_frame_ to map_frame_ + tf2::Vector3 p(wx, wy, 0); + p = tf2_transform*p; + // Set master_grid with cell from map + if (worldToMap(p.x(), p.y(), mx, my)) + { + if (!use_maximum_) + master_grid.setCost(i, j, getCost(mx, my)); + else + master_grid.setCost(i, j, std::max(getCost(mx, my), master_grid.getCost(i, j))); + } + } + } + } +} + +} // namespace costmap_2d diff --git a/plugins/unpreferred_layer.cpp b/plugins/unpreferred_layer.cpp new file mode 100644 index 0000000..d6237f2 --- /dev/null +++ b/plugins/unpreferred_layer.cpp @@ -0,0 +1,27 @@ +#include +#include + +PLUGINLIB_EXPORT_CLASS(costmap_2d::UnPreferredLayer, costmap_2d::Layer) + +using costmap_2d::NO_INFORMATION; +using costmap_2d::LETHAL_OBSTACLE; +using costmap_2d::PREFERRED_SPACE; + +namespace costmap_2d +{ + +UnPreferredLayer::UnPreferredLayer(){} +UnPreferredLayer::~UnPreferredLayer(){} + +unsigned char UnPreferredLayer::interpretValue(unsigned char value) +{ + // check if the static value is above the unknown or lethal thresholds + if(value == 0) return NO_INFORMATION; + else if (value >= *this->threshold_) + return UNPREFERRED_SPACE; + + double scale = (double) value / *this->threshold_; + return scale * LETHAL_OBSTACLE; +} + +} \ No newline at end of file diff --git a/plugins/voxel_layer.cpp b/plugins/voxel_layer.cpp new file mode 100644 index 0000000..9927ddd --- /dev/null +++ b/plugins/voxel_layer.cpp @@ -0,0 +1,449 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + * David V. Lu!! + *********************************************************************/ +#include +#include +#include + +#define VOXEL_BITS 16 +PLUGINLIB_EXPORT_CLASS(costmap_2d::VoxelLayer, costmap_2d::Layer) + +using costmap_2d::NO_INFORMATION; +using costmap_2d::LETHAL_OBSTACLE; +using costmap_2d::FREE_SPACE; + +using costmap_2d::ObservationBuffer; +using costmap_2d::Observation; + +namespace costmap_2d +{ + +void VoxelLayer::onInitialize() +{ + ObstacleLayer::onInitialize(); + ros::NodeHandle private_nh("~/" + name_); + + private_nh.param("publish_voxel_map", publish_voxel_, false); + if (publish_voxel_) + voxel_pub_ = private_nh.advertise < costmap_2d::VoxelGrid > ("voxel_grid", 1); + + clearing_endpoints_pub_ = private_nh.advertise("clearing_endpoints", 1); +} + +void VoxelLayer::setupDynamicReconfigure(ros::NodeHandle& nh) +{ + voxel_dsrv_ = new dynamic_reconfigure::Server(nh); + dynamic_reconfigure::Server::CallbackType cb = + [this](auto& config, auto level){ reconfigureCB(config, level); }; + voxel_dsrv_->setCallback(cb); +} + +VoxelLayer::~VoxelLayer() +{ + if (voxel_dsrv_) + delete voxel_dsrv_; +} + +void VoxelLayer::reconfigureCB(costmap_2d::VoxelPluginConfig &config, uint32_t level) +{ + enabled_ = config.enabled; + footprint_clearing_enabled_ = config.footprint_clearing_enabled; + max_obstacle_height_ = config.max_obstacle_height; + size_z_ = config.z_voxels; + origin_z_ = config.origin_z; + z_resolution_ = config.z_resolution; + unknown_threshold_ = config.unknown_threshold + (VOXEL_BITS - size_z_); + mark_threshold_ = config.mark_threshold; + combination_method_ = config.combination_method; + matchSize(); +} + +void VoxelLayer::matchSize() +{ + ObstacleLayer::matchSize(); + voxel_grid_.resize(size_x_, size_y_, size_z_); + ROS_ASSERT(voxel_grid_.sizeX() == size_x_ && voxel_grid_.sizeY() == size_y_); +} + +void VoxelLayer::reset() +{ + deactivate(); + resetMaps(); + voxel_grid_.reset(); + activate(); +} + +void VoxelLayer::resetMaps() +{ + Costmap2D::resetMaps(); + voxel_grid_.reset(); +} + +void VoxelLayer::updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, + double* min_y, double* max_x, double* max_y) +{ + if (rolling_window_) + updateOrigin(robot_x - getSizeInMetersX() / 2, robot_y - getSizeInMetersY() / 2); + useExtraBounds(min_x, min_y, max_x, max_y); + + bool current = true; + std::vector observations, clearing_observations; + + // get the marking observations + current = getMarkingObservations(observations) && current; + + // get the clearing observations + current = getClearingObservations(clearing_observations) && current; + + // update the global current status + current_ = current; + + // raytrace freespace + for (unsigned int i = 0; i < clearing_observations.size(); ++i) + { + raytraceFreespace(clearing_observations[i], min_x, min_y, max_x, max_y); + } + + // place the new obstacles into a priority queue... each with a priority of zero to begin with + for (std::vector::const_iterator it = observations.begin(); it != observations.end(); ++it) + { + const Observation& obs = *it; + + const sensor_msgs::PointCloud2& cloud = *(obs.cloud_); + + double sq_obstacle_range = obs.obstacle_range_ * obs.obstacle_range_; + + sensor_msgs::PointCloud2ConstIterator iter_x(cloud, "x"); + sensor_msgs::PointCloud2ConstIterator iter_y(cloud, "y"); + sensor_msgs::PointCloud2ConstIterator iter_z(cloud, "z"); + + for (unsigned int i = 0; iter_x != iter_x.end(); ++iter_x, ++iter_y, ++iter_z) + { + // if the obstacle is too high or too far away from the robot we won't add it + if (*iter_z > max_obstacle_height_) + continue; + + // compute the squared distance from the hitpoint to the pointcloud's origin + double sq_dist = (*iter_x - obs.origin_.x) * (*iter_x - obs.origin_.x) + + (*iter_y - obs.origin_.y) * (*iter_y - obs.origin_.y) + + (*iter_z - obs.origin_.z) * (*iter_z - obs.origin_.z); + + // if the point is far enough away... we won't consider it + if (sq_dist >= sq_obstacle_range) + continue; + + // now we need to compute the map coordinates for the observation + unsigned int mx, my, mz; + if (*iter_z < origin_z_) + { + if (!worldToMap3D(*iter_x, *iter_y, origin_z_, mx, my, mz)) + continue; + } + else if (!worldToMap3D(*iter_x, *iter_y, *iter_z, mx, my, mz)) + { + continue; + } + + // mark the cell in the voxel grid and check if we should also mark it in the costmap + if (voxel_grid_.markVoxelInMap(mx, my, mz, mark_threshold_)) + { + unsigned int index = getIndex(mx, my); + + costmap_[index] = LETHAL_OBSTACLE; + touch(double(*iter_x), double(*iter_y), min_x, min_y, max_x, max_y); + } + } + } + + if (publish_voxel_) + { + costmap_2d::VoxelGrid grid_msg; + unsigned int size = voxel_grid_.sizeX() * voxel_grid_.sizeY(); + grid_msg.size_x = voxel_grid_.sizeX(); + grid_msg.size_y = voxel_grid_.sizeY(); + grid_msg.size_z = voxel_grid_.sizeZ(); + grid_msg.data.resize(size); + memcpy(&grid_msg.data[0], voxel_grid_.getData(), size * sizeof(unsigned int)); + + grid_msg.origin.x = origin_x_; + grid_msg.origin.y = origin_y_; + grid_msg.origin.z = origin_z_; + + grid_msg.resolutions.x = resolution_; + grid_msg.resolutions.y = resolution_; + grid_msg.resolutions.z = z_resolution_; + grid_msg.header.frame_id = global_frame_; + grid_msg.header.stamp = ros::Time::now(); + voxel_pub_.publish(grid_msg); + } + + updateFootprint(robot_x, robot_y, robot_yaw, min_x, min_y, max_x, max_y); +} + +void VoxelLayer::clearNonLethal(double wx, double wy, double w_size_x, double w_size_y, bool clear_no_info) +{ + // get the cell coordinates of the center point of the window + unsigned int mx, my; + if (!worldToMap(wx, wy, mx, my)) + return; + + // compute the bounds of the window + double start_x = wx - w_size_x / 2; + double start_y = wy - w_size_y / 2; + double end_x = start_x + w_size_x; + double end_y = start_y + w_size_y; + + // scale the window based on the bounds of the costmap + start_x = std::max(origin_x_, start_x); + start_y = std::max(origin_y_, start_y); + + end_x = std::min(origin_x_ + getSizeInMetersX(), end_x); + end_y = std::min(origin_y_ + getSizeInMetersY(), end_y); + + // get the map coordinates of the bounds of the window + unsigned int map_sx, map_sy, map_ex, map_ey; + + // check for legality just in case + if (!worldToMap(start_x, start_y, map_sx, map_sy) || !worldToMap(end_x, end_y, map_ex, map_ey)) + return; + + // we know that we want to clear all non-lethal obstacles in this window to get it ready for inflation + unsigned int index = getIndex(map_sx, map_sy); + unsigned char* current = &costmap_[index]; + for (unsigned int j = map_sy; j <= map_ey; ++j) + { + for (unsigned int i = map_sx; i <= map_ex; ++i) + { + // if the cell is a lethal obstacle... we'll keep it and queue it, otherwise... we'll clear it + if (*current != LETHAL_OBSTACLE) + { + if (clear_no_info || *current != NO_INFORMATION) + { + *current = FREE_SPACE; + voxel_grid_.clearVoxelColumn(index); + } + } + current++; + index++; + } + current += size_x_ - (map_ex - map_sx) - 1; + index += size_x_ - (map_ex - map_sx) - 1; + } +} + +void VoxelLayer::raytraceFreespace(const Observation& clearing_observation, double* min_x, double* min_y, + double* max_x, double* max_y) +{ + size_t clearing_observation_cloud_size = clearing_observation.cloud_->height * clearing_observation.cloud_->width; + if (clearing_observation_cloud_size == 0) + return; + + double sensor_x, sensor_y, sensor_z; + double ox = clearing_observation.origin_.x; + double oy = clearing_observation.origin_.y; + double oz = clearing_observation.origin_.z; + + if (!worldToMap3DFloat(ox, oy, oz, sensor_x, sensor_y, sensor_z)) + { + ROS_WARN_THROTTLE( + 1.0, + "The origin for the sensor at (%.2f, %.2f, %.2f) is out of map bounds. So, the costmap cannot raytrace for it.", + ox, oy, oz); + return; + } + + bool publish_clearing_points = (clearing_endpoints_pub_.getNumSubscribers() > 0); + if (publish_clearing_points) + { + clearing_endpoints_.points.clear(); + clearing_endpoints_.points.reserve(clearing_observation_cloud_size); + } + + // we can pre-compute the enpoints of the map outside of the inner loop... we'll need these later + double map_end_x = origin_x_ + getSizeInMetersX(); + double map_end_y = origin_y_ + getSizeInMetersY(); + + sensor_msgs::PointCloud2ConstIterator iter_x(*(clearing_observation.cloud_), "x"); + sensor_msgs::PointCloud2ConstIterator iter_y(*(clearing_observation.cloud_), "y"); + sensor_msgs::PointCloud2ConstIterator iter_z(*(clearing_observation.cloud_), "z"); + + for (;iter_x != iter_x.end(); ++iter_x, ++iter_y, ++iter_z) + { + double wpx = *iter_x; + double wpy = *iter_y; + double wpz = *iter_z; + + double distance = dist(ox, oy, oz, wpx, wpy, wpz); + double scaling_fact = 1.0; + scaling_fact = std::max(std::min(scaling_fact, (distance - 2 * resolution_) / distance), 0.0); + wpx = scaling_fact * (wpx - ox) + ox; + wpy = scaling_fact * (wpy - oy) + oy; + wpz = scaling_fact * (wpz - oz) + oz; + + double a = wpx - ox; + double b = wpy - oy; + double c = wpz - oz; + double t = 1.0; + + // we can only raytrace to a maximum z height + if (wpz > max_obstacle_height_) + { + // we know we want the vector's z value to be max_z + t = std::max(0.0, std::min(t, (max_obstacle_height_ - 0.01 - oz) / c)); + } + // and we can only raytrace down to the floor + else if (wpz < origin_z_) + { + // we know we want the vector's z value to be 0.0 + t = std::min(t, (origin_z_ - oz) / c); + } + + // the minimum value to raytrace from is the origin + if (wpx < origin_x_) + { + t = std::min(t, (origin_x_ - ox) / a); + } + if (wpy < origin_y_) + { + t = std::min(t, (origin_y_ - oy) / b); + } + + // the maximum value to raytrace to is the end of the map + if (wpx > map_end_x) + { + t = std::min(t, (map_end_x - ox) / a); + } + if (wpy > map_end_y) + { + t = std::min(t, (map_end_y - oy) / b); + } + + wpx = ox + a * t; + wpy = oy + b * t; + wpz = oz + c * t; + + double point_x, point_y, point_z; + if (worldToMap3DFloat(wpx, wpy, wpz, point_x, point_y, point_z)) + { + unsigned int cell_raytrace_range = cellDistance(clearing_observation.raytrace_range_); + + // voxel_grid_.markVoxelLine(sensor_x, sensor_y, sensor_z, point_x, point_y, point_z); + voxel_grid_.clearVoxelLineInMap(sensor_x, sensor_y, sensor_z, point_x, point_y, point_z, costmap_, + unknown_threshold_, mark_threshold_, FREE_SPACE, NO_INFORMATION, + cell_raytrace_range); + + updateRaytraceBounds(ox, oy, wpx, wpy, clearing_observation.raytrace_range_, min_x, min_y, max_x, max_y); + + if (publish_clearing_points) + { + geometry_msgs::Point32 point; + point.x = wpx; + point.y = wpy; + point.z = wpz; + clearing_endpoints_.points.push_back(point); + } + } + } + + if (publish_clearing_points) + { + clearing_endpoints_.header.frame_id = global_frame_; + clearing_endpoints_.header.stamp = clearing_observation.cloud_->header.stamp; + clearing_endpoints_.header.seq = clearing_observation.cloud_->header.seq; + + clearing_endpoints_pub_.publish(clearing_endpoints_); + } +} + +void VoxelLayer::updateOrigin(double new_origin_x, double new_origin_y) +{ + // project the new origin into the grid + int cell_ox, cell_oy; + cell_ox = int((new_origin_x - origin_x_) / resolution_); + cell_oy = int((new_origin_y - origin_y_) / resolution_); + + // compute the associated world coordinates for the origin cell + // beacuase we want to keep things grid-aligned + double new_grid_ox, new_grid_oy; + new_grid_ox = origin_x_ + cell_ox * resolution_; + new_grid_oy = origin_y_ + cell_oy * resolution_; + + // To save casting from unsigned int to int a bunch of times + int size_x = size_x_; + int size_y = size_y_; + + // we need to compute the overlap of the new and existing windows + int lower_left_x, lower_left_y, upper_right_x, upper_right_y; + lower_left_x = std::min(std::max(cell_ox, 0), size_x); + lower_left_y = std::min(std::max(cell_oy, 0), size_y); + upper_right_x = std::min(std::max(cell_ox + size_x, 0), size_x); + upper_right_y = std::min(std::max(cell_oy + size_y, 0), size_y); + + unsigned int cell_size_x = upper_right_x - lower_left_x; + unsigned int cell_size_y = upper_right_y - lower_left_y; + + // we need a map to store the obstacles in the window temporarily + unsigned char* local_map = new unsigned char[cell_size_x * cell_size_y]; + unsigned int* local_voxel_map = new unsigned int[cell_size_x * cell_size_y]; + unsigned int* voxel_map = voxel_grid_.getData(); + + // copy the local window in the costmap to the local map + copyMapRegion(costmap_, lower_left_x, lower_left_y, size_x_, local_map, 0, 0, cell_size_x, cell_size_x, cell_size_y); + copyMapRegion(voxel_map, lower_left_x, lower_left_y, size_x_, local_voxel_map, 0, 0, cell_size_x, cell_size_x, + cell_size_y); + + // we'll reset our maps to unknown space if appropriate + resetMaps(); + + // update the origin with the appropriate world coordinates + origin_x_ = new_grid_ox; + origin_y_ = new_grid_oy; + + // compute the starting cell location for copying data back in + int start_x = lower_left_x - cell_ox; + int start_y = lower_left_y - cell_oy; + + // now we want to copy the overlapping information back into the map, but in its new location + copyMapRegion(local_map, 0, 0, cell_size_x, costmap_, start_x, start_y, size_x_, cell_size_x, cell_size_y); + copyMapRegion(local_voxel_map, 0, 0, cell_size_x, voxel_map, start_x, start_y, size_x_, cell_size_x, cell_size_y); + + // make sure to clean up + delete[] local_map; + delete[] local_voxel_map; +} + +} // namespace costmap_2d diff --git a/src/array_parser.cpp b/src/array_parser.cpp new file mode 100644 index 0000000..144a860 --- /dev/null +++ b/src/array_parser.cpp @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2012, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * author: Dave Hershberger + */ + +#include // for EOF +#include +#include +#include + +namespace costmap_2d +{ + +/** @brief Parse a vector of vector of floats from a string. + * @param input + * @param error_return + * Syntax is [[1.0, 2.0], [3.3, 4.4, 5.5], ...] */ +std::vector > parseVVF(const std::string& input, std::string& error_return) +{ + std::vector > result; + + std::stringstream input_ss(input); + int depth = 0; + std::vector current_vector; + while (!!input_ss && !input_ss.eof()) + { + switch (input_ss.peek()) + { + case EOF: + break; + case '[': + depth++; + if (depth > 2) + { + error_return = "Array depth greater than 2"; + return result; + } + input_ss.get(); + current_vector.clear(); + break; + case ']': + depth--; + if (depth < 0) + { + error_return = "More close ] than open ["; + return result; + } + input_ss.get(); + if (depth == 1) + { + result.push_back(current_vector); + } + break; + case ',': + case ' ': + case '\t': + input_ss.get(); + break; + default: // All other characters should be part of the numbers. + if (depth != 2) + { + std::stringstream err_ss; + err_ss << "Numbers at depth other than 2. Char was '" << char(input_ss.peek()) << "'."; + error_return = err_ss.str(); + return result; + } + float value; + input_ss >> value; + if (!!input_ss) + { + current_vector.push_back(value); + } + break; + } + } + + if (depth != 0) + { + error_return = "Unterminated vector string."; + } + else + { + error_return = ""; + } + + return result; +} + +} // end namespace costmap_2d diff --git a/src/costmap_2d.cpp b/src/costmap_2d.cpp index ac646a3..3212208 100644 --- a/src/costmap_2d.cpp +++ b/src/costmap_2d.cpp @@ -1,71 +1,445 @@ -#include -#include +/********************************************************************* + * License & Authors + * - Cung cấp lớp Costmap2D để lưu trữ bản đồ chi phí 2D + *********************************************************************/ + +#include // Header định nghĩa lớp Costmap2D +#include // Dùng cho thao tác file (fopen, fprintf, ...) using namespace std; namespace costmap_2d { - Costmap2D::Costmap2D(unsigned int cells_size_x, unsigned int cells_size_y, double resolution, - double origin_x, double origin_y, unsigned char default_value) : + +/***************************************************** + * Hàm khởi tạo chính của Costmap2D + * - Tạo bản đồ kích thước size_x × size_y + * - Gán độ phân giải, gốc tọa độ, và giá trị mặc định + *****************************************************/ +Costmap2D::Costmap2D(unsigned int cells_size_x, unsigned int cells_size_y, double resolution, + double origin_x, double origin_y, unsigned char default_value) : size_x_(cells_size_x), size_y_(cells_size_y), resolution_(resolution), origin_x_(origin_x), origin_y_(origin_y), costmap_(NULL), default_value_(default_value) - { - access_ = new mutex_t(); +{ + access_ = new mutex_t(); // Khóa bảo vệ truy cập đa luồng - // create the costmap - initMaps(size_x_, size_y_); - resetMaps(); + // Cấp phát vùng nhớ cho bản đồ + initMaps(size_x_, size_y_); + + // Gán toàn bộ bản đồ bằng giá trị mặc định (ví dụ: NO_INFORMATION) + resetMaps(); +} + +/***************************************************** + * Xóa bộ nhớ costmap_ + *****************************************************/ +void Costmap2D::deleteMaps() +{ + boost::unique_lock lock(*access_); // Giữ mutex để đảm bảo thread-safe + delete[] costmap_; // Giải phóng vùng nhớ + costmap_ = NULL; +} + +/***************************************************** + * Cấp phát vùng nhớ cho costmap_ + *****************************************************/ +void Costmap2D::initMaps(unsigned int size_x, unsigned int size_y) +{ + boost::unique_lock lock(*access_); + delete[] costmap_; // Xóa vùng nhớ cũ nếu có + costmap_ = new unsigned char[size_x * size_y]; // Mỗi ô lưu 1 byte (0–255) +} + +/***************************************************** + * Thay đổi kích thước bản đồ + * - Thường dùng khi tạo lại bản đồ mới hoặc khi map động + *****************************************************/ +void Costmap2D::resizeMap(unsigned int size_x, unsigned int size_y, double resolution, + double origin_x, double origin_y) +{ + size_x_ = size_x; + size_y_ = size_y; + resolution_ = resolution; + origin_x_ = origin_x; + origin_y_ = origin_y; + + initMaps(size_x, size_y); // Cấp phát vùng nhớ mới + resetMaps(); // Reset toàn bộ dữ liệu +} + +/***************************************************** + * Reset toàn bộ bản đồ về giá trị mặc định + *****************************************************/ +void Costmap2D::resetMaps() +{ + boost::unique_lock lock(*access_); + memset(costmap_, default_value_, size_x_ * size_y_ * sizeof(unsigned char)); +} + +/***************************************************** + * Reset một vùng con trong costmap + *****************************************************/ +void Costmap2D::resetMap(unsigned int x0, unsigned int y0, unsigned int xn, unsigned int yn) +{ + boost::unique_lock lock(*(access_)); + unsigned int len = xn - x0; + for (unsigned int y = y0 * size_x_ + x0; y < yn * size_x_ + x0; y += size_x_) + memset(costmap_ + y, default_value_, len * sizeof(unsigned char)); +} + +/***************************************************** + * Tạo bản đồ mới chỉ bao gồm 1 cửa sổ (window) con của map hiện tại + *****************************************************/ +bool Costmap2D::copyCostmapWindow(const Costmap2D& map, double win_origin_x, double win_origin_y, + double win_size_x, double win_size_y) +{ + // Không thể tạo window của chính mình + if (this == &map) + return false; + + deleteMaps(); // Xóa dữ liệu cũ + + // Chuyển đổi tọa độ thế giới sang tọa độ lưới + unsigned int lower_left_x, lower_left_y, upper_right_x, upper_right_y; + if (!map.worldToMap(win_origin_x, win_origin_y, lower_left_x, lower_left_y) + || !map.worldToMap(win_origin_x + win_size_x, win_origin_y + win_size_y, upper_right_x, upper_right_y)) + return false; + + // Tính kích thước vùng con + size_x_ = upper_right_x - lower_left_x; + size_y_ = upper_right_y - lower_left_y; + resolution_ = map.resolution_; + origin_x_ = win_origin_x; + origin_y_ = win_origin_y; + + initMaps(size_x_, size_y_); // Cấp phát bộ nhớ mới + + // Sao chép dữ liệu vùng con từ bản đồ gốc + copyMapRegion(map.costmap_, lower_left_x, lower_left_y, map.size_x_, + costmap_, 0, 0, size_x_, size_x_, size_y_); + return true; +} + +/***************************************************** + * Toán tử gán (=): sao chép toàn bộ dữ liệu từ map khác + *****************************************************/ +Costmap2D& Costmap2D::operator=(const Costmap2D& map) +{ + if (this == &map) + return *this; + + deleteMaps(); // Xóa map cũ + + size_x_ = map.size_x_; + size_y_ = map.size_y_; + resolution_ = map.resolution_; + origin_x_ = map.origin_x_; + origin_y_ = map.origin_y_; + + initMaps(size_x_, size_y_); // Tạo map mới + memcpy(costmap_, map.costmap_, size_x_ * size_y_ * sizeof(unsigned char)); // Sao chép dữ liệu + + return *this; +} + +/***************************************************** + * Constructor sao chép + *****************************************************/ +Costmap2D::Costmap2D(const Costmap2D& map) : costmap_(NULL) +{ + access_ = new mutex_t(); + *this = map; // Gọi lại toán tử gán +} + +/***************************************************** + * Constructor mặc định (chưa có bản đồ) + *****************************************************/ +Costmap2D::Costmap2D() : + size_x_(0), size_y_(0), resolution_(0.0), + origin_x_(0.0), origin_y_(0.0), costmap_(NULL) +{ + access_ = new mutex_t(); +} + +/***************************************************** + * Destructor: giải phóng bộ nhớ + *****************************************************/ +Costmap2D::~Costmap2D() +{ + deleteMaps(); + delete access_; +} + +/***************************************************** + * Chuyển khoảng cách thực (mét) sang đơn vị ô + *****************************************************/ +unsigned int Costmap2D::cellDistance(double world_dist) +{ + double cells_dist = max(0.0, ceil(world_dist / resolution_)); + return (unsigned int)cells_dist; +} + +/***************************************************** + * Trả về con trỏ dữ liệu costmap + *****************************************************/ +unsigned char* Costmap2D::getCharMap() const +{ + return costmap_; +} + +/***************************************************** + * Lấy giá trị cost tại ô (mx, my) + *****************************************************/ +unsigned char Costmap2D::getCost(unsigned int mx, unsigned int my) const +{ + return costmap_[getIndex(mx, my)]; +} + +/***************************************************** + * Gán giá trị cost tại ô (mx, my) + *****************************************************/ +void Costmap2D::setCost(unsigned int mx, unsigned int my, unsigned char cost) +{ + costmap_[getIndex(mx, my)] = cost; +} + +/***************************************************** + * Chuyển từ tọa độ lưới (ô) sang tọa độ thế giới + *****************************************************/ +void Costmap2D::mapToWorld(unsigned int mx, unsigned int my, double& wx, double& wy) const +{ + wx = origin_x_ + (mx + 0.5) * resolution_; + wy = origin_y_ + (my + 0.5) * resolution_; +} + +/***************************************************** + * Chuyển từ tọa độ thế giới sang tọa độ lưới + *****************************************************/ +bool Costmap2D::worldToMap(double wx, double wy, unsigned int& mx, unsigned int& my) const +{ + if (wx < origin_x_ || wy < origin_y_) + return false; + + mx = (int)((wx - origin_x_) / resolution_); + my = (int)((wy - origin_y_) / resolution_); + + return (mx < size_x_ && my < size_y_); +} + +/***************************************************** + * Phiên bản không kiểm tra biên (có thể ra ngoài map) + *****************************************************/ +void Costmap2D::worldToMapNoBounds(double wx, double wy, int& mx, int& my) const +{ + mx = (int)((wx - origin_x_) / resolution_); + my = (int)((wy - origin_y_) / resolution_); +} + +/***************************************************** + * Phiên bản ép buộc tọa độ nằm trong biên bản đồ + *****************************************************/ +void Costmap2D::worldToMapEnforceBounds(double wx, double wy, int& mx, int& my) const +{ + if (wx < origin_x_) + mx = 0; + else if (wx >= resolution_ * size_x_ + origin_x_) + mx = size_x_ - 1; + else + mx = (int)((wx - origin_x_) / resolution_); + + if (wy < origin_y_) + my = 0; + else if (wy >= resolution_ * size_y_ + origin_y_) + my = size_y_ - 1; + else + my = (int)((wy - origin_y_) / resolution_); +} + +/***************************************************** + * Dịch chuyển gốc của bản đồ khi robot di chuyển + * => Dữ liệu được dịch và giữ lại phần chồng lấn + *****************************************************/ +void Costmap2D::updateOrigin(double new_origin_x, double new_origin_y) +{ + int cell_ox = int((new_origin_x - origin_x_) / resolution_); + int cell_oy = int((new_origin_y - origin_y_) / resolution_); + + if (cell_ox == 0 && cell_oy == 0) + return; + + // Cập nhật lại gốc bản đồ mới (theo bội số của resolution) + double new_grid_ox = origin_x_ + cell_ox * resolution_; + double new_grid_oy = origin_y_ + cell_oy * resolution_; + + int size_x = size_x_; + int size_y = size_y_; + + // Tính vùng chồng lấn giữa bản đồ cũ và bản đồ mới + int lower_left_x = min(max(cell_ox, 0), size_x); + int lower_left_y = min(max(cell_oy, 0), size_y); + int upper_right_x = min(max(cell_ox + size_x, 0), size_x); + int upper_right_y = min(max(cell_oy + size_y, 0), size_y); + + unsigned int cell_size_x = upper_right_x - lower_left_x; + unsigned int cell_size_y = upper_right_y - lower_left_y; + + // Tạo bản đồ tạm để lưu phần chồng lấn + unsigned char* local_map = new unsigned char[cell_size_x * cell_size_y]; + copyMapRegion(costmap_, lower_left_x, lower_left_y, size_x_, + local_map, 0, 0, cell_size_x, cell_size_x, cell_size_y); + + resetMaps(); // Toàn bộ bản đồ được đặt lại giá trị mặc định + + origin_x_ = new_grid_ox; + origin_y_ = new_grid_oy; + + // Copy vùng chồng lấn vào vị trí mới + int start_x = lower_left_x - cell_ox; + int start_y = lower_left_y - cell_oy; + copyMapRegion(local_map, 0, 0, cell_size_x, + costmap_, start_x, start_y, size_x_, cell_size_x, cell_size_y); + + delete[] local_map; // Giải phóng vùng nhớ tạm +} + +/***************************************************** + * Đặt giá trị cost cho vùng đa giác lồi + * (ví dụ: để đánh dấu vùng cấm hoặc vùng obstacle) + *****************************************************/ +bool Costmap2D::setConvexPolygonCost(const std::vector& polygon, unsigned char cost_value) +{ + std::vector map_polygon; + for (unsigned int i = 0; i < polygon.size(); ++i) + { + MapLocation loc; + if (!worldToMap(polygon[i].x, polygon[i].y, loc.x, loc.y)) + return false; // Nếu một điểm nằm ngoài map + map_polygon.push_back(loc); + } + + std::vector polygon_cells; + convexFillCells(map_polygon, polygon_cells); // Lấy toàn bộ ô bên trong đa giác + + for (unsigned int i = 0; i < polygon_cells.size(); ++i) + costmap_[getIndex(polygon_cells[i].x, polygon_cells[i].y)] = cost_value; + + return true; +} + +/***************************************************** + * polygonOutlineCells(): + * - Tìm các ô nằm trên biên của đa giác + *****************************************************/ +void Costmap2D::polygonOutlineCells(const std::vector& polygon, + std::vector& polygon_cells) +{ + PolygonOutlineCells cell_gatherer(*this, costmap_, polygon_cells); + + for (unsigned int i = 0; i < polygon.size() - 1; ++i) + raytraceLine(cell_gatherer, polygon[i].x, polygon[i].y, polygon[i + 1].x, polygon[i + 1].y); + + if (!polygon.empty()) + { + unsigned int last_index = polygon.size() - 1; + // Nối điểm cuối với điểm đầu để khép kín đa giác + raytraceLine(cell_gatherer, polygon[last_index].x, polygon[last_index].y, + polygon[0].x, polygon[0].y); + } +} + +/***************************************************** + * convexFillCells(): + * - Điền đầy các ô bên trong một đa giác lồi + *****************************************************/ +void Costmap2D::convexFillCells(const std::vector& polygon, + std::vector& polygon_cells) +{ + if (polygon.size() < 3) // Ít hơn 3 điểm thì không tạo thành đa giác + return; + + polygonOutlineCells(polygon, polygon_cells); // Lấy biên ngoài + + // Sắp xếp theo trục X để dễ quét cột + MapLocation swap; + unsigned int i = 0; + while (i < polygon_cells.size() - 1) + { + if (polygon_cells[i].x > polygon_cells[i + 1].x) + { + swap = polygon_cells[i]; + polygon_cells[i] = polygon_cells[i + 1]; + polygon_cells[i + 1] = swap; + if (i > 0) --i; + } + else ++i; + } + + // Quét từng cột X để điền đầy Y + i = 0; + MapLocation min_pt, max_pt; + unsigned int min_x = polygon_cells[0].x; + unsigned int max_x = polygon_cells.back().x; + + for (unsigned int x = min_x; x <= max_x; ++x) + { + if (i >= polygon_cells.size() - 1) break; + + if (polygon_cells[i].y < polygon_cells[i + 1].y) + { + min_pt = polygon_cells[i]; + max_pt = polygon_cells[i + 1]; + } + else + { + min_pt = polygon_cells[i + 1]; + max_pt = polygon_cells[i]; } - void Costmap2D::deleteMaps() + i += 2; + while (i < polygon_cells.size() && polygon_cells[i].x == x) { - // clean up data - boost::unique_lock lock(*access_); - delete[] costmap_; - costmap_ = NULL; + if (polygon_cells[i].y < min_pt.y) + min_pt = polygon_cells[i]; + else if (polygon_cells[i].y > max_pt.y) + max_pt = polygon_cells[i]; + ++i; } - void Costmap2D::initMaps(unsigned int size_x, unsigned int size_y) - { - boost::unique_lock lock(*access_); - delete[] costmap_; - costmap_ = new unsigned char[size_x * size_y]; - } + // Điền đầy ô từ min_y đến max_y + for (unsigned int y = min_pt.y; y <= max_pt.y; ++y) + polygon_cells.push_back({x, y}); + } +} - unsigned char Costmap2D::getCost(unsigned int mx, unsigned int my) const - { - return costmap_[getIndex(mx, my)]; - } +/***************************************************** + * Các hàm getter cơ bản + *****************************************************/ +unsigned int Costmap2D::getSizeInCellsX() const { return size_x_; } +unsigned int Costmap2D::getSizeInCellsY() const { return size_y_; } +double Costmap2D::getSizeInMetersX() const { return (size_x_ - 1 + 0.5) * resolution_; } +double Costmap2D::getSizeInMetersY() const { return (size_y_ - 1 + 0.5) * resolution_; } +double Costmap2D::getOriginX() const { return origin_x_; } +double Costmap2D::getOriginY() const { return origin_y_; } +double Costmap2D::getResolution() const { return resolution_; } - void Costmap2D::setCost(unsigned int mx, unsigned int my, unsigned char cost) - { - costmap_[getIndex(mx, my)] = cost; - } +/***************************************************** + * Lưu costmap ra file PGM (grayscale) để debug + *****************************************************/ +bool Costmap2D::saveMap(std::string file_name) +{ + FILE *fp = fopen(file_name.c_str(), "w"); + if (!fp) + return false; - void Costmap2D::mapToWorld(unsigned int mx, unsigned int my, double& wx, double& wy) const - { - wx = origin_x_ + (mx + 0.5) * resolution_; - wy = origin_y_ + (my + 0.5) * resolution_; - } + fprintf(fp, "P2\n%u\n%u\n%u\n", size_x_, size_y_, 0xff); + for (unsigned int iy = 0; iy < size_y_; iy++) + { + for (unsigned int ix = 0; ix < size_x_; ix++) + fprintf(fp, "%d ", getCost(ix, iy)); + fprintf(fp, "\n"); + } + fclose(fp); + return true; +} - bool Costmap2D::worldToMap(double wx, double wy, unsigned int& mx, unsigned int& my) const - { - if (wx < origin_x_ || wy < origin_y_) - return false; - - mx = (int)((wx - origin_x_) / resolution_); - my = (int)((wy - origin_y_) / resolution_); - - if (mx < size_x_ && my < size_y_) - return true; - - return false; - } - - void Costmap2D::worldToMapNoBounds(double wx, double wy, int& mx, int& my) const - { - mx = (int)((wx - origin_x_) / resolution_); - my = (int)((wy - origin_y_) / resolution_); - } - -} \ No newline at end of file +} // namespace costmap_2d diff --git a/src/footprint.cpp b/src/footprint.cpp new file mode 100644 index 0000000..4767c79 --- /dev/null +++ b/src/footprint.cpp @@ -0,0 +1,325 @@ +/* + * Copyright (c) 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include + +namespace costmap_2d +{ + +void calculateMinAndMaxDistances(const std::vector& footprint, double& min_dist, double& max_dist) +{ + min_dist = std::numeric_limits::max(); + max_dist = 0.0; + + if (footprint.size() <= 2) + { + return; + } + + for (unsigned int i = 0; i < footprint.size() - 1; ++i) + { + // check the distance from the robot center point to the first vertex + double vertex_dist = distance(0.0, 0.0, footprint[i].x, footprint[i].y); + double edge_dist = distanceToLine(0.0, 0.0, footprint[i].x, footprint[i].y, + footprint[i + 1].x, footprint[i + 1].y); + min_dist = std::min(min_dist, std::min(vertex_dist, edge_dist)); + max_dist = std::max(max_dist, std::max(vertex_dist, edge_dist)); + } + + // we also need to do the last vertex and the first vertex + double vertex_dist = distance(0.0, 0.0, footprint.back().x, footprint.back().y); + double edge_dist = distanceToLine(0.0, 0.0, footprint.back().x, footprint.back().y, + footprint.front().x, footprint.front().y); + min_dist = std::min(min_dist, std::min(vertex_dist, edge_dist)); + max_dist = std::max(max_dist, std::max(vertex_dist, edge_dist)); +} + +Point32 toPoint32(Point pt) +{ + Point32 point32; + point32.x = pt.x; + point32.y = pt.y; + point32.z = pt.z; + return point32; +} + +Point toPoint(Point32 pt) +{ + Point point; + point.x = pt.x; + point.y = pt.y; + point.z = pt.z; + return point; +} + +Polygon toPolygon(std::vector pts) +{ + Polygon polygon; + for (int i = 0; i < pts.size(); i++){ + polygon.points.push_back(toPoint32(pts[i])); + } + return polygon; +} + +std::vector toPointVector(Polygon polygon) +{ + std::vector pts; + for (int i = 0; i < polygon.points.size(); i++) + { + pts.push_back(toPoint(polygon.points[i])); + } + return pts; +} + +void transformFootprint(double x, double y, double theta, const std::vector& footprint_spec, + std::vector& oriented_footprint) +{ + // build the oriented footprint at a given location + oriented_footprint.clear(); + double cos_th = cos(theta); + double sin_th = sin(theta); + for (unsigned int i = 0; i < footprint_spec.size(); ++i) + { + Point new_pt; + new_pt.x = x + (footprint_spec[i].x * cos_th - footprint_spec[i].y * sin_th); + new_pt.y = y + (footprint_spec[i].x * sin_th + footprint_spec[i].y * cos_th); + oriented_footprint.push_back(new_pt); + } +} + +void transformFootprint(double x, double y, double theta, const std::vector& footprint_spec, + PolygonStamped& oriented_footprint) +{ + // build the oriented footprint at a given location + oriented_footprint.polygon.points.clear(); + double cos_th = cos(theta); + double sin_th = sin(theta); + for (unsigned int i = 0; i < footprint_spec.size(); ++i) + { + Point32 new_pt; + new_pt.x = x + (footprint_spec[i].x * cos_th - footprint_spec[i].y * sin_th); + new_pt.y = y + (footprint_spec[i].x * sin_th + footprint_spec[i].y * cos_th); + oriented_footprint.polygon.points.push_back(new_pt); + } +} + +void padFootprint(std::vector& footprint, double padding) +{ + // pad footprint in place + for (unsigned int i = 0; i < footprint.size(); i++) + { + Point& pt = footprint[ i ]; + pt.x += sign0(pt.x) * padding; + pt.y += sign0(pt.y) * padding; + } +} + + +std::vector makeFootprintFromRadius(double radius) +{ + std::vector points; + + // Loop over 16 angles around a circle making a point each time + int N = 16; + Point pt; + for (int i = 0; i < N; ++i) + { + double angle = i * 2 * M_PI / N; + pt.x = cos(angle) * radius; + pt.y = sin(angle) * radius; + + points.push_back(pt); + } + + return points; +} + + +bool makeFootprintFromString(const std::string& footprint_string, std::vector& footprint) +{ + std::string error; + std::vector > vvf = parseVVF(footprint_string, error); + + if (error != "") + { + std::printf("Error parsing footprint parameter: '%s'", error.c_str()); + std::printf(" Footprint string was '%s'.", footprint_string.c_str()); + return false; + } + + // convert vvf into points. + if (vvf.size() < 3) + { + std::printf("You must specify at least three points for the robot footprint, reverting to previous footprint."); + return false; + } + footprint.reserve(vvf.size()); + for (unsigned int i = 0; i < vvf.size(); i++) + { + if (vvf[ i ].size() == 2) + { + Point point; + point.x = vvf[ i ][ 0 ]; + point.y = vvf[ i ][ 1 ]; + point.z = 0; + footprint.push_back(point); + } + else + { + std::printf("Points in the footprint specification must be pairs of numbers. Found a point with %d numbers.", + int(vvf[ i ].size())); + return false; + } + } + + return true; +} + + + +// std::vector makeFootprintFromParams(ros::NodeHandle& nh) +// { +// std::string full_param_name; +// std::string full_radius_param_name; +// std::vector points; + +// if (nh.searchParam("footprint", full_param_name)) +// { +// XmlRpc::XmlRpcValue footprint_xmlrpc; +// nh.getParam(full_param_name, footprint_xmlrpc); +// if (footprint_xmlrpc.getType() == XmlRpc::XmlRpcValue::TypeString && +// footprint_xmlrpc != "" && footprint_xmlrpc != "[]") +// { +// if (makeFootprintFromString(std::string(footprint_xmlrpc), points)) +// { +// writeFootprintToParam(nh, points); +// return points; +// } +// } +// else if (footprint_xmlrpc.getType() == XmlRpc::XmlRpcValue::TypeArray) +// { +// points = makeFootprintFromXMLRPC(footprint_xmlrpc, full_param_name); +// writeFootprintToParam(nh, points); +// return points; +// } +// } + +// if (nh.searchParam("robot_radius", full_radius_param_name)) +// { +// double robot_radius; +// nh.param(full_radius_param_name, robot_radius, 1.234); +// points = makeFootprintFromRadius(robot_radius); +// nh.setParam("robot_radius", robot_radius); +// } +// // Else neither param was found anywhere this knows about, so +// // defaults will come from dynamic_reconfigure stuff, set in +// // cfg/Costmap2D.cfg and read in this file in reconfigureCB(). +// return points; +// } + +// void writeFootprintToParam(std::string& nh, const std::vector& footprint) +// { +// std::ostringstream oss; +// bool first = true; +// for (unsigned int i = 0; i < footprint.size(); i++) +// { +// Point p = footprint[ i ]; +// if (first) +// { +// oss << "[[" << p.x << "," << p.y << "]"; +// first = false; +// } +// else +// { +// oss << ",[" << p.x << "," << p.y << "]"; +// } +// } +// oss << "]"; +// nh.setParam("footprint", oss.str().c_str()); +// } + +// double getNumberFromXMLRPC(XmlRpc::XmlRpcValue& value, const std::string& full_param_name) +// { +// // Make sure that the value we're looking at is either a double or an int. +// if (value.getType() != XmlRpc::XmlRpcValue::TypeInt && +// value.getType() != XmlRpc::XmlRpcValue::TypeDouble) +// { +// std::string& value_string = value; +// std::printf("Values in the footprint specification (param %s) must be numbers. Found value %s.", +// full_param_name.c_str(), value_string.c_str()); +// throw std::runtime_error("Values in the footprint specification must be numbers"); +// } +// return value.getType() == XmlRpc::XmlRpcValue::TypeInt ? (int)(value) : (double)(value); +// } + +// std::vector makeFootprintFromXMLRPC(XmlRpcValue& footprint_xmlrpc, +// const std::string& full_param_name) +// { +// // Make sure we have an array of at least 3 elements. +// if (footprint_xmlrpc.getType() != XmlRpc::XmlRpcValue::TypeArray || +// footprint_xmlrpc.size() < 3) +// { +// std::printf("The footprint must be specified as list of lists on the parameter server, %s was specified as %s", +// full_param_name.c_str(), std::string(footprint_xmlrpc).c_str()); +// throw std::runtime_error("The footprint must be specified as list of lists on the parameter server with at least " +// "3 points eg: [[x1, y1], [x2, y2], ..., [xn, yn]]"); +// } + +// std::vector footprint; +// Point pt; + +// for (int i = 0; i < footprint_xmlrpc.size(); ++i) +// { +// // Make sure each element of the list is an array of size 2. (x and y coordinates) +// XmlRpc::XmlRpcValue point = footprint_xmlrpc[ i ]; +// if (point.getType() != XmlRpc::XmlRpcValue::TypeArray || +// point.size() != 2) +// { +// std::printf("The footprint (parameter %s) must be specified as list of lists on the parameter server eg: " +// "[[x1, y1], [x2, y2], ..., [xn, yn]], but this spec is not of that form.", +// full_param_name.c_str()); +// throw std::runtime_error("The footprint must be specified as list of lists on the parameter server eg: " +// "[[x1, y1], [x2, y2], ..., [xn, yn]], but this spec is not of that form"); +// } + +// pt.x = getNumberFromXMLRPC(point[ 0 ], full_param_name); +// pt.y = getNumberFromXMLRPC(point[ 1 ], full_param_name); + +// footprint.push_back(pt); +// } +// return footprint; +// } + +} // end namespace costmap_2d diff --git a/src/layer.cpp b/src/layer.cpp new file mode 100644 index 0000000..60e5afd --- /dev/null +++ b/src/layer.cpp @@ -0,0 +1,27 @@ +#include "costmap_2d/layer.h" + +namespace costmap_2d +{ + +Layer::Layer() + : layered_costmap_(NULL) + , current_(false) + , enabled_(false) + , name_() + , tf_(NULL) +{} + +void Layer::initialize(LayeredCostmap* parent, std::string name, std::shared_ptr *tf) +{ + layered_costmap_ = parent; + name_ = name; + tf_ = tf; + onInitialize(); +} + +const std::vector& Layer::getFootprint() const +{ + return layered_costmap_->getFootprint(); +} + +} // end namespace costmap_2d diff --git a/src/layered_costmap.cpp b/src/layered_costmap.cpp new file mode 100644 index 0000000..ba77b33 --- /dev/null +++ b/src/layered_costmap.cpp @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include + +using std::vector; + +namespace costmap_2d +{ + + LayeredCostmap::LayeredCostmap(std::string global_frame, bool rolling_window, bool track_unknown) + : costmap_(), + global_frame_(global_frame), + rolling_window_(rolling_window), + current_(false), + minx_(0.0), + miny_(0.0), + maxx_(0.0), + maxy_(0.0), + bx0_(0), + bxn_(0), + by0_(0), + byn_(0), + initialized_(false), + size_locked_(false), + circumscribed_radius_(1.0), + inscribed_radius_(0.1) + { + if (track_unknown) + costmap_.setDefaultValue(NO_INFORMATION); + else + costmap_.setDefaultValue(FREE_SPACE); + } + + LayeredCostmap::~LayeredCostmap() + { + while (plugins_.size() > 0) + { + plugins_.pop_back(); + } + } + + void LayeredCostmap::resizeMap(unsigned int size_x, unsigned int size_y, double resolution, double origin_x, + double origin_y, bool size_locked) + { + boost::unique_lock lock(*(costmap_.getMutex())); + size_locked_ = size_locked; + costmap_.resizeMap(size_x, size_y, resolution, origin_x, origin_y); + for (vector>::iterator plugin = plugins_.begin(); plugin != plugins_.end(); + ++plugin) + { + (*plugin)->matchSize(); + } + } + + void LayeredCostmap::updateMap(double robot_x, double robot_y, double robot_yaw) + { + // Lock for the remainder of this function, some plugins (e.g. VoxelLayer) + // implement thread unsafe updateBounds() functions. + boost::unique_lock lock(*(costmap_.getMutex())); + + // if we're using a rolling buffer costmap... we need to update the origin using the robot's position + if (rolling_window_) + { + double new_origin_x = robot_x - costmap_.getSizeInMetersX() / 2; + double new_origin_y = robot_y - costmap_.getSizeInMetersY() / 2; + costmap_.updateOrigin(new_origin_x, new_origin_y); + } + + if (plugins_.size() == 0) + return; + + minx_ = miny_ = 1e30; + maxx_ = maxy_ = -1e30; + + for (vector>::iterator plugin = plugins_.begin(); plugin != plugins_.end(); + ++plugin) + { + if (!(*plugin)->isEnabled()) + continue; + double prev_minx = minx_; + double prev_miny = miny_; + double prev_maxx = maxx_; + double prev_maxy = maxy_; + (*plugin)->updateBounds(robot_x, robot_y, robot_yaw, &minx_, &miny_, &maxx_, &maxy_); + if (minx_ > prev_minx || miny_ > prev_miny || maxx_ < prev_maxx || maxy_ < prev_maxy) + { + std::printf("Illegal bounds change, was [tl: (%f, %f), br: (%f, %f)], but " + "is now [tl: (%f, %f), br: (%f, %f)]. The offending layer is %s", + prev_minx, prev_miny, prev_maxx, prev_maxy, + minx_, miny_, maxx_, maxy_, + (*plugin)->getName().c_str()); + } + } + + int x0, xn, y0, yn; + costmap_.worldToMapEnforceBounds(minx_, miny_, x0, y0); + costmap_.worldToMapEnforceBounds(maxx_, maxy_, xn, yn); + + x0 = std::max(0, x0); + xn = std::min(int(costmap_.getSizeInCellsX()), xn + 1); + y0 = std::max(0, y0); + yn = std::min(int(costmap_.getSizeInCellsY()), yn + 1); + + std::printf("Updating area x: [%d, %d] y: [%d, %d]", x0, xn, y0, yn); + + if (xn < x0 || yn < y0) + return; + + costmap_.resetMap(x0, y0, xn, yn); + + for (vector>::iterator plugin = plugins_.begin(); plugin != plugins_.end(); + ++plugin) + { + if ((*plugin)->isEnabled()) + (*plugin)->updateCosts(costmap_, x0, y0, xn, yn); + } + + bx0_ = x0; + bxn_ = xn; + by0_ = y0; + byn_ = yn; + + initialized_ = true; + } + + bool LayeredCostmap::isCurrent() + { + current_ = true; + for (vector>::iterator plugin = plugins_.begin(); plugin != plugins_.end(); + ++plugin) + { + if ((*plugin)->isEnabled()) + current_ = current_ && (*plugin)->isCurrent(); + } + return current_; + } + + void LayeredCostmap::setFootprint(const std::vector &footprint_spec) + { + footprint_ = footprint_spec; + costmap_2d::calculateMinAndMaxDistances(footprint_spec, inscribed_radius_, circumscribed_radius_); + + for (vector>::iterator plugin = plugins_.begin(); plugin != plugins_.end(); + ++plugin) + { + (*plugin)->onFootprintChanged(); + } + } + +} // namespace costmap_2d diff --git a/src/observation_buffer.cpp b/src/observation_buffer.cpp new file mode 100644 index 0000000..06fb38e --- /dev/null +++ b/src/observation_buffer.cpp @@ -0,0 +1,251 @@ +/********************************************************************* + * + * Software License Agreement (BSD License) + * + * Copyright (c) 2008, 2013, Willow Garage, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Willow Garage, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Eitan Marder-Eppstein + *********************************************************************/ +#include + +#include +#include +#include + +using namespace std; +using namespace tf2; + +namespace costmap_2d +{ +ObservationBuffer::ObservationBuffer(string topic_name, double observation_keep_time, double expected_update_rate, + double min_obstacle_height, double max_obstacle_height, double obstacle_range, + double raytrace_range, tf2_ros::Buffer& tf2_buffer, string global_frame, + string sensor_frame, double tf_tolerance) : + tf2_buffer_(tf2_buffer), observation_keep_time_(observation_keep_time), expected_update_rate_(expected_update_rate), + last_updated_(ros::Time::now()), global_frame_(global_frame), sensor_frame_(sensor_frame), topic_name_(topic_name), + min_obstacle_height_(min_obstacle_height), max_obstacle_height_(max_obstacle_height), + obstacle_range_(obstacle_range), raytrace_range_(raytrace_range), tf_tolerance_(tf_tolerance) +{ +} + +ObservationBuffer::~ObservationBuffer() +{ +} + +bool ObservationBuffer::setGlobalFrame(const std::string new_global_frame) +{ + ros::Time transform_time = ros::Time::now(); + std::string tf_error; + + geometry_msgs::TransformStamped transformStamped; + if (!tf2_buffer_.canTransform(new_global_frame, global_frame_, transform_time, ros::Duration(tf_tolerance_), &tf_error)) + { + ROS_ERROR("Transform between %s and %s with tolerance %.2f failed: %s.", new_global_frame.c_str(), + global_frame_.c_str(), tf_tolerance_, tf_error.c_str()); + return false; + } + + list::iterator obs_it; + for (obs_it = observation_list_.begin(); obs_it != observation_list_.end(); ++obs_it) + { + try + { + Observation& obs = *obs_it; + + geometry_msgs::PointStamped origin; + origin.header.frame_id = global_frame_; + origin.header.stamp = transform_time; + origin.point = obs.origin_; + + // we need to transform the origin of the observation to the new global frame + tf2_buffer_.transform(origin, origin, new_global_frame); + obs.origin_ = origin.point; + + // we also need to transform the cloud of the observation to the new global frame + tf2_buffer_.transform(*(obs.cloud_), *(obs.cloud_), new_global_frame); + } + catch (TransformException& ex) + { + ROS_ERROR("TF Error attempting to transform an observation from %s to %s: %s", global_frame_.c_str(), + new_global_frame.c_str(), ex.what()); + return false; + } + } + + // now we need to update our global_frame member + global_frame_ = new_global_frame; + return true; +} + +void ObservationBuffer::bufferCloud(const sensor_msgs::PointCloud2& cloud) +{ + geometry_msgs::PointStamped global_origin; + + // create a new observation on the list to be populated + observation_list_.push_front(Observation()); + + // check whether the origin frame has been set explicitly or whether we should get it from the cloud + string origin_frame = sensor_frame_ == "" ? cloud.header.frame_id : sensor_frame_; + + try + { + // given these observations come from sensors... we'll need to store the origin pt of the sensor + geometry_msgs::PointStamped local_origin; + local_origin.header.stamp = cloud.header.stamp; + local_origin.header.frame_id = origin_frame; + local_origin.point.x = 0; + local_origin.point.y = 0; + local_origin.point.z = 0; + tf2_buffer_.transform(local_origin, global_origin, global_frame_); + tf2::convert(global_origin.point, observation_list_.front().origin_); + + // make sure to pass on the raytrace/obstacle range of the observation buffer to the observations + observation_list_.front().raytrace_range_ = raytrace_range_; + observation_list_.front().obstacle_range_ = obstacle_range_; + + sensor_msgs::PointCloud2 global_frame_cloud; + + // transform the point cloud + tf2_buffer_.transform(cloud, global_frame_cloud, global_frame_); + global_frame_cloud.header.stamp = cloud.header.stamp; + + // now we need to remove observations from the cloud that are below or above our height thresholds + sensor_msgs::PointCloud2& observation_cloud = *(observation_list_.front().cloud_); + observation_cloud.height = global_frame_cloud.height; + observation_cloud.width = global_frame_cloud.width; + observation_cloud.fields = global_frame_cloud.fields; + observation_cloud.is_bigendian = global_frame_cloud.is_bigendian; + observation_cloud.point_step = global_frame_cloud.point_step; + observation_cloud.row_step = global_frame_cloud.row_step; + observation_cloud.is_dense = global_frame_cloud.is_dense; + + unsigned int cloud_size = global_frame_cloud.height*global_frame_cloud.width; + sensor_msgs::PointCloud2Modifier modifier(observation_cloud); + modifier.resize(cloud_size); + unsigned int point_count = 0; + + // copy over the points that are within our height bounds + sensor_msgs::PointCloud2Iterator iter_z(global_frame_cloud, "z"); + std::vector::const_iterator iter_global = global_frame_cloud.data.begin(), iter_global_end = global_frame_cloud.data.end(); + std::vector::iterator iter_obs = observation_cloud.data.begin(); + for (; iter_global != iter_global_end; ++iter_z, iter_global += global_frame_cloud.point_step) + { + if ((*iter_z) <= max_obstacle_height_ + && (*iter_z) >= min_obstacle_height_) + { + std::copy(iter_global, iter_global + global_frame_cloud.point_step, iter_obs); + iter_obs += global_frame_cloud.point_step; + ++point_count; + } + } + + // resize the cloud for the number of legal points + modifier.resize(point_count); + observation_cloud.header.stamp = cloud.header.stamp; + observation_cloud.header.frame_id = global_frame_cloud.header.frame_id; + } + catch (TransformException& ex) + { + // if an exception occurs, we need to remove the empty observation from the list + observation_list_.pop_front(); + ROS_ERROR("TF Exception that should never happen for sensor frame: %s, cloud frame: %s, %s", sensor_frame_.c_str(), + cloud.header.frame_id.c_str(), ex.what()); + return; + } + + // if the update was successful, we want to update the last updated time + last_updated_ = ros::Time::now(); + + // we'll also remove any stale observations from the list + purgeStaleObservations(); +} + +// returns a copy of the observations +void ObservationBuffer::getObservations(vector& observations) +{ + // first... let's make sure that we don't have any stale observations + purgeStaleObservations(); + + // now we'll just copy the observations for the caller + list::iterator obs_it; + for (obs_it = observation_list_.begin(); obs_it != observation_list_.end(); ++obs_it) + { + observations.push_back(*obs_it); + } +} + +void ObservationBuffer::purgeStaleObservations() +{ + if (!observation_list_.empty()) + { + list::iterator obs_it = observation_list_.begin(); + // if we're keeping observations for no time... then we'll only keep one observation + if (observation_keep_time_ == ros::Duration(0.0)) + { + observation_list_.erase(++obs_it, observation_list_.end()); + return; + } + + // otherwise... we'll have to loop through the observations to see which ones are stale + for (obs_it = observation_list_.begin(); obs_it != observation_list_.end(); ++obs_it) + { + Observation& obs = *obs_it; + // check if the observation is out of date... and if it is, remove it and those that follow from the list + if ((last_updated_ - obs.cloud_->header.stamp) > observation_keep_time_) + { + observation_list_.erase(obs_it, observation_list_.end()); + return; + } + } + } +} + +bool ObservationBuffer::isCurrent() const +{ + if (expected_update_rate_ == ros::Duration(0.0)) + return true; + + bool current = (ros::Time::now() - last_updated_).toSec() <= expected_update_rate_.toSec(); + if (!current) + { + ROS_WARN( + "The %s observation buffer has not been updated for %.2f seconds, and it should be updated every %.2f seconds.", + topic_name_.c_str(), (ros::Time::now() - last_updated_).toSec(), expected_update_rate_.toSec()); + } + return current; +} + +void ObservationBuffer::resetLastUpdated() +{ + last_updated_ = ros::Time::now(); +} +} // namespace costmap_2d +