update for ROS

This commit is contained in:
HiepLM 2026-01-07 16:56:13 +07:00
parent e0db8d0e20
commit ff90ea2f29
6 changed files with 343 additions and 145 deletions

View File

@ -1,105 +1,181 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.0.2)
project(robot_tf3_geometry_msgs VERSION 1.0.0 LANGUAGES CXX)
# ========================================================
# Dual-mode CMakeLists.txt: Supports both Catkin and Standalone CMake
# ========================================================
# Detect if building with Catkin
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE) set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_tf3_geometry_msgs with Catkin") message(STATUS "Building robot_tf3_geometry_msgs with Catkin")
find_package(catkin REQUIRED)
else() else()
set(BUILDING_WITH_CATKIN FALSE) set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_tf3_geometry_msgs with Standalone CMake") message(STATUS "Building robot_tf3_geometry_msgs with Standalone CMake")
endif() endif()
project(robot_tf3_geometry_msgs) # C++ Standard - must be set before find_package
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_EXTENSIONS OFF)
# Find dependencies
find_package(Boost REQUIRED COMPONENTS thread)
find_package(Eigen3 REQUIRED)
find_package(GTest REQUIRED)
if (NOT BUILDING_WITH_CATKIN)
# Enable Position Independent Code
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Cu hình RPATH đ tránh cycle trong runtime search path
set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}")
set(PACKAGES_DIR
robot_geometry_msgs
data_convert
tf3
)
else()
# ======================================================== # ========================================================
# Catkin specific configuration # Catkin specific configuration
# ======================================================== # ========================================================
find_package(catkin REQUIRED COMPONENTS
robot_geometry_msgs
data_convert
tf3
)
if(BUILDING_WITH_CATKIN)
catkin_package( catkin_package(
INCLUDE_DIRS include INCLUDE_DIRS include
# LIBRARIES không cn vì đây là header-only library # LIBRARIES không cn vì đây là header-only library
# CATKIN_DEPENDS không cn vì dependencies không phi Catkin packages CATKIN_DEPENDS robot_geometry_msgs data_convert tf3
DEPENDS Eigen3 Boost DEPENDS Eigen3 Boost
) )
endif()
# Find dependencies include_directories(
find_package(Boost COMPONENTS thread REQUIRED)
find_package(GTest REQUIRED)
# Finding Eigen3
find_package(Eigen3 REQUIRED)
# Include directories
include_directories(
include include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
${GTEST_INCLUDE_DIRS}
)
# Install headers
if(NOT BUILDING_WITH_CATKIN)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include/${PROJECT_NAME}
) )
endif() endif()
add_library(robot_tf3_geometry_msgs INTERFACE # Tìm tt c header files
) file(GLOB_RECURSE HEADERS "include/robot_tf3_geometry_msgs/*.h")
target_include_directories(robot_tf3_geometry_msgs # To INTERFACE library (header-only)
add_library(${PROJECT_NAME} INTERFACE)
if(BUILDING_WITH_CATKIN)
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
# Set include directories
target_include_directories(${PROJECT_NAME}
INTERFACE INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
)
# Liên kết vi robot_std_msgs nếu bn có file Header.h trong include/robot_std_msgs/
target_link_libraries(robot_tf3_geometry_msgs INTERFACE
geometry_msgs
data_convert
) )
# --- Cài đt thư vin vào h thng khi chy make install --- # Link dependencies (header-only, chỉ cần include paths)
install(TARGETS robot_tf3_geometry_msgs target_link_libraries(${PROJECT_NAME}
EXPORT robot_tf3_geometry_msgs-targets INTERFACE
INCLUDES DESTINATION include # Cài đt include ${catkin_LIBRARIES}
) )
# --- Xut export set robot_tf3_geometry_msgs-targets thành file CMake module --- else()
# --- To file lib/cmake/robot_tf3_geometry_msgs/robot_tf3_geometry_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng ---
# --- Find_package(robot_tf3_geometry_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE tf3_robot_geometry_msgs::robot_tf3_geometry_msgs) ---
install(EXPORT robot_tf3_geometry_msgs-targets
FILE robot_tf3_geometry_msgs-targets.cmake
DESTINATION lib/cmake/robot_tf3_geometry_msgs
)
# # Test: tomsg_frommsg # Set include directories
add_executable(test_tomsg_frommsg test/test_tomsg_frommsg.cpp) target_include_directories(${PROJECT_NAME}
target_link_libraries(test_tomsg_frommsg INTERFACE
${GTEST_LIBRARIES} $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
robot_tf3_geometry_msgs $<INSTALL_INTERFACE:include>
)
# Link dependencies (header-only, chỉ cần include paths)
target_link_libraries(${PROJECT_NAME}
INTERFACE
${PACKAGES_DIR}
)
endif()
if(BUILDING_WITH_CATKIN)
## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
else()
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
# Export targets
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/${PROJECT_NAME}
)
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
# Print configuration info
message(STATUS "=================================")
message(STATUS "Project: ${PROJECT_NAME} (Header-Only)")
message(STATUS "Version: ${PROJECT_VERSION}")
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "Headers found:")
foreach(hdr ${HEADERS})
message(STATUS " - ${hdr}")
endforeach()
message(STATUS "Dependencies: geometry_msgs, data_convert, tf3, Eigen3, Boost")
message(STATUS "=================================")
endif()
# ========================================================
# Test executables
# ========================================================
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tomsg_frommsg.cpp)
add_executable(${PROJECT_NAME}_tomsg_frommsg_test test/test_tomsg_frommsg.cpp)
target_link_libraries(${PROJECT_NAME}_tomsg_frommsg_test PRIVATE
${PROJECT_NAME}
GTest::GTest
GTest::Main
Threads::Threads Threads::Threads
tf3 tf3
data_convert data_convert
) )
# # Test: tf2_geometry_msgs endif()
add_executable(test_geometry_msgs test/test_tf2_geometry_msgs.cpp)
target_link_libraries(test_geometry_msgs if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tf2_geometry_msgs.cpp)
${GTEST_LIBRARIES} add_executable(${PROJECT_NAME}_geometry_msgs_test test/test_tf2_geometry_msgs.cpp)
target_link_libraries(${PROJECT_NAME}_geometry_msgs_test PRIVATE
${PROJECT_NAME}
GTest::GTest
GTest::Main
Threads::Threads Threads::Threads
tf3 tf3
robot_tf3_geometry_msgs
data_convert data_convert
) )
endif()

