Skip to content

Commit

Permalink
Fixed image and cinfo headers' frame + timestamp (from fuerte branch).
Browse files Browse the repository at this point in the history
  • Loading branch information
ktossell committed Sep 26, 2013
1 parent 928a5c3 commit c071441
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libuvc_camera/src/camera_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ void CameraDriver::ReconfigureCallback(UVCCameraConfig &new_config, uint32_t lev
}

void CameraDriver::ImageCallback(uvc_frame_t *frame) {
// TODO: Switch to {frame}'s timestamp once that becomes reliable.
ros::Time timestamp = ros::Time::now();

boost::recursive_mutex::scoped_lock(mutex_);

assert(state_ == kRunning);
Expand All @@ -169,6 +172,11 @@ void CameraDriver::ImageCallback(uvc_frame_t *frame) {
sensor_msgs::CameraInfo::ConstPtr cinfo(
new sensor_msgs::CameraInfo(cinfo_manager_.getCameraInfo()));

image->header.frame_id = config_.frame_id;
image->header.stamp = timestamp;
cinfo->header.frame_id = config_.frame_id;
cinfo->header.stamp = timestamp;

cam_pub_.publish(image, cinfo);

if (config_changed_) {
Expand Down

0 comments on commit c071441

Please sign in to comment.