Skip to content

Commit

Permalink
Fixes to compile on Rolling. (#8)
Browse files Browse the repository at this point in the history
* Fixes to compile on Rolling.

ROS 2 Rolling has made two changes that cause this package
to not build in its current form:

1. The TRACEPOINT macro has been renamed to TRACETOOLS_TRACEPOINT.
2. The action_tutorials_interface package has been removed,
   since it was duplicating an action that was already available
   in example_interfaces.

This commit fixes both of these issues.

Signed-off-by: Chris Lalancette <[email protected]>
---------

Signed-off-by: Chris Lalancette <[email protected]>
Co-authored-by: Stefan Fabian <[email protected]>
  • Loading branch information
clalancette and StefanFabian authored Oct 10, 2024
1 parent 6fe8529 commit 86c4db8
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 18 deletions.
3 changes: 1 addition & 2 deletions ros_babel_fish/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ if (BUILD_TESTING)
ament_lint_auto_find_test_dependencies()

find_package(ament_cmake_gtest REQUIRED)
find_package(action_tutorials_interfaces REQUIRED)
find_package(example_interfaces REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(ros_babel_fish_test_msgs REQUIRED)
Expand All @@ -154,7 +153,7 @@ if (BUILD_TESTING)
target_link_libraries(test_service_client ${PROJECT_NAME})

ament_add_gtest(test_action_client test/action_client.cpp)
ament_target_dependencies(test_action_client action_tutorials_interfaces example_interfaces ros_babel_fish_test_msgs)
ament_target_dependencies(test_action_client example_interfaces ros_babel_fish_test_msgs)
target_link_libraries(test_action_client ${PROJECT_NAME})
endif ()

Expand Down
4 changes: 2 additions & 2 deletions ros_babel_fish/examples/action_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ int main( int argc, char **argv )
auto node = rclcpp::Node::make_shared( "action_client" );
std::thread spin_thread( [node]() { rclcpp::spin( node ); } );
BabelFish fish;
auto client = fish.create_action_client( *node, "fibonacci",
"action_tutorials_interfaces/action/Fibonacci" );
auto client =
fish.create_action_client( *node, "fibonacci", "example_interfaces/action/Fibonacci" );

RCLCPP_INFO( node->get_logger(), "Waiting for server to come up." );
if ( !client->wait_for_action_server( 10s ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class AnyServiceCallback
const std::shared_ptr<rmw_request_id_t> &request_header,
std::shared_ptr<CompoundMessage> request, std::shared_ptr<CompoundMessage> response )
{
TRACEPOINT( callback_start, static_cast<const void *>( this ), false );
TRACETOOLS_TRACEPOINT( callback_start, static_cast<const void *>( this ), false );
if ( std::holds_alternative<SharedPtrCallback>( callback_ ) ) {
(void)request_header;
const auto &cb = std::get<SharedPtrCallback>( callback_ );
Expand All @@ -72,16 +72,16 @@ class AnyServiceCallback
const auto &cb = std::get<SharedPtrDeferResponseCallbackWithServiceHandle>( callback_ );
cb( service_handle, request_header, std::move( request ) );
}
TRACEPOINT( callback_end, static_cast<const void *>( this ) );
TRACETOOLS_TRACEPOINT( callback_end, static_cast<const void *>( this ) );
}

void register_callback_for_tracing()
{
#ifndef TRACETOOLS_DISABLED
std::visit(
[this]( auto &&arg ) {
TRACEPOINT( rclcpp_callback_register, static_cast<const void *>( this ),
tracetools::get_symbol( arg ) );
TRACETOOLS_TRACEPOINT( rclcpp_callback_register, static_cast<const void *>( this ),
tracetools::get_symbol( arg ) );
},
callback_ );
#endif // TRACETOOLS_DISABLED
Expand Down
4 changes: 2 additions & 2 deletions ros_babel_fish/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
<depend>rosidl_runtime_cpp</depend>
<depend>rosidl_typesupport_cpp</depend>
<depend>rosidl_typesupport_introspection_cpp</depend>
<build_depend>action_tutorials_interfaces</build_depend>
<build_depend>example_interfaces</build_depend>
<build_depend>geometry_msgs</build_depend>
<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_cmake_clang_format</test_depend>
<test_depend>ament_cmake_cppcheck</test_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>example_interfaces</test_depend>
<test_depend>geometry_msgs</test_depend>
<test_depend>ros_babel_fish_test_msgs</test_depend>
<test_depend>std_msgs</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
5 changes: 3 additions & 2 deletions ros_babel_fish/src/detail/babel_fish_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ BabelFishService::BabelFishService( std::shared_ptr<rcl_node_t> node_base,

rclcpp::exceptions::throw_from_rcl_error( ret, "could not create service" );
}
TRACEPOINT( rclcpp_service_callback_added, static_cast<const void *>( get_service_handle().get() ),
static_cast<const void *>( &callback_ ) );
TRACETOOLS_TRACEPOINT( rclcpp_service_callback_added,
static_cast<const void *>( get_service_handle().get() ),
static_cast<const void *>( &callback_ ) );
#ifndef TRACETOOLS_DISABLED
callback_.register_callback_for_tracing();
#endif
Expand Down
9 changes: 5 additions & 4 deletions ros_babel_fish/src/detail/babel_fish_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ BabelFishSubscription::BabelFishSubscription(
this->subscription_topic_statistics_ = std::move( subscription_topic_statistics );
}

TRACEPOINT( rclcpp_subscription_init, static_cast<const void *>( get_subscription_handle().get() ),
static_cast<const void *>( this ) );
TRACEPOINT( rclcpp_subscription_callback_added, static_cast<const void *>( this ),
static_cast<const void *>( &callback_ ) );
TRACETOOLS_TRACEPOINT( rclcpp_subscription_init,
static_cast<const void *>( get_subscription_handle().get() ),
static_cast<const void *>( this ) );
TRACETOOLS_TRACEPOINT( rclcpp_subscription_callback_added, static_cast<const void *>( this ),
static_cast<const void *>( &callback_ ) );
// The callback object gets copied, so if registration is done too early/before this point
// (e.g. in `AnySubscriptionCallback::set()`), its address won't match any address used later
// in subsequent tracepoints.
Expand Down
4 changes: 2 additions & 2 deletions ros_babel_fish/test/action_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <ros_babel_fish/babel_fish.hpp>

#include <action_msgs/msg/goal_status_array.h>
#include <action_tutorials_interfaces/action/fibonacci.hpp>
#include <example_interfaces/action/fibonacci.hpp>
#include <ros_babel_fish_test_msgs/action/simple_test.hpp>

#include <rclcpp/rclcpp.hpp>
Expand Down Expand Up @@ -49,7 +49,7 @@ TEST( ActionClientTest, actionLookup )
EXPECT_NE( ts, nullptr );
EXPECT_TRUE( Equal( type_support->type_support_handle, *ts ) );

type_support = fish.get_action_type_support( "action_tutorials_interfaces/action/Fibonacci" );
type_support = fish.get_action_type_support( "example_interfaces/action/Fibonacci" );
ASSERT_NE( type_support, nullptr );

const auto *ts_map =
Expand Down

0 comments on commit 86c4db8

Please sign in to comment.