Hi,
Right now we're using the following code to compute the Ros time for a message:
def __init__(self):
self.__ros_base_time = self.get_clock().now()
self.__dai_base_time = Clock.now()
def ros_time_msg(self, frame: ImgFrame) -> Time:
dai_time = frame.getTimestamp()
elapsed = dai_time - self.__dai_base_time
elapsed = elapsed.total_seconds()
ros_time = self.__ros_base_time + Duration(seconds=elapsed)
return ros_time.to_msg()
Our application requires monotonicity, but we're unsure if the code above guarantees that. In the docs I see that there's getTimeStamp(.)
and getTimeStampDevice(.)
getTimestamp(\*args, \*\*kwargs)
1\. getTimestamp(self: depthai.ImgFrame) -> datetime.timedelta
Retrieves timestamp related to dai::Clock::now()
2\. getTimestamp(self: depthai.ImgFrame, offset: depthai.CameraExposureOffset) -> datetime.timedelta
Retrieves image timestamp (at the specified offset of exposure) related to dai::Clock::now()
getTimestampDevice(\*args, \*\*kwargs)
1\. getTimestampDevice(self: depthai.ImgFrame) -> datetime.timedelta
Retrieves timestamp directly captured from device's monotonic clock, not synchronized to host time. Used mostly for debugging
2\. getTimestampDevice(self: depthai.ImgFrame, offset: depthai.CameraExposureOffset) -> datetime.timedelta
Retrieves image timestamp (at the specified offset of exposure) directly captured from device's monotonic clock, not synchronized to host time. Used when monotonicity is required.
Do we need getTimestampDevice(self: depthai.ImgFrame, offset: depthai.CameraExposureOffset) for guaranteed monotonicity? And if so, how do we use it? There's no example in the docs how to use this function.
Thanks in advance