ROS_INFO not printing anything after some point
In my code below, constructor of a class calls functions within the same class. All ROS_INFO
in func1 print successfully but func2 doesn't print anything. Any idea?
Update 8/13/2012) Each action server is robot manipulation, which means there's fair amount of time before func2 gets called after func1.
#include <ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include <actionlib/client/terminal_state.h>
#include <pointcloud_filter/PointCloudFilterBoxAction.h>
#include <pointcloud_filter/PointCloudFilterBoxGoal.h>
#include <pointcloud_segmenter/RGBPointCloudSegmenterAction.h>
#include <pointcloud_segmenter/RGBPointCloudSegmenterGoal.h>
class OurClass
{
public:
static const double DURATION = 30.0;
OurClass()
{
this->func1();
this->func2();
}
void func1()
{
ROS_INFO("msg 1-0");
actionlib::SimpleActionClient<ourns::OurAction> ac("ourAction", true);
bool finished_before_timeout = ac.waitForResult(ros::Duration(DURATION));
if (finished_before_timeout)
{
actionlib::SimpleClientGoalState state = ac.getState();
ROS_INFO("msg 1-1");
}
else
ROS_INFO("msg 1-2");
}
void func2()
{
ROS_INFO("msg 2-0 ");
actionlib::SimpleActionClient<pointcloud_filter::PointCloudFilterBoxAction> ac_filter("PointCloudFilterBox", true);
ac_filter.sendGoal(goal_filter);
bool finished_before_timeout2 = ac_filter.waitForResult(ros::Duration(DURATION));
if (finished_before_timeout2)
{
actionlib::SimpleClientGoalState state = ac_filter.getState();
ROS_INFO("2-1");
}
else
ROS_INFO("2-2");
}
};
int main(int argc, char **argv)
{
ros::init(argc, argv, "AcClient");
OurClass();
}
Environment) fuerte
, Ubuntu 10.04