Ask Your Question
0

Action Server Compiler Error => error: no match for call to ‘(boost::_mfi........

asked 2021-08-06 05:24:29 -0500

serhat gravatar image

Hi all,

I have a problem about creating an action_server on ROS1. I have created a few action server programs in the past. But never get this error which i will tell the details of. My action server program is very easy:( load_action_03.cpp )

#include <ros/ros.h> 
#include <actionlib/server/simple_action_server.h>
#include <qr_drive/load_service_04Action.h>

//Goal angle should be a value within (-pi,pi]
class LoadActionServer
{

protected:
    ros::NodeHandle nh_;
    actionlib::SimpleActionServer<qr_drive::load_service_04Action> as_; // NodeHandle instance must be created before this line. Otherwise strange error occurs.
    std::string action_name_; 
    // create messages that are used to published feedback/result 
    qr_drive::load_service_04ActionFeedback feedback_; 
    qr_drive::load_service_04ActionResult result_; 

public:


  LoadActionServer(std::string name):as_(nh_,name,boost::bind(&LoadActionServer::LoadActionFunc,this,_1),false),
  action_name_(name)
  {
    as_.start() ; 
  }

  ~LoadActionServer(void);

    void LoadActionFunc(const qr_drive::load_service_04ActionGoalConstPtr &goal) 
    {
        ROS_INFO("[Load Server] LoadServiceFunc is started") ; 

        ROS_INFO("[Load_action Server] LoadServiceFunc is done") ;
    }


};

LoadActionServer::~LoadActionServer(void)
{
    std::cout << "aaaa" << std::endl ; 
}

int main(int argc, char** argv)
{

  ros::init(argc,argv,"load_action_server_node") ; 

//   LoadActionServer a_object("load_service") ; 

  ROS_INFO("Load Server is started...") ; 

  ros::spin(); 

  return 0 ; 

}

Related action message is below:( load_service_04.action )

#goal definition
int32 task
---
#result definition
int32 reply_task_id
---
#feedback
int32 useless_feedback

When I compile the programs, i get this error:

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/serhatsony/catkin_ws/src/qr_drive/src/load_action_03.cpp:12:
/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 = boost::_mfi::mf1<void, LoadActionServer, const boost::shared_ptr<const qr_drive::load_service_04ActionGoal_<std::allocator<void> > >&>; A = boost::_bi::list1<const boost::shared_ptr<const qr_drive::load_service_04Goal_<std::allocator<void> > >&>; A1 = boost::_bi::value<LoadActionServer*>; A2 = boost::arg<1>]’:
/usr/include/boost/bind/bind.hpp:905:50:   required from ‘boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()(A1&&) [with A1 = const boost::shared_ptr<const qr_drive::load_service_04Goal_<std::allocator<void> > >&; R = void; F = boost::_mfi::mf1<void, LoadActionServer, const boost::shared_ptr<const qr_drive::load_service_04ActionGoal_<std::allocator<void> > >&>; L = boost::_bi::list2<boost::_bi::value<LoadActionServer*>, boost::arg<1> >; 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, boost::_mfi::mf1<void, LoadActionServer, const boost::shared_ptr<const qr_drive::load_service_04ActionGoal_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<LoadActionServer*>, boost::arg<1> > >; R = void; T0 = const boost::shared_ptr<const qr_drive::load_service_04Goal_<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, boost::_mfi::mf1<void, LoadActionServer, const boost::shared_ptr<const qr_drive::load_service_04ActionGoal_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<LoadActionServer*>, boost::arg<1> > >; R = void; T0 = const boost::shared_ptr<const qr_drive::load_service_04Goal_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:728:7:   required from ‘boost::function1<R ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-08-10 00:52:52 -0500

serhat gravatar image

Hello all, I found my problem. With the help of what the compiler says, I focused on this part: error: no match for call to ‘(boost: This compiler error tells us you try to pass wrong data format into a function. Such as:

void(string data)
{
  print(data) ; 
}

But you try to pass integer variables or data into this func. In my question, we also see same compiler error mentality. After a quick check of my "execute callback func", I realized that I wrote this:

void LoadActionFunc(const qr_drive::load_service_04ActionGoalConstPtr &goal)

while i should type as follow:

void LoadActionFunc(const qr_drive::load_service_06GoalConstPtr &request) ;

After this correction, my compiler doesn't throw any error and problem solved.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-08-06 05:24:29 -0500

Seen: 80 times

Last updated: Aug 10 '21