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

Want to pass a string or int to a class callback. [closed]

asked 2013-08-22 16:24:54 -0500

rnunziata gravatar image

updated 2013-08-23 06:38:35 -0500

Update Variation

n.subscribe <control_msgs::JointControllerState> ("/rrbot/joint2_position_controller/state", 10, boost::bind(&PublishOdometry::jointStateCallback2,this,_1,1),this);


ERR:/home/rnunziata/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_jntcmd_to_jntst.cpp: In constructor ‘PublishOdometry::PublishOdometry()’:
/home/rnunziata/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_jntcmd_to_jntst.cpp:29:185: error: no matching function for call to ‘ros::NodeHandle::subscribe(const char [40], int, boost::_bi::bind_t<void, boost::_mfi::mf2<void, PublishOdometry, control_msgs::JointControllerState_<std::allocator<void> >, int>, boost::_bi::list3<boost::_bi::value<PublishOdometry*>, boost::arg<1>, boost::_bi::value<int> > >, PublishOdometry* const)’
/home/rnunziata/catkin_ws/src/gazebo_ros_demos/rrbot_control/src/robot_jntcmd_to_jntst.cpp:29:185: note: candidates are:
/opt/ros/hydro/include/ros/node_handle.h:379:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(M), T*, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:390:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(M)const, T*, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:438:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(const boost::shared_ptr<const MReq>&), T*, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:448:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(const boost::shared_ptr<const MReq>&)const, T*, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:498:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(M), const boost::shared_ptr<U>&, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:509:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(M)const, const boost::shared_ptr<U>&, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:559:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(const boost::shared_ptr<const MReq>&), const boost::shared_ptr<U>&, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:570:14: note: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(const boost::shared_ptr<const MReq>&)const, const boost::shared_ptr<U>&, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:618:14: note: template<class M> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (*)(M), const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:663:14: note: template<class M> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (*)(const boost::shared_ptr<const M>&), const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:706:14: note: template<class M> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, const boost::function<void(const boost::shared_ptr<const M>&)>&, const VoidConstPtr&, const ros::TransportHints&)
/opt/ros/hydro/include/ros/node_handle.h:752:14: note: template<class M, class C> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, const boost::function<void(C)>&, const VoidConstPtr&, const ros::TransportHints&)
make[2 ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2016-08-08 01:43:07.495648

2 Answers

Sort by » oldest newest most voted
0

answered 2013-08-22 23:47:09 -0500

dornhege gravatar image

Try adding the message specification <control_msgs::jointcontrollerstate> to the subscribe.

If that doesn't work, copy the actual error here.

edit flag offensive delete link more

Comments

can not format in comment section I updated main question.

rnunziata gravatar image rnunziata  ( 2013-08-23 03:25:37 -0500 )edit

Which one is your callback function? jointStateCallback2 or jointStateCallback ?

Joao Ferreira Jr gravatar image Joao Ferreira Jr  ( 2013-08-23 05:56:36 -0500 )edit

Sorry bad cut and paste ...updated main questiong

rnunziata gravatar image rnunziata  ( 2013-08-23 06:07:34 -0500 )edit
0

answered 2013-08-23 06:23:08 -0500

updated 2013-08-23 06:25:14 -0500

I didn't test it yet, but try replacing your subscription to this:


n.subscribe <control_msgs::jointcontrollerstate> ("/rrbot/joint2_position_controller/state", 10, boost::bind(&PublishOdometry::jointStateCallback2,this,_1,1),this);


edit flag offensive delete link more

Comments

Tried it...updated question...does not resolve

rnunziata gravatar image rnunziata  ( 2013-08-23 06:39:29 -0500 )edit

Ok... I don't have any better idea. I guessed it could work because I had to do that when tried to subscribe to a topic inside an actionServer... it worked like that: ros::NodeHandle nh; ros::Subscriber hand_detect_sub = nh.subscribe("highlighted_user" , 5 , &ActivityServer::handDetectionCallback , this); In that case, I was already inside my callback function - called ActivityServer::executeCB - when I subscribed to ActivityServer::handDetectionCallback

Joao Ferreira Jr gravatar image Joao Ferreira Jr  ( 2013-08-23 06:49:17 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2013-08-22 16:24:54 -0500

Seen: 255 times

Last updated: Aug 23 '13