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

Error: no matching function for call to 'ros::Nodehandle::advertise()'

asked 2017-02-22 08:37:05 -0600

sharan100 gravatar image

updated 2017-02-22 23:16:50 -0600

Error

/home/sharan/catkin_ws/src/zlab_drone/src/videoFeedListener.cpp: In constructor ‘ImageConverter::ImageConverter()’:
/home/sharan/catkin_ws/src/zlab_drone/src/videoFeedListener.cpp:67:46: error: no matching function for call to ‘ros::NodeHandle::advertise(const char [9], int)’
     circle_pub_ = nh_.advertise("/circles", 1);

Code

class ImageConverter {
  ros::NodeHandle nh_;
  image_transport::ImageTransport it_;
  image_transport::Subscriber image_sub_;
  image_transport::Publisher image_pub_;
  ros::Publisher circle_pub_;

  public:
  ImageConverter()
    : it_(nh_)
  {

    // Subscribe to the Bottom Raw Image
    image_sub_ = it_.subscribe("/ardrone/bottom/image_raw", 1,  
                &ImageConverter::imageCb, this);

    // Advertisng the Circles being detected from this 
    circle_pub_ = nh_.advertise("/circles", 1); 

    cv::namedWindow(OPENCV_WINDOW1);
  }
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-02-22 09:34:26 -0600

huanxiner gravatar image

updated 2017-02-22 09:35:39 -0600

What's the message type that you are publishing on topic /circles?

ros::Publisher pub = handle.advertise<std_msgs::Empty>("my_topic", 1);
                                      ~~~~~~~~~~~~~~~   You are missing this part
edit flag offensive delete link more

Comments

Yes, this works!

sharan100 gravatar image sharan100  ( 2017-02-22 23:26:56 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-02-22 08:37:05 -0600

Seen: 3,509 times

Last updated: Feb 22 '17