Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
uses: ros-misc-utilities/ros_build_scripts/.github/workflows/ros2_since_jazzy.yml@master
with:
repo: ${{ github.event.repository.name }}
vcs_url: https://raw.githubusercontent.com/${{ github.repository }}/ros2/${{ github.event.repository.name }}.repos
vcs_url: ${{ github.event.repository.name }}.repos
76 changes: 51 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,50 +30,83 @@ find_package(yaml-cpp REQUIRED)
find_package(Boost REQUIRED COMPONENTS graph)
find_package(GTSAM REQUIRED)

set(tagslam_ament_dependencies
set(tagslam_packages
"apriltag_msgs"
"cv_bridge"
"flex_sync"
"geometry_msgs"
"image_transport"
"flex_sync"
"nav_msgs"
"rclcpp"
"rclcpp_components"
"rosbag2_cpp"
"rosbag2_transport"
"rosgraph_msgs"
"sensor_msgs"
"std_srvs"
"tf2_ros"
"tf2_msgs"
"tf2"
"rosgraph_msgs"
"std_srvs")
"tf2")

set(sync_and_detect_ament_dependencies
set(sync_and_detect_packages
"apriltag_msgs"
"apriltag_detector"
"cv_bridge"
"flex_sync"
"image_transport"
"pluginlib"
"nav_msgs"
"pluginlib"
"rclcpp"
"sensor_msgs")

set(all_ament_dependencies
${tagslam_ament_dependencies}
${sync_and_detect_ament_dependencies})
set(all_packages ${tagslam_packages} ${sync_and_detect_packages})

foreach(pkg ${all_ament_dependencies})
foreach(pkg ${all_packages})
find_package(${pkg} REQUIRED)
endforeach()

if(${cv_bridge_VERSION} GREATER "3.3.0")
add_definitions(-DUSE_CV_BRIDGE_HPP)
endif()
set(sync_and_detect_dependencies
${apriltag_msgs_TARGETS}
apriltag_detector::apriltag_detector
cv_bridge::cv_bridge
flex_sync::flex_sync
image_transport::image_transport
${nav_msgs_TARGETS}
pluginlib::pluginlib
rclcpp::rclcpp
${sensor_msgs_TARGETS})

set(tagslam_dependencies
${apriltag_msgs_TARGETS}
cv_bridge::cv_bridge
flex_sync::flex_sync
${geometry_msgs_TARGETS}
gtsam
image_transport::image_transport
${nav_msgs_TARGETS}
opencv_core
opencv_imgproc
opencv_calib3d
yaml-cpp
rclcpp::rclcpp
rclcpp_components::component
rosbag2_cpp::rosbag2_cpp
rosbag2_transport::rosbag2_transport
${rosgraph_msgs_TARGETS}
${sensor_msgs_TARGETS}
${std_srvs_TARGETS}
tf2_ros::tf2_ros
${tf2_msgs_TARGETS}
tf2::tf2)


if(${image_transport_VERSION} VERSION_GREATER_EQUAL "6.3.0")
add_definitions(-DIMAGE_TRANSPORT_USE_QOS)
endif()
if(${image_transport_VERSION} VERSION_GREATER_EQUAL "6.4.0")
add_definitions(-DIMAGE_TRANSPORT_USE_NODEINTERFACE)
endif()


#
# --------- library
Expand Down Expand Up @@ -120,8 +153,7 @@ add_library(${PROJECT_NAME} SHARED
src/yaml.cpp
)

ament_target_dependencies(${PROJECT_NAME} ${tagslam_ament_dependencies})
target_link_libraries(${PROJECT_NAME} opencv_core opencv_imgproc opencv_calib3d yaml-cpp gtsam)
target_link_libraries(${PROJECT_NAME} PUBLIC ${tagslam_dependencies})
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

target_include_directories(
Expand All @@ -136,7 +168,6 @@ rclcpp_components_register_nodes(${PROJECT_NAME} "${PROJECT_NAME}::TagSLAM")
# -------- node
#
add_executable(${PROJECT_NAME}_node src/tagslam_node.cpp)
# ament_target_dependencies(${PROJECT_NAME}_node ${tagslam_ament_dependencies})
target_link_libraries(${PROJECT_NAME}_node ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}_node PRIVATE include)
target_compile_features(${PROJECT_NAME}_node PRIVATE cxx_std_17)
Expand All @@ -147,8 +178,7 @@ target_compile_features(${PROJECT_NAME}_node PRIVATE cxx_std_17)
add_library(sync_and_detect SHARED
src/sync_and_detect.cpp
)
ament_target_dependencies(sync_and_detect ${sync_and_detect_ament_dependencies})
target_link_libraries(sync_and_detect yaml-cpp)
target_link_libraries(sync_and_detect yaml-cpp ${sync_and_detect_dependencies})
target_compile_features(sync_and_detect PRIVATE cxx_std_17)

target_include_directories(
Expand All @@ -165,10 +195,7 @@ rclcpp_components_register_nodes(sync_and_detect "${PROJECT_NAME}::SyncAndDetect
add_executable(${PROJECT_NAME}_from_bag
src/${PROJECT_NAME}_from_bag.cpp
src/enhanced_player.cpp)
ament_target_dependencies(${PROJECT_NAME}_from_bag
${tagslam_ament_dependencies}
rosbag2_transport)
target_link_libraries(${PROJECT_NAME}_from_bag ${PROJECT_NAME} sync_and_detect)
target_link_libraries(${PROJECT_NAME}_from_bag ${PROJECT_NAME} sync_and_detect ${tagslam_dependencies})
target_include_directories(${PROJECT_NAME}_from_bag PRIVATE include)
target_compile_features(${PROJECT_NAME}_from_bag PRIVATE cxx_std_17)

Expand All @@ -179,8 +206,7 @@ target_compile_features(${PROJECT_NAME}_from_bag PRIVATE cxx_std_17)
add_executable(sync_and_detect_from_bag
src/sync_and_detect_from_bag.cpp
src/enhanced_player.cpp)
ament_target_dependencies(sync_and_detect_from_bag rosbag2_transport)
target_link_libraries(sync_and_detect_from_bag sync_and_detect yaml-cpp)
target_link_libraries(sync_and_detect_from_bag sync_and_detect yaml-cpp rosbag2_transport::rosbag2_transport)

target_include_directories(sync_and_detect_from_bag PRIVATE include)
target_compile_features(sync_and_detect_from_bag PRIVATE cxx_std_17)
Expand Down
7 changes: 6 additions & 1 deletion include/tagslam/sync_and_detect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ class Subscriber<SyncT, Image>
const std::string param_name = topic + ".image_transport";
sub_ = std::make_shared<image_transport::Subscriber>(
image_transport::create_subscription(
node, topic,
#ifdef IMAGE_TRANSPORT_USE_NODEINTERFACE
*node,
#else
node,
#endif
topic,
std::bind(
&Subscriber<SyncT, Image>::callback, this, std::placeholders::_1),
node->get_parameter_or<std::string>(param_name, "raw"),
Expand Down
2 changes: 1 addition & 1 deletion src/sync_and_detect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.

#include <algorithm>
#ifdef USE_CV_BRIDGE_HPP
#if __has_include(<cv_bridge/cv_bridge.hpp>)
#include <cv_bridge/cv_bridge.hpp>
#else
#include <cv_bridge/cv_bridge.h>
Expand Down
3 changes: 1 addition & 2 deletions src/tagslam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifdef USE_CV_BRIDGE_HPP
#if __has_include(<cv_bridge/cv_bridge.hpp>)
#include <cv_bridge/cv_bridge.hpp>
#else
#include <cv_bridge/cv_bridge.h>
#endif

#include <yaml-cpp/yaml.h>

#include <cmath>
Expand Down