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

passing image as a message

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

younes gravatar image
 Hi,

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;
  odom_output.header.seq++;*/

  pub_vo.publish(odom_output);
}

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Stats

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

Seen: 118 times

Last updated: Aug 31 '15