correct use of time sequencer filter code with boost::shared_ptr.

asked 2020-06-12 09:21:13 -0500

azerila gravatar image

I am making a time sequencer message filter in a robot hardware-interface and I have an issue for my usage of boost and shared pointer which couldn't figure out what it is about with my c++ basic.

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));

and my header file looks like the following(only the relevant part is coppied):

#include <message_filters/subscriber.h>
#include <message_filters/time_sequencer.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_;
};

my cpp file parts that are also related looks like the following(also partly copied):

#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){
}

the sensor_msgs::JointState that I have used is only for experiments, and it is a custom message that I will use in the end.

edit retag flag offensive close merge delete