我已经安装了 ros2 dashing diademata。我使用 C++14 编写了一个 ROS2 节点。我想static_tf
通过创建缓冲区来阅读TransformListener
包含时出现以下错误,#include "tf2_ros/buffer.h"
如果不包含,则不会出现任何错误。
错误如下
In file included from /opt/ros/dashing/include/tf2/LinearMath/Vector3.h:21:0,
from /opt/ros/dashing/include/tf2/LinearMath/Matrix3x3.h:19,
from /opt/ros/dashing/include/tf2/LinearMath/Transform.h:21,
from /opt/ros/dashing/include/tf2/buffer_core.h:35,
from /opt/ros/dashing/include/tf2_ros/buffer_interface.h:37,
from /opt/ros/dashing/include/tf2_ros/buffer.h:35,
from /module/src/example/include/example/example.h:17,
from /module/src/example/src/example.cpp:7:
/opt/ros/dashing/include/tf2/LinearMath/Scalar.h: In function ‘tf2Scalar tf2Log(tf2Scalar)’:
/opt/ros/dashing/include/tf2/LinearMath/Scalar.h:187:66: error: expression cannot be used as a function
TF2SIMD_FORCE_INLINE tf2Scalar tf2Log(tf2Scalar x) { return log(x); }
CMakeLists.txt
如下
cmake_minimum_required(VERSION 3.5)
project(curb_odometry)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wdeprecated-declarations -Wunused-parameter)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(tf2 REQUIRED)
find_package(message_filters REQUIRED)
find_package(Boost REQUIRED COMPONENTS system)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
include_directories(include
${Boost_INCLUDE_DIRS}
${tf2_ros_INCLUDE_DIRS}
${rclcpp_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
${geometry_msgs_INCLUDE_DIRS}
${nav_msgs_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${message_filters_INCLUDE_DIR}
)
link_directories(${Boost_LIBRARY_DIRS})
add_executable(example src/example.cpp src/curb_detection.cpp src/curb_odometry.cpp)
target_link_libraries(example ${Boost_LIBRARIES} )
target_include_directories(example PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
example
"rclcpp"
"sensor_msgs"
"geometry_msgs"
"nav_msgs"
"std_msgs"
"boost"
"message_filters"
"geometry2"
"tf2_ros"
"tf2"
)
install(TARGETS example
EXPORT export_${PROJECT_NAME}
DESTINATION lib/${PROJECT_NAME})
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
看起来错误来自 tf 库。在这方面的任何帮助都将是可观的。