Skip to content

Commit

Permalink
Refine fuse_echo
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Oct 14, 2022
1 parent 02e7696 commit 297a212
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions fuse_core/src/fuse_echo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ namespace fuse_core
class FuseEcho : public rclcpp::Node
{
public:
explicit FuseEcho(rclcpp::NodeOptions options):
Node("fuse_echo", options)
explicit FuseEcho(rclcpp::NodeOptions options): Node("fuse_echo", options)
{
// Subscribe to the constraint topic
graph_subscriber_ = this->create_subscription<fuse_msgs::msg::SerializedGraph>(
Expand All @@ -72,20 +71,20 @@ class FuseEcho : public rclcpp::Node
rclcpp::Subscription<fuse_msgs::msg::SerializedGraph>::SharedPtr graph_subscriber_;
rclcpp::Subscription<fuse_msgs::msg::SerializedTransaction>::SharedPtr transaction_subscriber_;

void graphCallback(const fuse_msgs::msg::SerializedGraph::SharedPtr msg)
void graphCallback(const fuse_msgs::msg::SerializedGraph& msg)
{
std::cout << "-------------------------" << std::endl;
std::cout << "GRAPH:" << std::endl;
std::cout << "received at: " << rclcpp::Clock().now().seconds() << std::endl;
std::cout << "received at: " << this->now().seconds() << std::endl;
auto graph = graph_deserializer_.deserialize(msg);
graph->print();
}

void transactionCallback(const fuse_msgs::msg::SerializedTransaction::SharedPtr msg)
void transactionCallback(const fuse_msgs::msg::SerializedTransaction& msg)
{
std::cout << "-------------------------" << std::endl;
std::cout << "TRANSACTION:" << std::endl;
std::cout << "received at: " << rclcpp::Clock().now().seconds() << std::endl;
std::cout << "received at: " << this->now().seconds() << std::endl;
auto transaction = transaction_deserializer_.deserialize(msg);
transaction.print();
}
Expand All @@ -103,4 +102,4 @@ int main(int argc, char **argv)
}

#include <rclcpp_components/register_node_macro.hpp>
RCLCPP_COMPONENTS_REGISTER_NODE(fuse_core::FuseEcho)
RCLCPP_COMPONENTS_REGISTER_NODE(fuse_core::FuseEcho)

0 comments on commit 297a212

Please sign in to comment.