void actualizeGoal(ros::NodeHandle& nh, actionlib::SimpleActionClient<arm_navigation_msgs::MoveArmAction>& client, arm_navigation_msgs::MoveArmGoal goal) { if (nh.ok()) { bool finished_within_time = false; client.sendGoal(goal); finished_within_time = client.waitForResult(ros::Duration(200.0)); if (!finished_within_time) { client.cancelGoal(); ROS_INFO("Timed out achieving goal"); } else { actionlib::SimpleClientGoalState state = client.getState(); bool success = (state == actionlib::SimpleClientGoalState::SUCCEEDED); if(success) ROS_INFO("Action finished: %s",state.toString().c_str()); else ROS_INFO("Action failed: %s",state.toString().c_str()); } } }