Peter Müller
2009-08-19 23:23:30 UTC
Hi,
I have written a simple Qt GUI, which is supposed receive sensor_msgs::LaserScan messages.
The GUI is developed in Eclipse using qmake. The rest of my Application, which sends out the LaserScans is using rosmake. The compilation works and the GUI connects successfully to roscore and subscribes.
The following code is used to start the application:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ros::init(argc, argv, "RosGUI");
RosGUI w;
w.init();
w.show();
return a.exec();
}
RosGUI methods to subscribe and receive callbacks:
class RosGUI {
ros::NodeHandle handle;
ros::Subscriber laserDataSub;
void RosGUI::init()
{
laserDataSub = handle.subscribe(LASER_DATA_KEY, 1, &RosGUI::laserScanCallback, this);
}
void RosGUI::laserScanCallback(const sensor_msgs::LaserScanConstPtr& msg)
{
//never called
}
};
My problem is that RosGUI::laserScanCallback is never called.
I usually use ros::spin() event loop in the main-method for the callbacks in my other nodes.
Is that the problem?
I have written a simple Qt GUI, which is supposed receive sensor_msgs::LaserScan messages.
The GUI is developed in Eclipse using qmake. The rest of my Application, which sends out the LaserScans is using rosmake. The compilation works and the GUI connects successfully to roscore and subscribes.
The following code is used to start the application:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
ros::init(argc, argv, "RosGUI");
RosGUI w;
w.init();
w.show();
return a.exec();
}
RosGUI methods to subscribe and receive callbacks:
class RosGUI {
ros::NodeHandle handle;
ros::Subscriber laserDataSub;
void RosGUI::init()
{
laserDataSub = handle.subscribe(LASER_DATA_KEY, 1, &RosGUI::laserScanCallback, this);
}
void RosGUI::laserScanCallback(const sensor_msgs::LaserScanConstPtr& msg)
{
//never called
}
};
My problem is that RosGUI::laserScanCallback is never called.
I usually use ros::spin() event loop in the main-method for the callbacks in my other nodes.
Is that the problem?