View File

@ -111,7 +111,11 @@ void fromMsg(const robot_geometry_msgs::Vector3& in, tf3::Vector3& out)
*/ */
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_geometry_msgs::Vector3Stamped& t) {return data_convert::convertTime(t.header.stamp);} const tf3::Time& getTimestamp(const robot_geometry_msgs::Vector3Stamped& t) {
static thread_local tf3::Time stamp;
stamp = data_convert::convertTime(t.header.stamp);
return stamp;
}
/** \brief Extract a frame ID from the header of a Vector message. /** \brief Extract a frame ID from the header of a Vector message.
* This function is a specialization of the getFrameId template defined in tf3/convert.h. * This function is a specialization of the getFrameId template defined in tf3/convert.h.
@ -219,7 +223,11 @@ void fromMsg(const robot_geometry_msgs::Point& in, tf3::Vector3& out)
*/ */
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_geometry_msgs::PointStamped& t) {return data_convert::convertTime(t.header.stamp);} const tf3::Time& getTimestamp(const robot_geometry_msgs::PointStamped& t) {
static thread_local tf3::Time stamp;
stamp = data_convert::convertTime(t.header.stamp);
return stamp;
}
/** \brief Extract a frame ID from the header of a Point message. /** \brief Extract a frame ID from the header of a Point message.
* This function is a specialization of the getFrameId template defined in tf3/convert.h. * This function is a specialization of the getFrameId template defined in tf3/convert.h.
@ -328,7 +336,11 @@ void fromMsg(const robot_geometry_msgs::Quaternion& in, tf3::Quaternion& out)
*/ */
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_geometry_msgs::QuaternionStamped& t) {return data_convert::convertTime(t.header.stamp);} const tf3::Time& getTimestamp(const robot_geometry_msgs::QuaternionStamped& t) {
static thread_local tf3::Time stamp;
stamp = data_convert::convertTime(t.header.stamp);
return stamp;
}
/** \brief Extract a frame ID from the header of a Quaternion message. /** \brief Extract a frame ID from the header of a Quaternion message.
* This function is a specialization of the getFrameId template defined in tf3/convert.h. * This function is a specialization of the getFrameId template defined in tf3/convert.h.
@ -461,7 +473,11 @@ void fromMsg(const robot_geometry_msgs::Pose& in, tf3::Transform& out)
*/ */
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_geometry_msgs::PoseStamped& t) {return data_convert::convertTime(t.header.stamp);} const tf3::Time& getTimestamp(const robot_geometry_msgs::PoseStamped& t) {
static thread_local tf3::Time stamp;
stamp = data_convert::convertTime(t.header.stamp);
return stamp;
}
/** \brief Extract a frame ID from the header of a Pose message. /** \brief Extract a frame ID from the header of a Pose message.
* This function is a specialization of the getFrameId template defined in tf3/convert.h. * This function is a specialization of the getFrameId template defined in tf3/convert.h.
@ -535,7 +551,11 @@ void fromMsg(const robot_geometry_msgs::PoseStamped& msg, tf3::Stamped<tf3::Tran
*/ */
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_geometry_msgs::PoseWithCovarianceStamped& t) {return data_convert::convertTime(t.header.stamp);} const tf3::Time& getTimestamp(const robot_geometry_msgs::PoseWithCovarianceStamped& t) {
static thread_local tf3::Time stamp;
stamp = data_convert::convertTime(t.header.stamp);
return stamp;
}
/** \brief Extract a frame ID from the header of a PoseWithCovarianceStamped message. /** \brief Extract a frame ID from the header of a PoseWithCovarianceStamped message.
* This function is a specialization of the getFrameId template defined in tf3/convert.h. * This function is a specialization of the getFrameId template defined in tf3/convert.h.
@ -659,7 +679,11 @@ void fromMsg(const tf3::TransformMsg& in, tf3::Transform& out)
*/ */
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_geometry_msgs::TransformStamped& t) {return data_convert::convertTime(t.header.stamp);} const tf3::Time& getTimestamp(const robot_geometry_msgs::TransformStamped& t) {
static thread_local tf3::Time stamp;
stamp = data_convert::convertTime(t.header.stamp);
return stamp;
}
/** \brief Extract a frame ID from the header of a Transform message. /** \brief Extract a frame ID from the header of a Transform message.
* This function is a specialization of the getFrameId template defined in tf3/convert.h. * This function is a specialization of the getFrameId template defined in tf3/convert.h.
@ -1014,7 +1038,11 @@ inline
/**********************/ /**********************/
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_geometry_msgs::WrenchStamped& t) {return data_convert::convertTime(t.header.stamp);} const tf3::Time& getTimestamp(const robot_geometry_msgs::WrenchStamped& t) {
static thread_local tf3::Time stamp;
stamp = data_convert::convertTime(t.header.stamp);
return stamp;
}
template <> template <>

