Cannot create a rclcpp::spin function

asked 2019-08-08 13:57:50 -0500

EdwardNur gravatar image

Hi all,

I am having a trouble in publishing and subscribing the node at the same time. More specifically, I am having an issue to pass the shared_ptr to the rclcpp::spin function. Here is my function inside my class:

void OdomNode::update()
    //std::shared_ptr<rclcpp::Node> _for_spin = std::make_shared<rclcpp::Node>(*this);

As you can see, the object itself inherits from rclcpp::Node class and this is a node instance. I have tried to use the first (uncommented) choice but it would not compile saying that the variable is private in this context (not sure what private there exactly). I have also tried to pass shared_from_this but during the runtime it crashes saying that it is a bad_weak_ptr.

edit retag flag offensive close merge delete