I found the problem. I was creating my own ros::NodeHandle
, when I should have used the one I get from rqt_gui_cpp::Plugin()::getNodeHandle()
.
Subscribe to a simple ros node in rqt
Вопрос
I'm trying to subscribe to a very simple ros topic from within an rqt plugin. It seems like the subscription works, but my Callback function does not get called.
Subscription::Subscription(QString topic)
{
ROS_INFO("Subscribing to topic: [%s]", topic.toLocal8Bit().constData() );
sub = n.subscribe(topic.toLocal8Bit().constData(), 1000, &Subscription::chatterCallback, this);
}
void Subscription::chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str() );
emit messageReceived(msg->data.c_str() );
}
This should actually be very simple. What am I missing?
Решение
Не связан с StackOverflow