Re: [ros-users] no matching function for call to ‘ros::NodeH…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] no matching function for call to ‘ros::NodeHandle::subscribe...
Martin,
The message_filters::Subscriber takes constructor arguments for the
subscription and does not accept assignment from a generic subscription
object. Then you have to register the callback. See
http://www.ros.org/wiki/message_filters

Tully

PS if you want to call a class method as your callback you will also need to
pass the object as well as the method. This should be helpful for that
http://www.ros.org/wiki/roscpp_tutorials/Tutorials/UsingClassMethodsAsCallbacksit's
not the same interface but follows the same conventions.

On Mon, Oct 18, 2010 at 1:02 PM, Martin, L <> wrote:

>
> Hi,
>
> I am a ROS newbie and I was trying to compile the following code:
>
> class CloudToPCDFile{
> public:
>  ros::NodeHandle n_;
>  message_filters::Subscriber<sensor_msgs::PointCloud> laser_sub_;
>  CloudToPCDFile(ros::NodeHandle n) :
>         n_(n)
>    {
>          laser_sub_=n_.subscribe("/ptu_46/assembled_cloud", 100,
> scanCallback);
>    }

>
>  void scanCallback (const sensor_msgs::PointCloudConstPtr& scan_in)
>  {
>          //Dummy
>  }
> };

>
> int main(int argc, char** argv)
> {
> ros::init(argc, argv, "cloud_to_pcd_file");
> ros::NodeHandle n;
> CloudToPCDFile lstopc(n);
> ros::spin();
> return 0;
> }
>
>
> however, I unfortunately get the following error:
> error: no matching function for call to ‘ros::NodeHandle::subscribe(const
> char [24], int, <unresolved overloaded function type>)’
>
> any idea what I could be doing wrong?
>
> many thanks!
>
> --
> View this message in context:
> http://ros-users.122217.n3.nabble.com/no-matching-function-for-call-to-ros-NodeHandle-subscribe-tp1727890p1727890.html
> Sent from the ROS-Users mailing list archive at Nabble.com.
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>




--
Tully Foote
Systems Engineer
Willow Garage, Inc.

(650) 475-2827