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

Node subscribe error

asked 2013-03-15 03:30:30 -0500

kiranadam gravatar image

updated 2013-03-15 05:46:44 -0500

joq gravatar image

I've the error with node I tried these both

class DriveControlNode 
{
    public: DriveControlNode( ros::NodeHandle& node ) 
    {
         joy_sub = node.subscribe<sensor_msgs::Joy>("/joy",1000,Joystick_callback);
       //joy_sub = node.subscribe<sensor_msgs::Joy>("/joy",1000,boost::bind(&DriveControlNode::Joystick_callback,this,_1));         
     }      

    void Joystick_callback(sensor_msgs::Joy::ConstPtr& msg)
    {
            // some values
    }   
}

errors are as follows Case 1:

/usr/include/boost/function/function_template.hpp:225:11: error: no match for call to ‘(boost::_mfi::mf1<void, DriveControlNode, boost::shared_ptr<const sensor_msgs::Joy_<std::allocator<void> > >&>) (const boost::shared_ptr<const sensor_msgs::Joy_<std::allocator<void> > >&)’

Case 2:

/usr/include/boost/bind/bind.hpp:313:9: error: no match for call to ‘(boost::_mfi::mf1<void, DriveControlNode, boost::shared_ptr<const sensor_msgs::Joy_<std::allocator<void> > >&>) (DriveControlNode*&, const boost::shared_ptr<const sensor_msgs::Joy_<std::allocator<void> > >&)’

Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2013-03-15 05:56:27 -0500

kiranadam gravatar image

updated 2013-03-15 05:57:22 -0500

In here was the problem

void Joystick_callback(sensor_msgs::Joy::ConstPtr& msg) { // some values }

missed const

void Joystick_callback(const sensor_msgs::Joy::ConstPtr& msg) { // some values }

Thanks for the reply

edit flag offensive delete link more

Comments

I have a similar problem and this do not solve the problem

Kansai gravatar image Kansai  ( 2021-02-04 05:24:12 -0500 )edit
3

answered 2013-03-15 05:50:06 -0500

joq gravatar image

Try it this way:

joy_sub = node.subscribe<sensor_msgs::Joy>("/joy", 1000, DriveControlNode::Joystick_callback, this);
edit flag offensive delete link more

Comments

void Joystick_callback(sensor_msgs::Joy::ConstPtr& msg) { // some values } here

kiranadam gravatar image kiranadam  ( 2013-03-15 05:53:56 -0500 )edit

Question Tools

Stats

Asked: 2013-03-15 03:30:30 -0500

Seen: 1,740 times

Last updated: Mar 15 '13