View File

@ -19,5 +19,10 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>robot_geometry_msgs</build_depend>
<build_depend>data_convert</build_depend>
<build_depend>tf3</build_depend>
<run_depend>robot_geometry_msgs</run_depend>
<run_depend>data_convert</run_depend>
<run_depend>tf3</run_depend>
</package> </package>

View File

@ -1,98 +1,176 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.0.2)
project(robot_tf3_sensor_msgs VERSION 1.0.0 LANGUAGES CXX)
# ========================================================
# Dual-mode CMakeLists.txt: Supports both Catkin and Standalone CMake
# ========================================================
# Detect if building with Catkin
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL) if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
set(BUILDING_WITH_CATKIN TRUE) set(BUILDING_WITH_CATKIN TRUE)
message(STATUS "Building robot_tf3_sensor_msgs with Catkin") message(STATUS "Building robot_tf3_sensor_msgs with Catkin")
find_package(catkin REQUIRED)
else() else()
set(BUILDING_WITH_CATKIN FALSE) set(BUILDING_WITH_CATKIN FALSE)
message(STATUS "Building robot_tf3_sensor_msgs with Standalone CMake") message(STATUS "Building robot_tf3_sensor_msgs with Standalone CMake")
endif() endif()
project(robot_tf3_sensor_msgs) # C++ Standard - must be set before find_package
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_EXTENSIONS OFF)
# Find dependencies
find_package(Boost REQUIRED COMPONENTS thread)
find_package(Eigen3 REQUIRED)
find_package(GTest REQUIRED)
if (NOT BUILDING_WITH_CATKIN)
# Enable Position Independent Code
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Cu hình RPATH đ tránh cycle trong runtime search path
set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}")
set(PACKAGES_DIR
robot_sensor_msgs
data_convert
tf3
robot_geometry_msgs
)
else()
# ======================================================== # ========================================================
# Catkin specific configuration # Catkin specific configuration
# ======================================================== # ========================================================
find_package(catkin REQUIRED COMPONENTS
robot_sensor_msgs
data_convert
tf3
robot_geometry_msgs
)
if(BUILDING_WITH_CATKIN)
catkin_package( catkin_package(
INCLUDE_DIRS include INCLUDE_DIRS include
# LIBRARIES không cn vì đây là header-only library # LIBRARIES không cn vì đây là header-only library
# CATKIN_DEPENDS không cn vì dependencies không phi Catkin packages CATKIN_DEPENDS robot_sensor_msgs data_convert tf3 robot_geometry_msgs
DEPENDS Eigen3 Boost DEPENDS Eigen3 Boost
) )
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
endif() endif()
# Find dependencies # Tìm tt c header files
find_package(Boost COMPONENTS thread REQUIRED) file(GLOB_RECURSE HEADERS "include/robot_tf3_sensor_msgs/*.h")
find_package(GTest REQUIRED)
# Finding Eigen3 # To INTERFACE library (header-only)
find_package(Eigen3 REQUIRED) add_library(${PROJECT_NAME} INTERFACE)
if(BUILDING_WITH_CATKIN)
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
# Include directories # Set include directories
include_directories( target_include_directories(${PROJECT_NAME}
include
${EIGEN3_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${GTEST_INCLUDE_DIRS}
)
add_library(robot_tf3_sensor_msgs INTERFACE
)
target_include_directories(robot_tf3_sensor_msgs
INTERFACE INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
)
target_link_libraries(robot_tf3_sensor_msgs INTERFACE
robot_sensor_msgs
data_convert
) )
# --- Cài đt thư vin vào h thng khi chy make install --- # Link dependencies (header-only, chỉ cần include paths)
install(TARGETS robot_tf3_sensor_msgs target_link_libraries(${PROJECT_NAME}
EXPORT robot_tf3_sensor_msgs-targets INTERFACE
INCLUDES DESTINATION include # Cài đt include ${catkin_LIBRARIES}
) )
# --- Xut export set robot_tf3_sensor_msgs-targets thành file CMake module --- else()
# --- To file lib/cmake/robot_tf3_sensor_msgs/robot_tf3_sensor_msgs-targets.cmake ---
# --- File này cha cu hình giúp project khác có th dùng ---
# --- Find_package(robot_tf3_sensor_msgs REQUIRED) ---
# --- Target_link_libraries(my_app PRIVATE robot_tf3_sensor_msgs::robot_tf3_sensor_msgs) ---
install(EXPORT robot_tf3_sensor_msgs-targets
FILE robot_tf3_sensor_msgs-targets.cmake
NAMESPACE robot_tf3_sensor_msgs::
DESTINATION lib/cmake/robot_tf3_sensor_msgs
)
add_executable(test_tf2_sensor_msgs test/test_tf2_sensor_msgs.cpp) # Set include directories
target_include_directories(test_tf2_sensor_msgs PUBLIC target_include_directories(${PROJECT_NAME}
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# Link dependencies (header-only, chỉ cần include paths)
target_link_libraries(${PROJECT_NAME}
INTERFACE
${PACKAGES_DIR}
)
endif()
if(BUILDING_WITH_CATKIN)
## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
else()
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
# Export targets
install(EXPORT ${PROJECT_NAME}-targets
FILE ${PROJECT_NAME}-targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/${PROJECT_NAME}
)
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
# Print configuration info
message(STATUS "=================================")
message(STATUS "Project: ${PROJECT_NAME} (Header-Only)")
message(STATUS "Version: ${PROJECT_VERSION}")
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "Headers found:")
foreach(hdr ${HEADERS})
message(STATUS " - ${hdr}")
endforeach()
message(STATUS "Dependencies: robot_sensor_msgs, data_convert, tf3, robot_geometry_msgs, Eigen3, Boost")
message(STATUS "=================================")
endif()
# ========================================================
# Test executables
# ========================================================
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tf2_sensor_msgs.cpp)
add_executable(${PROJECT_NAME}_test test/test_tf2_sensor_msgs.cpp)
target_include_directories(${PROJECT_NAME}_test PUBLIC
${EIGEN3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS}
${GTEST_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
robot_tf3_sensor_msgs )
geometry_msgs target_link_libraries(${PROJECT_NAME}_test PRIVATE
tf3 ${PROJECT_NAME}
) GTest::GTest
target_link_libraries(test_tf2_sensor_msgs GTest::Main
${GTEST_LIBRARIES}
Threads::Threads Threads::Threads
robot_tf3_sensor_msgs robot_geometry_msgs
geometry_msgs
tf3 tf3
data_convert data_convert
) )
endif()

View File

@ -52,7 +52,11 @@ namespace tf3
*/ */
template <> template <>
inline inline
const tf3::Time& getTimestamp(const robot_sensor_msgs::PointCloud2& p) {return data_convert::convertTime(p.header.stamp);} const tf3::Time& getTimestamp(const robot_sensor_msgs::PointCloud2& p) {
static thread_local tf3::Time cached_time;
cached_time = data_convert::convertTime(p.header.stamp);
return cached_time;
}
/** \brief Extract a frame ID from the header of a PointCloud2 message. /** \brief Extract a frame ID from the header of a PointCloud2 message.
* This function is a specialization of the getFrameId template defined in tf3/convert.h. * This function is a specialization of the getFrameId template defined in tf3/convert.h.

View File

@ -19,6 +19,13 @@
<buildtool_depend version_gte="0.5.68">catkin</buildtool_depend> <buildtool_depend version_gte="0.5.68">catkin</buildtool_depend>
<build_depend>robot_sensor_msgs</build_depend>
<build_depend>tf3</build_depend>
<build_depend>robot_geometry_msgs</build_depend>
<build_depend>data_convert</build_depend>
<run_depend>robot_sensor_msgs</run_depend>
<run_depend>robot_geometry_msgs</run_depend>
<run_depend>data_convert</run_depend>
<run_depend>tf3</run_depend>
</package> </package>