Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
Merge pull request #45 from AkiraShibata18/2022.07.11-add-timestamp-n…
Browse files Browse the repository at this point in the history
…ow-unless-use-device-timestamp

add timestamp from ros::Time::now unless use_device_timestamp param
  • Loading branch information
AkiraShibata18 authored Jul 11, 2022
2 parents 90b54a6 + 87f7557 commit 89390e0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions spinnaker_camera_driver/src/SpinnakerCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,16 @@ void SpinnakerCamera::grabImage(sensor_msgs::Image* image, const std::string& fr
if (use_device_seq_) image->header.seq = static_cast<uint32_t>(image_ptr->GetID());
else image->header.seq = seq_++;

ros::Time img_time = ros::Time();
img_time.fromNSec(static_cast<uint64_t>(image_ptr->GetTimeStamp()));
image->header.stamp = img_time + timestamp_diff;
if (use_device_timestamp)
{
ros::Time img_time = ros::Time();
img_time.fromNSec(static_cast<uint64_t>(image_ptr->GetTimeStamp()));
image->header.stamp = img_time + timestamp_diff;
}
else
{
image->header.stamp = ros::Time::now();
}

if (image_ptr->IsCompressed())
{
Expand Down

0 comments on commit 89390e0

Please sign in to comment.