ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In both yours:

while (ros::ok()) {
...
}

you must call:

ros::spinOnce();

otherwise callbacks are not called/executed

In both yours:

while (ros::ok()) {
...
}

you must call:

ros::spinOnce();

otherwise callbacks are not called/executed

Furthermore in the first script you call the constructor of the class, but af the end it will automatically call your destructor since you intialize your class, do nothing, and then you go back to main.

In both yours:

while (ros::ok()) {
...
}

you must call:

ros::spinOnce();

otherwise callbacks are not called/executed

Furthermore in the first script you call the constructor of the class, but af the end it will automatically call your destructor since you intialize your class, do nothing, and then you go back to main.

To understand what I mean try something like that:

TeleopAgv::TeleopAgv()
{
   ...
   ROS_INFO("Calling the constructor of class bla bla");
}

TeleopAgv::~TeleopAgv()
{
    ROS_INFO("Calling the destructor of class bla bla");
}