Skip to content

Commit

Permalink
Merge pull request #125 from ros2/create_publisher_with_queue_size
Browse files Browse the repository at this point in the history
add create_publisher signature which takes just a queue size
  • Loading branch information
wjwwood committed Oct 14, 2015
2 parents c8e127b + b3a88a9 commit c78ff7f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rclcpp/include/rclcpp/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ class Node
rclcpp::callback_group::CallbackGroup::SharedPtr
create_callback_group(rclcpp::callback_group::CallbackGroupType group_type);

/// Create and return a Publisher.
/**
* \param[in] topic_name The topic for this publisher to publish on.
* \param[in] qos_history_depth The depth of the publisher message queue.
* \return Shared pointer to the created publisher.
*/
template<typename MessageT>
typename rclcpp::publisher::Publisher<MessageT>::SharedPtr
create_publisher(
const std::string & topic_name, size_t qos_history_depth);

/// Create and return a Publisher.
/**
* \param[in] topic_name The topic for this publisher to publish on.
Expand Down
10 changes: 10 additions & 0 deletions rclcpp/include/rclcpp/node_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ Node::create_callback_group(
return group;
}

template<typename MessageT>
typename rclcpp::publisher::Publisher<MessageT>::SharedPtr
Node::create_publisher(
const std::string & topic_name, size_t qos_history_depth)
{
rmw_qos_profile_t qos = rmw_qos_profile_default;
qos.depth = qos_history_depth;
return this->create_publisher<MessageT>(topic_name, qos);
}

template<typename MessageT>
typename publisher::Publisher<MessageT>::SharedPtr
Node::create_publisher(
Expand Down

0 comments on commit c78ff7f

Please sign in to comment.