Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

It's probably because your Subscriber gets deleted at the end of the Load function. The Subscribe function returns a smart pointer, which will get deleted once it goes out of scope. The solution is to added a class member variable to hold the subscriber pointer:

this->mySubscriber = node->Subscribe(topicName, &SensorRead::OnUpdate, this);
...
private: transport::SubscriberPtr mySubscriber