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

Canni's profile - activity

2018-01-12 07:01:22 -0500 received badge  Famous Question (source)
2017-12-06 13:56:16 -0500 received badge  Famous Question (source)
2017-09-21 05:02:05 -0500 received badge  Notable Question (source)
2017-08-07 11:13:35 -0500 received badge  Enthusiast
2017-08-05 10:12:46 -0500 received badge  Notable Question (source)
2017-08-05 01:15:59 -0500 received badge  Popular Question (source)
2017-08-04 18:00:42 -0500 marked best answer "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?

2017-08-04 18:00:39 -0500 commented answer "Attempting to accept the next goal when a new goal is not available"

Ok done! Thank you so much!

2017-08-04 17:55:54 -0500 commented question "Attempting to accept the next goal when a new goal is not available"

I modified the code ;)

2017-08-04 17:55:50 -0500 edited question "Attempting to accept the next goal when a new goal is not available"

"Attempting to accept the next goal when a new goal is not available" Hello! I'm trying to perform an action-client/acti

2017-08-04 17:55:05 -0500 received badge  Editor (source)
2017-08-04 17:55:05 -0500 edited question "Attempting to accept the next goal when a new goal is not available"

"Attempting to accept the next goal when a new goal is not available" Hello! I'm trying to perform an action-client/acti

2017-08-04 17:53:57 -0500 edited question "Attempting to accept the next goal when a new goal is not available"

"Attempting to accept the next goal when a new goal is not available" Hello! I'm trying to perform an action-client/acti

2017-08-04 17:53:38 -0500 commented answer "Attempting to accept the next goal when a new goal is not available"

RIGHT! Thank you so much! Now I'm trying to get my goal in that goalCB but I don't know how to instantiate it ahahah I'm

2017-08-04 17:53:08 -0500 commented answer "Attempting to accept the next goal when a new goal is not available"

RIGHT! Thank you so much! Now I'm trying to get my goal in that goalCB but I don't know how to instanciate it ahahah I'm

2017-08-04 17:45:35 -0500 commented question "Attempting to accept the next goal when a new goal is not available"

Yeah sorry, but they were only few lines and they had comments above so i just copied and pasted my code

2017-08-04 12:23:10 -0500 asked a question "Attempting to accept the next goal when a new goal is not available"

"Attempting to accept the next goal when a new goal is not available" Hello! I'm trying to perform an action-client/acti

2017-08-03 11:47:39 -0500 commented answer How to add parameters to a subscriber callback function given that it is also an action_client

Thank you so much! I didn't study c++ so all this stuff is absolutely new to me. One day maybe I'll understand in detail

2017-08-03 11:46:28 -0500 marked best answer How to add parameters to a subscriber callback function given that it is also an action_client

Hello, I'm new to ROS and my situation is the following: I have a node which subscribes to a Topic, so of course I have my callback function (which by the way uses a custom message so the problem may be there, I don't know. I don't really know C++ either :D ). The point is that this node must also be a client for an actionlib Client-Server structure. So every time my node reads something from the topic it is subscribed to, I need also to inform my actionlib Server. This is why I need to have a "Client" parameter in my callback function, to send also a message to the Server.

My callback SHOULD look like this:

void polygonCallback(const es_1::Draw msg, Client* cl){//Stuff}

And I just defined "Client" like this

typedef actionlib::SimpleActionClient<es_1::polygonAction> Client;

Now, I found online that to do what I want to do I sould use boost::bind() and I did. Just like this:

ros::Subscriber sub = n.subscribe<es_1::Draw>("draw", 1000, boost::bind(polygonCallback,_1,&client));

But when I try to "catkin_make" this is the error that pops out:

In file included from /usr/include/boost/bind.hpp:22:0,
                 from /opt/ros/kinetic/include/ros/publisher.h:35,
                 from /opt/ros/kinetic/include/ros/node_handle.h:32,
                 from /opt/ros/kinetic/include/ros/ros.h:45,
                 from /home/canniz/Desktop/catkin_ws/src/es_1/src/polygon_action_client.cpp:1:
/usr/include/boost/bind/bind.hpp: In instantiation of ‘void boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&, int) [with F = void (*)(es_1::Draw_<std::allocator<void> >, actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*); A = boost::_bi::list1<const boost::shared_ptr<const es_1::Draw_<std::allocator<void> > >&>; A1 = boost::arg<1>; A2 = boost::_bi::value<actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*>]’:
/usr/include/boost/bind/bind_template.hpp:47:59:   required from ‘boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()(const A1&) [with A1 = boost::shared_ptr<const es_1::Draw_<std::allocator<void> > >; R = void; F = void (*)(es_1::Draw_<std::allocator<void> >, actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*); L = boost::_bi::list2<boost::arg<1>, boost::_bi::value<actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*> >; boost::_bi::bind_t<R, F, L>::result_type = void]’
/usr/include/boost/function/function_template.hpp:159:11:   required from ‘static void boost::detail::function::void_function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionObj = boost::_bi::bind_t<void, void (*)(es_1::Draw_<std::allocator<void> >, actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*), boost::_bi::list2<boost::arg<1>, boost::_bi::value<actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*> > >; R = void; T0 = const boost::shared_ptr<const es_1::Draw_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:940:38:   required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = boost::_bi::bind_t<void, void (*)(es_1::Draw_<std::allocator<void> >, actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*), boost::_bi::list2<boost::arg<1>, boost::_bi::value<actionlib::SimpleActionClient<es_1::polygonAction_<std::allocator<void> > >*> > >; R = void; T0 = const boost::shared_ptr<const es_1::Draw_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:728:7:   required ...
(more)
2017-08-03 11:46:28 -0500 received badge  Scholar (source)
2017-08-03 11:46:24 -0500 received badge  Supporter (source)
2017-08-03 03:42:19 -0500 received badge  Popular Question (source)
2017-08-03 00:01:45 -0500 commented answer How to add parameters to a subscriber callback function given that it is also an action_client

And so, the callback can't Just have one more parameter without using the Boost::bind trick. But It isn't working

2017-08-03 00:00:38 -0500 commented answer How to add parameters to a subscriber callback function given that it is also an action_client

Thanks for the answer The problem Is that this is a stupid homework and I can't change the structure which looks like th

2017-08-02 20:40:50 -0500 asked a question How to add parameters to a subscriber callback function given that it is also an action_client

How to add parameters to a subscriber callback function given that it is also an action_client Hello, I'm new to ROS and

2017-08-02 20:40:50 -0500 asked a question Subscriber and Actionlib Client, I need more parameters in my callback func

Subscriber and Actionlib Client, I need more parameters in my callback func Hello, I'm new to ROS and my situation is th