错误:否>匹配通话‘(boost :: _ mfi :: mf1< void [英] error: no > match for call to ‘(boost::_mfi::mf1<void
问题描述
我相当了解c ++,下面描述的一个问题可能很简单,并且是基于语法错误的,但是我还没有找到解决这个问题的方法. 基本上我得到的错误是:
I have rather a basic knowledge in c++ and there is an issue described in the following which is likely rather simple and a based on a syntax mistake but I haven't figured out a way around it. Basically the error I get says:
remote_hw_interface_node.cpp:23:68: required from here
/usr/include/boost/function/function_template.hpp:231:11: error: no match for call to ‘(boost::_mfi::mf1<void, ROBOTHardwareInterface, const boost::shared_ptr<sensor_msgs::JointState_<std::allocator<void>
> > >&>) (const boost::shared_ptr<const sensor_msgs::JointState_<std::allocator<void> > >&)’
BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS));
^
关于增强功能,我不知道这是什么.
which I don't have any clue what it is about regarding boost.
关于我的代码,我在下面复制了其中的某些部分,对于有经验的c ++用户,这可能会显示出问题.我的头文件看起来像:
regarding my code I have copied some parts of it in the following which may likely show the problem for a more experienced c++ user. My header file looks like:
#pragma once
#include <message_filters/subscriber.h>
#include <message_filters/time_sequencer.h>
// controller manager and interface msgs
#include <controller_manager/controller_manager.h>
class ROBOTHardwareInterface : public hardware_interface::RobotHW
{
public:
ROBOTHardwareInterface(ros::NodeHandle& nh);
~ROBOTHardwareInterface();
bool init (const urdf::Model* const urdf_model);
void sequential_update (const boost::shared_ptr <sensor_msgs::JointState> & joint_state_msg);
// main
ros::NodeHandle nh_;
ros::Duration elapsed_time_;
boost::shared_ptr<controller_manager::ControllerManager> controller_manager_;
};
如果我仅复制相关部分也导致出现错误,则cpp文件也将出现:
the cpp file also if I only copy the relevant parts which has also caused the error coming up:
#include <remote_hw.h>
ROBOTHardwareInterface::ROBOTHardwareInterface(ros::NodeHandle& nh) : nh_(nh) {
message_filters::Subscriber <sensor_msgs::JointState> sub(nh_, "joint_cmd_topic", 1);
message_filters::TimeSequencer <sensor_msgs::JointState> seq(sub, ros::Duration(
0.1), ros::Duration(0.01), 10);
seq.registerCallback(&ROBOTHardwareInterface::sequential_update);
}
ROBOTHardwareInterface::~ROBOTHardwareInterface() {
}}
void ROBOTHardwareInterface::sequential_update(const boost::shared_ptr <sensor_msgs::JointState> & joint_state_msg){
推荐答案
By searching in boost library implementation https://www.boost.org/doc/libs/1_71_0/boost/function/function_template.hpp, it seems that you are trying to call a method without giving all the parameters necessary.
我想您尝试用一个空参数调用此方法,同时还应该添加const boost::shared_ptr <sensor_msgs::JointState> &
.
I suppose that you try to invoke this method with an empty parameter, while you should also add const boost::shared_ptr <sensor_msgs::JointState> &
as well.
我认为您的情况下BOOST_FUNCTION_ARGS为空,因此您遇到了问题.因此,后面的方法试图调用void sequential_update()
而不是void sequential_update(const boost::shared_ptr <sensor_msgs::JointState> &)
I suppose that BOOST_FUNCTION_ARGS in your case is empty hence your issue. So the method behind is trying to invoke void sequential_update()
instead of void sequential_update(const boost::shared_ptr <sensor_msgs::JointState> &)
我希望这会有所帮助.
这篇关于错误:否>匹配通话‘(boost :: _ mfi :: mf1< void的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!