"Attempting to accept the next goal when a new goal is not available"
Hello! I'm trying to perform an action-client/action-server structure using a callback structure.
So it just has to read info from the goal and publish messages on a turtlesim topic.
When I run this node (either before or after I created the client) every time the server receives a Goal I get this:
[ INFO] [1501865084.462187784]: Server Created
[ INFO] [1501865086.638608252]: I'm in goalCB() and I'm receiving a new Goal
[ERROR] [1501865086.638780375]: Attempting to accept the next goal when a new goal is not available
This is my code (which btw for now does nothing, I just wanted to see if everything worked)
class polygonAction
{
public
:
polygonAction(std::string name) :
as(nh_, name, false),
action_name_(name)
{
//register the goal and feeback callbacks
as.registerGoalCallback(boost::bind(&polygonAction::goalCB, this));
as.registerPreemptCallback(boost::bind(&polygonAction::preemptCB, this));
ROS_INFO("Server Created");
//Stuff for turtlesim we don't care
[...]
as.start();
}
~polygonAction(void)
{
}
void goalCB()
{
ROS_INFO("I'm in goalCB() and I'm receiving a new Goal");
goal_length = as.acceptNewGoal()->length;
goal_sides = as.acceptNewGoal()->sides;
ROS_INFO("Received %d sides and %d lenght", goal_sides, goal_length);
}
void preemptCB()
{
ROS_INFO("%s: Preempted", action_name_.c_str());
// set the action state to preempted
as.setPreempted();
}
//Stuff for turtlesim we are not interested in
[...]
protected:
ros::NodeHandle nh_;
actionlib::SimpleActionServer<es_1::polygonAction> as;
std::string action_name_;
int goal_sides, goal_length, sides_count;
es_1::polygonFeedback feedback_;
es_1::polygonResult result_;
ros::Publisher pub;
ros::Subscriber sub;
};
int main(int argc, char** argv)
{
ros::init(argc, argv, "polygon_action_server");
polygonAction polygon("polygon");
ros::spin();
return 0;
}
Any ideas?
It's better to include only the important information in your question. This question is only about the mechanics of an action server, the turtle-sim or your polygon are not relevant but just a distraction.
Yeah sorry, but they were only few lines and they had comments above so i just copied and pasted my code
I modified the code ;)