ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After being shown an example of how to use rclcpp::create_subscription (the header I linked to) I realized it has nearly the same interface as rclcpp::Node::create_subscription.

In my case I was trying to replace this line:

joint_state_subscriber_ = node_->create_subscription<sensor_msgs::msg::JointState>( joint_states_topic, 25, std::bind(&CurrentStateMonitor::jointStateCallback, this, std::placeholders::_1));

Using the example here (https://github.com/ros-visualization/interactive_markers/blob/ros2/src/interactive_marker_server.cpp) and the convenience constructor for rclcpp::QoS (https://docs.ros2.org/dashing/api/rclcpp/classrclcpp_1_1QoS.html) I converted the line to work like this:

joint_state_subscriber_ = rclcpp::create_subscription<sensor_msgs::msg::JointState>( node_topics_interface_, joint_states_topic, rclcpp::QoS(25), std::bind(&CurrentStateMonitor::jointStateCallback, this, std::placeholders::_1));

Is there a place where these functions that are not part of rclcpp::Node are documented?