Skip to content

Commit

Permalink
Update indent.
Browse files Browse the repository at this point in the history
Signed-off-by: Lei Liu <[email protected]>
  • Loading branch information
llapx committed Jul 5, 2021
1 parent a190752 commit 2b6b5f0
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions demo_nodes_cpp/src/topics/listener_loaned_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@

namespace demo_nodes_cpp
{
// Create a Listener class that subclasses the generic rclcpp::Node base class.
// The main function below will instantiate the class as a ROS node.
class LoanedMessageListener : public rclcpp::Node
// Create a Listener class that subclasses the generic rclcpp::Node base class.
// The main function below will instantiate the class as a ROS node.
class LoanedMessageListener : public rclcpp::Node
{
public:
DEMO_NODES_CPP_PUBLIC
explicit LoanedMessageListener(const rclcpp::NodeOptions &options)
: Node("listener_loaned_message", options)
{
public:
DEMO_NODES_CPP_PUBLIC
explicit LoanedMessageListener(const rclcpp::NodeOptions &options)
: Node("listener_loaned_message", options)
// Create a callback function for when messages are received.
// Variations of this function also exist using, for example UniquePtr for zero-copy transport.
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
auto callback =
[this](const std_msgs::msg::Float64::SharedPtr msg) -> void
{
// Create a callback function for when messages are received.
// Variations of this function also exist using, for example UniquePtr for zero-copy transport.
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
auto callback =
[this](const std_msgs::msg::Float64::SharedPtr msg) -> void
{
RCLCPP_INFO(this->get_logger(), "I heard: [%f]", msg->data);
};
// Create a subscription to the topic which can be matched with one or more compatible ROS
// publishers.
// Note that not all publishers on the same topic with the same type will be compatible:
// they must have compatible Quality of Service policies.
sub_ = create_subscription<std_msgs::msg::Float64>("chatter_pod", 10, callback);
}
RCLCPP_INFO(this->get_logger(), "I heard: [%f]", msg->data);
};
// Create a subscription to the topic which can be matched with one or more compatible ROS
// publishers.
// Note that not all publishers on the same topic with the same type will be compatible:
// they must have compatible Quality of Service policies.
sub_ = create_subscription<std_msgs::msg::Float64>("chatter_pod", 10, callback);
}

private:
rclcpp::Subscription<std_msgs::msg::Float64>::SharedPtr sub_;
};
private:
rclcpp::Subscription<std_msgs::msg::Float64>::SharedPtr sub_;
};

} // namespace demo_nodes_cpp
} // namespace demo_nodes_cpp

RCLCPP_COMPONENTS_REGISTER_NODE(demo_nodes_cpp::LoanedMessageListener)

0 comments on commit 2b6b5f0

Please sign in to comment.