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

passing image as a message

asked 2015-08-31 07:40:33 -0600

younes gravatar image

I would like to understand this function

 void image_callback(sensor_msgs::ImageConstPtr image)
  ROS_DEBUG_STREAM("VO:image_callback{" << ros::Time::now() << "} seq=" << image->header.seq);

  static nav_msgs::Odometry odom_output;

/* vo->on_image(&image->data[0], (image->encoding == "bgr8" ? false : true), image->width, image->height, &odom_output.twist.twist.linear.x, &odom_output.twist.twist.angular.z);

  odom_output.header.stamp = image->header.stamp;



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-31 08:32:06 -0600

Oded gravatar image

It looks like a piece of code out of a visual Odometry Node. The function receives an image, and publishes the Odometry output using a global publisher object.

The code which is in comment

vo->on_image(&image->data[0], (image->encoding == "bgr8" ? false : true), image->width, image->height, &odom_output.twist.twist.linear.x, &odom_output.twist.twist.angular.z);

is a global VO class that receives:

  1. The image
  2. Bool encodedFlag
  3. Int imageWidth
  4. Int imageHeight
  5. Float *linearSpeedOutput
  6. Float *angularSpeedOutput The outputs are stored into the odom_output message variable, which is of type nav_msgs::Odometry. Also added to the message is the stamp of which the image was taken and a sequence value.
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-08-31 07:40:33 -0600

Seen: 97 times

Last updated: Aug 31 '15