ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

Using callbacks with simple action clients

asked 2015-02-03 03:26:00 -0600

Robocop87 gravatar image

Hi everyone!

I am trying to use a goal callback and a feedback callback with my move base action client. I am getting a really long and hard to understand error though. I was hoping someone might be able to help me decipher it.

Here is a snippet of the code:

void GoToBehavior::goalCallback(const actionlib::SimpleClientGoalState& state,
                    const move_base_msgs::MoveBaseActionResult::ConstPtr& result) {
    if(state == actionlib::SimpleClientGoalState::SUCCEEDED)
        ROS_INFO("Goal reached!");
    else
        ROS_INFO("Goal failed");
}

void GoToBehavior::feebackCallback(const move_base_msgs::MoveBaseActionFeedback::ConstPtr& feedback){

}

void GoToBehavior::execute(){
    ROS_INFO("Sending goal");
    ac->sendGoal(goalMsg,
                boost::bind(&GoToBehavior::goalCallback, this, _1, _2),
                MoveBaseClient::SimpleActiveCallback(),
                boost::bind(&GoToBehavior::feebackCallback, this, _1));
}

where ac is of type: actionlib::SimpleActionClient<move_base_msgs::movebaseaction>

The error I am getting is this:

In file included from /usr/include/boost/bind.hpp:22:0, from /opt/ros/hydro/include/ros/publisher.h:35, from /opt/ros/hydro/include/ros/node_handle.h:32, from /opt/ros/hydro/include/ros/ros.h:45, from /home/nick/mqp_ws/src/mqp/hulk/include/hulk/Behavior.h:5, from /home/nick/mqp_ws/src/mqp/hulk/include/hulk/GoToBehavior.h:5, from /home/nick/mqp_ws/src/mqp/hulk/src/GoToBehavior.cpp:1: /usr/include/boost/bind/bind.hpp: In member function ‘void boost::_bi::list3<a1, a2,="" a3="">::operator()(boost::_bi::type<void>, F&, A&, int) [with F = boost::_mfi::mf2<void, gotobehavior,="" const="" actionlib::simpleclientgoalstate&amp;,="" const="" boost::shared_ptr<const="" move_base_msgs::movebaseactionresult_<std::allocator<void="">

&>, A = boost::_bi::list2<const actionlib::simpleclientgoalstate&amp;,="" const="" boost::shared_ptr<const="" move_base_msgs::movebaseresult_<std::allocator<void=""> &>, A1 = boost::_bi::value<gotobehavior*>, A2 = boost::arg<1>, A3 = boost::arg<2>]’: /usr/include/boost/bind/bind_template.hpp:102:59: instantiated from ‘boost::_bi::bind_t<r, f,="" l="">::result_type boost::_bi::bind_t<r, f,="" l="">::operator()(const A1&, const A2&) [with A1 = actionlib::SimpleClientGoalState, A2 = boost::shared_ptr<const move_base_msgs::movebaseresult_<std::allocator<void=""> , R = void, F = boost::_mfi::mf2<void, gotobehavior,="" const="" actionlib::simpleclientgoalstate&amp;,="" const="" boost::shared_ptr<const="" move_base_msgs::movebaseactionresult_<std::allocator<void=""> &>, L = boost::_bi::list3<boost::_bi::value<gotobehavior*>, boost::arg<1>, boost::arg<2> >, boost::_bi::bind_t<r, f,="" l="">::result_type = void]’ /usr/include/boost/function/function_template.hpp:153:11: instantiated from ‘static void boost::detail::function::void_function_obj_invoker2<functionobj, r,="" t0,="" t1="">::invoke(boost::detail::function::function_buffer&, T0, T1) [with FunctionObj = boost::_bi::bind_t<void, boost::_mfi::mf2<void,="" gotobehavior,="" const="" actionlib::simpleclientgoalstate&amp;,="" const="" boost::shared_ptr<const="" move_base_msgs::movebaseactionresult_<std::allocator<void=""> &>, boost::_bi::list3<boost::_bi::value<gotobehavior*>, boost::arg<1>, boost::arg<2> > >, R = void, T0 = const actionlib::SimpleClientGoalState&, T1 = const boost::shared_ptr<const move_base_msgs::movebaseresult_<std::allocator<void=""> &]’ /usr/include/boost/function/function_template.hpp:913:60: instantiated from ‘void boost::function2<r, t1,="" t2="">::assign_to(Functor) [with Functor = boost::_bi::bind_t<void, boost::_mfi::mf2<void,="" gotobehavior,="" const="" actionlib::simpleclientgoalstate&amp;,="" const="" boost::shared_ptr<const="" move_base_msgs::movebaseactionresult_<std::allocator<void=""> &>, boost::_bi::list3<boost::_bi::value<gotobehavior*>, boost::arg<1>, boost::arg<2> > >, R = void, T0 = const actionlib::SimpleClientGoalState&, T1 = const boost::shared_ptr<const ...

(more)
edit retag flag offensive close merge delete

Comments

Please format the error message properly. It will make it much more easier to read.

BennyRe gravatar image BennyRe  ( 2015-02-03 04:25:55 -0600 )edit

I'm sorry for not formatting it correctly, I thought I just needed to put it in the quote box. What should I have done?

Robocop87 gravatar image Robocop87  ( 2015-02-03 15:20:46 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2015-02-03 09:03:09 -0600

kramer gravatar image

Try removing the 'Action' from your types. That is, for instance, change MoveBaseActionResult to MoveBaseResult.

I'm not sure that's actually the issue, but it's what jumps out at me...

edit flag offensive delete link more

Comments

That was it, thank you for your help!

Robocop87 gravatar image Robocop87  ( 2015-02-03 15:19:54 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-02-03 03:26:00 -0600

Seen: 1,518 times

Last updated: Feb 03 '15