问题描述:
no matching function for call to ‘tf2_ros::TransformBroadcaster::TransformBroadcaster()’
解决方案:
- Assuming that you have split declarations into a header file and definitions in the source file.
-
You can declare the broadcaster in the header file.
private: std::shared_ptr<tf2_ros::TransformBroadcaster> tf_broadcaster_;
-
Then initialize somewhere in the constructor of the source file.
tf_broadcaster_ = std::make_shared<tf2_ros::TransformBroadcaster>(this);
-
Finally, you can send a stamped transform message as so:
tf_broadcaster_->sendTransform(transform_stamped);