-
Notifications
You must be signed in to change notification settings - Fork 522
Closed
Description
Bug report
Build errors when calling rclcpp::create_publisher are not easy to solve looking at the create_publisher.hpp file.
Either we should add documentation there, or we should make the functions more flexible in the accepted input arguments.
Required Info:
- Operating System:
- Ubuntu 20.04
- Installation type:
- binaries
- Version or commit hash:
- Rolling
- Client library (if applicable):
- rclcpp
Steps to reproduce issue
class MyNode : public rclcpp::Node
{
public:
MyNode() : rclcpp::Node("my_node")
{
auto pub = rclcpp::create_publisher<std_msgs::msg::String>(
this->get_node_topics_interface(),
"my_topic",
rclcpp::SensorDataQoS());
}
};
Actual behavior
The above code snippet fails to compile due to no matching function found in rclcpp::create_publisher.
Looking at https://github.com/ros2/rclcpp/blob/master/rclcpp/include/rclcpp/create_publisher.hpp didn't really help to figure out the solution to the problem.
Tried also to add a this->get_node_parameters_interface() argument to match the signatures there, but got again errors
auto pub = rclcpp::create_publisher<std_msgs::msg::String>(
this->get_node_parameters_interface(),
this->get_node_topics_interface(),
"my_topic",
rclcpp::SensorDataQoS());
The following syntax works
auto node_topics_interface = this->get_node_topics_interface();
auto pub = rclcpp::create_publisher<std_msgs::msg::String>(
node_topics_interface,
"my_topic",
rclcpp::SensorDataQoS());
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels