src/k4a_ros_device.cpp
// Converts a k4a *device* timestamp to a ros::Time object
Converts a k4a *device* timestamp to a ros::Time object
Converts a k4a * device * timestamp to a ros :: Time object
ros::Time K4AROSDevice::timestampToROS(const std::chrono::microseconds& k4a_timestamp_us)
{
  if (device_to_realtime_offset_.count() == 0)
  {
    initializeTimestampOffset(k4a_timestamp_us);
  }
  std::chrono::nanoseconds timestamp_in_realtime = k4a_timestamp_us + device_to_realtime_offset_;
  ros::Time ros_time;
  ros_time.fromNSec(timestamp_in_realtime.count());
  return ros_time;
}
ros :: Time K4AROSDevice :: timestampToROS ( const std :: chrono :: microseconds & k4a_timestamp_us ) { if ( device_to_realtime_offset_ . count ( ) == 0 ) { initializeTimestampOffset ( k4a_timestamp_us ) ; } std :: chrono :: nanoseconds timestamp_in_realtime = k4a_timestamp_us + device_to_realtime_offset_ ; ros :: Time ros_time ; ros_time . fromNSec ( timestamp_in_realtime . count ( ) ) ; return ros_time ; }
Converts a k4a *device* timestamp to a ros::Time object
Converts a k4a * device * timestamp to a ros :: Time object
// This will give INCORRECT timestamps until the first image.