ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

See comment above. I did not need to link to the ads node, I needed to link to the ads cpp typesupport which is generated in package A. This library is created: "install/ads1115_ros_driver/lib/libads1115_ros_driver__rosidl_typesupport_cpp.so" and it allows me to use the headers in a separate package.

Package B CMakeListst.txt changes:

include_directories(include)
include_directories(include ../../install/ads1115_ros_driver/include/ads1115_ros_driver/)
add_executable(data_aggregator_node src/data_aggregator_node.cpp)
target_include_directories(data_aggregator_node PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>)
ament_target_dependencies(data_aggregator_node  rclcpp std_msgs rosbag2_cpp)
target_link_directories(data_aggregator_node PRIVATE ../../install/ads1115_ros_driver/lib)
target_link_libraries(data_aggregator_node rosbag2_cpp::rosbag2_cpp rclcpp::rclcpp ads1115_ros_driver__rosidl_typesupport_cpp)

Also gotta setup package.xml so it makes sure package A is complete before starting package B.