-
Notifications
You must be signed in to change notification settings - Fork 240
Closed
Description
Bug report
Required Info:
- Operating System: Ubuntu 22.04 Jammy
- Installation type: Source
- Version or commit hash: rolling
- DDS implementation: Rolling Default
Description
The TransformBroadcaster constructor should take a NodeT, but tests in tf2_ros/test/test_transform_broadcaster.cpp pass a pointer to a rclcpp::Node to the broadcaster (and the tests pass although they shouldn't).
Changes in #552 exposed this issue, as it depends on NodeT being a pointer to a rclcpp::Node.
In Writing a broadcaster (C++), a node instance is passed to the constructor as below:
tf_broadcaster_ = std::make_unique<tf2_ros::TransformBroadcaster>(*this);But in the tf2_ros/test/test_transform_broadcaster.cpp, a shared pointer is provided.
TEST(tf2_test_transform_broadcaster, transform_broadcaster_rclcpp_node)
{
auto node = rclcpp::Node::make_shared("tf2_ros_message_filter");
tf2_ros::TransformBroadcaster tfb(node);
}This was originally reported in ros-perception/image_pipeline#775.
FYI @alsora
Steps to reproduce issue
mkdir -p geometry2_ws/src
cd "$_"
git clone git@github.com:ijnek/geometry2 -b ijnek-bug-test-case
cd ../
colcon build
Expected behavior
Compiles fine.
Actual behavior
Doesn't compile.
--- stderr: tf2_ros
In file included from /home/ijnek/tmp_workspaces/geometry2_ws/src/geometry2/tf2_ros/test/test_transform_broadcaster.cpp:31:
/home/ijnek/tmp_workspaces/geometry2_ws/src/geometry2/tf2_ros/include/tf2_ros/transform_broadcaster.h: In instantiation of ‘tf2_ros::TransformBroadcaster::TransformBroadcaster(NodeT&&, const rclcpp::QoS&, const rclcpp::PublisherOptionsWithAllocator<AllocatorT>&) [with NodeT = rclcpp::Node&; AllocatorT = std::allocator<void>]’:
/home/ijnek/tmp_workspaces/geometry2_ws/src/geometry2/tf2_ros/test/test_transform_broadcaster.cpp:57:41: required from here
/home/ijnek/tmp_workspaces/geometry2_ws/src/geometry2/tf2_ros/include/tf2_ros/transform_broadcaster.h:71:7: error: base operand of ‘->’ has non-pointer type ‘rclcpp::Node’
71 | node->get_node_parameters_interface(),
| ^~~~
gmake[2]: *** [CMakeFiles/tf2_ros_test_transform_broadcaster.dir/build.make:76: CMakeFiles/tf2_ros_test_transform_broadcaster.dir/test/test_transform_broadcaster.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:510: CMakeFiles/tf2_ros_test_transform_broadcaster.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< tf2_ros [14.3s, exited with code 2]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels