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

Revision history [back]

I am not sure image_transport can handle stereo_msgs/DisparityImage, probably it can. In such case just make sure that imageCallback has the following signature:

void imageCallback(const stereo_msgs::DisparityImage& msg);

If that doesn't work, this will work for sure:

#include <ros/ros.h>
#include <stereo_msgs/DisparityImage.h>

void disparityImageCallback(const stereo_msgs::DisparityImage& msg)
{
    //Do cool stuff here
}

....

int main (int argc, char **argv)
{
  ...
  ros::NodeHandle nh;
  ros::Subscriber sub = nh.subscribe("/stereo/disparity", 1, disparityImageCallback);

  ...
}